You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
265 lines
7.2 KiB
265 lines
7.2 KiB
4 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using QMAPP.Entity.Sys;
|
||
|
using QMAPP.DAL.Sys;
|
||
|
using QMFrameWork.Data;
|
||
|
|
||
|
namespace QMAPP.BLL.Sys
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 模块编号:
|
||
|
/// 作 用:
|
||
|
/// 作 者:
|
||
|
/// 编写日期:2014年12月18日
|
||
|
///</summary>
|
||
|
public class FileTypeBLL : BaseBLL
|
||
|
{
|
||
|
#region 获取信息
|
||
|
/// <summary>
|
||
|
/// 获取信息
|
||
|
/// </summary>
|
||
|
/// <param name="">条件</param>
|
||
|
/// <returns>信息</returns>
|
||
|
public FileType Get(FileType model)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new FileTypeDAL().Get(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 获取列表
|
||
|
/// <summary>
|
||
|
/// 获取列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataPage GetList(FileType condition, DataPage page)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new FileTypeDAL().GetList(condition, page);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 信息是否重复
|
||
|
/// <summary>
|
||
|
/// 判断名称是否存在
|
||
|
/// </summary>
|
||
|
/// <param name="info"></param>
|
||
|
/// <returns>true:已存在;fasel:不存在。</returns>
|
||
|
public bool ExistsFileType(FileType model)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new FileTypeDAL().ExistsFileType(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 插入信息
|
||
|
/// <summary>
|
||
|
/// 插入信息(单表)
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>插入行数</returns>
|
||
|
public int Insert(FileType model)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
//基本信息
|
||
|
model.TYPENO = Guid.NewGuid().ToString();
|
||
|
model.CREATEUSER = this.LoginUser.UserID;
|
||
|
model.CREATEDATE = DateTime.Now;
|
||
|
model.UPDATEUSER = model.CREATEUSER;
|
||
|
model.UPDATEDATE = model.CREATEDATE;
|
||
|
if (ExistsFileType(model) == true)
|
||
|
return -1;
|
||
|
return new FileTypeDAL().Insert(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 更新信息
|
||
|
/// <summary>
|
||
|
/// 更新信息
|
||
|
/// </summary>
|
||
|
/// <param name=""></param>
|
||
|
/// <returns>更新行数</returns>
|
||
|
public int Update(FileType model)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
//基本信息
|
||
|
model.UPDATEUSER = this.LoginUser.UserID;
|
||
|
if (ExistsFileType(model) == true)
|
||
|
return -1;
|
||
|
return new FileTypeDAL().Update(model);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 删除
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name=""></param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public int Delete(string strs)
|
||
|
{
|
||
|
int count = 0;
|
||
|
string[] list = strs.Split(":".ToCharArray());
|
||
|
FileInfoDAL fileDal = new FileInfoDAL();
|
||
|
try
|
||
|
{
|
||
|
foreach (string str in list)
|
||
|
{
|
||
|
//删除文件类型
|
||
|
count += this.DeleteFileType(new FileType { TYPENO = str });
|
||
|
//删除文件类型下的文件
|
||
|
count += fileDal.DeleteByTypeNo(new FileInfo { TYPENO = str });
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// 删除信息
|
||
|
/// </summary>
|
||
|
/// <param name="">信息</param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
public int DeleteFileType(FileType model)
|
||
|
{
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
count = new FileTypeDAL().Delete(model);
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 获取文件类别菜单列表
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取所有组织机构数菜单列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <returns>同级别菜单列表</returns>
|
||
|
public List<FileType> GetAllList()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new FileTypeDAL().GetAllList();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 获取文件类型下拉列表(字典)
|
||
|
/// <summary>
|
||
|
/// 获取文件类型下拉列表
|
||
|
/// </summary>
|
||
|
/// <param name="model">查询条件</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public List<FileType> GetCombox()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new FileTypeDAL().GetCombox();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 删除文件类型,同时删除文件类型下的文件、附件
|
||
|
/// <summary>
|
||
|
/// 删除文件类型,同时删除文件类型下的文件、附件
|
||
|
/// </summary>
|
||
|
/// <param name="ids"></param>
|
||
|
/// <returns></returns>
|
||
|
public int DeleteFile(string ids)
|
||
|
{
|
||
|
FileType file = new FileType();
|
||
|
IList<FileInfo> listModel = new List<FileInfo>();
|
||
|
FileTypeDAL typeDal = new FileTypeDAL();
|
||
|
FileInfoDAL fileDal = new FileInfoDAL();
|
||
|
FileInfoBLL fileBll = new FileInfoBLL();
|
||
|
int count = 0;
|
||
|
try
|
||
|
{
|
||
|
if (!string.IsNullOrEmpty(ids))
|
||
|
{
|
||
|
string[] list = ids.Split(":".ToCharArray());
|
||
|
//删除附件
|
||
|
foreach (var item in list)
|
||
|
{
|
||
|
file.TYPENO = item;
|
||
|
listModel = fileBll.GetListModel(file);
|
||
|
foreach (var itemModel in listModel)
|
||
|
{
|
||
|
fileBll.DeleteFile(itemModel.FILESTORAGENAME);
|
||
|
}
|
||
|
}
|
||
|
//删除文件类型
|
||
|
count = Delete(ids);
|
||
|
|
||
|
//删除文件类型下的文件信息
|
||
|
count = fileBll.Delete(ids);
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
return count;
|
||
|
}
|
||
|
#endregion
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|