using System; using System.Collections.Generic; using System.Linq; using System.Text; using QMFrameWork.Data; using QMAPP.Entity.Sys; using QMAPP.DAL.Sys; using System.Collections; using System.Data; namespace QMAPP.BLL.Sys { /// /// 角色管理 /// 创建者:郭佳伟 /// 创建日期:2013.1.29 /// public class RoleManageBLL : BaseBLL { #region 获取角色信息 /// /// 获取角色信息 /// /// 条件 /// 角色信息 public Role Get(Role role) { try { return new RoleManageDAL().Get(role); } catch (Exception ex) { throw ex; } } #endregion #region 获取角色列表 /// /// 获取角色列表 /// /// 条件 /// 数据页 /// 数据页 public DataPage GetList(Role condition, DataPage page) { try { return new RoleManageDAL().GetList(condition, page); } catch (Exception ex) { throw ex; } } #endregion #region 获取角色列表 /// /// 获取全部角色信息 /// /// 条件 /// 角色信息 public Role GetAll() { try { return new RoleManageDAL().GetAll(); } catch (Exception ex) { throw ex; } } /// /// 获取全部角色信息 /// /// 机构主键 /// 数据列表 public List GetRolesByOrgan(string organID) { return new RoleManageDAL().GetRolesByOrgan(organID); } #endregion #region 判断角色名称是否存在 /// /// 判断角色名称是否存在 /// /// 角色信息 /// true:已存在;fasel:不存在。 public bool ExistsRole(Role role) { try { return new RoleManageDAL().ExistsRole(role); } catch (Exception ex) { throw ex; } } #endregion #region 插入角色 /// /// 插入角色 /// /// 角色信息 /// 插入数 public int Insert(Role role) { try { role.RoleID = Guid.NewGuid().ToString(); role.OrgaID = ""; role.CreateUser = this.LoginUser.UserID; role.UpdateUser = this.LoginUser.UserID; foreach (RoleAuthority ra in role.Powers) { ra.RoleID = role.RoleID; ra.CreateUser = this.LoginUser.UserID; ra.UpdateUser = this.LoginUser.UserID; } return new RoleManageDAL().Insert(role); } catch (Exception ex) { throw ex; } } #endregion #region 删除角色 /// /// 删除角色信息 /// /// 角色信息 /// 删除个数 public int BatchDelete(ArrayList roles) { int count = 0; try { foreach (string role in roles) { count += this.Delete(new Role { RoleID = role }); } return count; } catch (Exception ex) { throw ex; } } /// /// 删除角色信息 /// /// 角色信息 /// 删除行数 public int Delete(Role role) { int count = 0; try { count = new RoleManageDAL().Delete(role); return count; } catch (Exception ex) { throw ex; } } #endregion #region 更新角色 /// /// 更新角色 /// /// 角色信息 /// 更新个数 public int Update(Role role) { try { foreach (RoleAuthority ra in role.Powers) { ra.RoleID = role.RoleID; ra.CreateUser = this.LoginUser.UserID; ra.UpdateUser = this.LoginUser.UserID; } role.OrgaID = ""; role.UpdateUser = this.LoginUser.UserID; return new RoleManageDAL().Update(role); } catch (Exception ex) { throw ex; } } #endregion #region 获取导出的数据 /// /// 获取导出的数据 /// /// 查询条件 /// 数据 public DataTable GetExportData(Role condition) { return new RoleManageDAL().GetExportData(condition); } #endregion } }