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
{
///
/// 用户委托授权
/// 作 者:李炳海
/// 编写日期:2015年01月07日
///
public class UserEntrustBLL:BaseBLL
{
#region 获取信息
///
/// 获取信息
///
/// 条件
/// *信息
public UserEntrust Get(UserEntrust info)
{
return new UserEntrustDAL().Get(info);
}
#endregion
#region 获取业务权限信息
///
/// 获取业务权限信息
///
/// 获取条件
/// 业务权限信息
public UserEntrustBusiPower GetBusiInfo(UserEntrustBusiPower info)
{
return new UserEntrustDAL().GetBusiInfo(info);
}
#endregion
#region 获取列表
///
/// 获取列表
///
/// 条件
/// 数据页
/// 数据页
public DataPage GetList(UserEntrust condition, DataPage page)
{
return new UserEntrustDAL().GetList(condition, page);
}
#endregion
#region 获取导出的数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataTable GetExportData(UserEntrust info)
{
return new UserEntrustDAL().GetExportData(info);
}
#endregion
#region 插入信息
///
/// 插入信息(单表)
///
/// 信息
/// 插入行数
public int Insert(UserEntrust info)
{
info.PID = Guid.NewGuid().ToString();
info.Authoritys = new List();
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 更新信息
///
/// 更新信息
///
///
/// 更新行数
public int Update(UserEntrust info)
{
info.Authoritys = new List();
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 删除
///
/// 批量删除信息
///
/// 公告信息
/// 删除个数
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;
}
}
///
/// 逻辑删除信息
///
///
/// 删除个数
public int Delete(UserEntrust info)
{
return new UserEntrustDAL().Delete(info);
}
#endregion
#region 保存业务数据权限
///
/// 保存业务数据权限
///
/// 业务数据权限
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
}
}