天津投入产出系统后端
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.
 
 
 
 
 
 

192 lines
5.6 KiB

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMFrameWork.Data;
using QMAPP.Entity.Sys.Entity;
using QMAPP.Entity.Sys;
using QMAPP.DAL.Sys;
namespace QMAPP.BLL.Sys
{
/// </summary>
/// 用户委托授权
/// 作 者:李炳海
/// 编写日期:2015年01月07日
/// </summary>
public class UserEntrustBLL:BaseBLL
{
#region 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>*信息</returns>
public UserEntrust Get(UserEntrust info)
{
return new UserEntrustDAL().Get(info);
}
#endregion
#region 获取业务权限信息
/// <summary>
/// 获取业务权限信息
/// </summary>
/// <param name="info">获取条件</param>
/// <returns>业务权限信息</returns>
public UserEntrustBusiPower GetBusiInfo(UserEntrustBusiPower info)
{
return new UserEntrustDAL().GetBusiInfo(info);
}
#endregion
#region 获取列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetList(UserEntrust condition, DataPage page)
{
return new UserEntrustDAL().GetList(condition, page);
}
#endregion
#region 获取导出的数据
/// <summary>
/// 获取导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataTable GetExportData(UserEntrust info)
{
return new UserEntrustDAL().GetExportData(info);
}
#endregion
#region 插入信息
/// <summary>
/// 插入信息(单表)
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public int Insert(UserEntrust info)
{
info.PID = Guid.NewGuid().ToString();
info.Authoritys = new List<T_QM_ENTRUSTAUTHORITY>();
if (string.IsNullOrEmpty(info.AuthorityList) == false)
{
string[] arrray = info.AuthorityList.Split(":".ToCharArray());
foreach (string powerID in arrray)
{
T_QM_ENTRUSTAUTHORITY item = new T_QM_ENTRUSTAUTHORITY();
item.PID = Guid.NewGuid().ToString();
item.ENTRUSTPID = info.PID;
item.AUTHORITYID = powerID;
info.Authoritys.Add(item);
}
}
info.FLGDEL = "0";
info.CREATEUSER = this.LoginUser.UserID;
info.UPDATEUSER = this.LoginUser.UserID;
return new UserEntrustDAL().Insert(info);
}
#endregion
#region 更新信息
/// <summary>
/// 更新信息
/// </summary>
/// <param name=""></param>
/// <returns>更新行数</returns>
public int Update(UserEntrust info)
{
info.Authoritys = new List<T_QM_ENTRUSTAUTHORITY>();
if (string.IsNullOrEmpty(info.AuthorityList) == false)
{
string[] arrray = info.AuthorityList.Split(":".ToCharArray());
foreach (string powerID in arrray)
{
T_QM_ENTRUSTAUTHORITY item = new T_QM_ENTRUSTAUTHORITY();
item.PID = Guid.NewGuid().ToString();
item.ENTRUSTPID = info.PID;
item.AUTHORITYID = powerID;
info.Authoritys.Add(item);
}
}
info.UPDATEUSER = this.LoginUser.UserID;
return new UserEntrustDAL().Update(info);
}
#endregion
#region 删除
/// <summary>
/// 批量删除信息
/// </summary>
/// <param name="lockInfo">公告信息</param>
/// <returns>删除个数</returns>
public int DeleteList(ArrayList infos)
{
int count = 0;
try
{
foreach (string id in infos)
{
count += this.Delete(new UserEntrust { PID = id,UPDATEUSER=this.LoginUser.UserID });
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 逻辑删除信息
/// </summary>
/// <param name=""></param>
/// <returns>删除个数</returns>
public int Delete(UserEntrust info)
{
return new UserEntrustDAL().Delete(info);
}
#endregion
#region 保存业务数据权限
/// <summary>
/// 保存业务数据权限
/// </summary>
/// <param name="info">业务数据权限</param>
public void SaveBusinessPower(UserEntrustBusiPower info)
{
//业务权限
foreach (ParaAuthorityPort d in info.BusinessPowers)
{
d.PID = Guid.NewGuid().ToString();
d.RELATIONID = info.PID;
d.CREATEUSER = this.LoginUser.UserID;
d.CREATEDATE = DateTime.Now;
d.UPDATEUSER = this.LoginUser.UserID;
d.UPDATEDATE = d.CREATEDATE;
}
new UserEntrustDAL().SaveBusinessPower(info);
}
#endregion
}
}