using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Text;
using QMFrameWork.Data;
using QMAPP.Entity.Report;
using QMAPP.Entity.Sys;
using QMAPP.DAL.Report;
using QMAPP.DAL.Sys;
namespace QMAPP.BLL.Report
{
///
/// 用户权限查询
///
public class QueryUserPowerBLL : BaseBLL
{
#region 获取用户权限信息
///
/// 获取用户权限信息
///
/// 查询条件
/// 数据页
public DataPage GetUserPowerList(PowerQyCondition condition, DataPage page)
{
//获取权限
page = new QueryUserPowerDAL().GetUserPowerList(condition, page);
//获取角色信息
List roles = new RoleManageDAL().GetAll().Roles;
//获取组织机构信息
List organs = new OrgaizationManageDAL().GetAllList();
//结果汇总
List resultList = page.Result as List;
foreach (PowerQueryResult result in resultList)
{
Role r = roles.Find(p => p.RoleID == result.ROLEID);
result.ROLENAME = r != null ? r.RoleDESC : "";
Orgaization o = organs.Find(p => p.OrgaID == result.ORGANID);
result.ORGANNAME = o != null ? o.OrgaDESC : "";
}
page.Result = resultList;
return page;
}
#endregion
#region 获取导出的数据
///
/// 获取导出的数据
///
/// 查询条件
/// 数据
public DataTable GetExportData(PowerQyCondition condition)
{
//获取权限
DataTable dt = new QueryUserPowerDAL().GetExportData(condition);
//获取角色信息
List roles = new RoleManageDAL().GetAll().Roles;
//获取组织机构信息
List organs = new OrgaizationManageDAL().GetAllList();
foreach (DataRow row in dt.Rows)
{
Role r = roles.Find(p => p.RoleID == row["ROLEID"].ToString());
row["ROLENAME"] = r != null ? r.RoleDESC : "";
Orgaization o = organs.Find(p => p.OrgaID == row["ORGANID"]);
row["ORGANNAME"] = o != null ? o.OrgaDESC : "";
}
return dt;
}
#endregion
}
}