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.
238 lines
5.8 KiB
238 lines
5.8 KiB
4 years ago
|
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
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 角色管理
|
||
|
/// 创建者:郭佳伟
|
||
|
/// 创建日期:2013.1.29
|
||
|
/// </summary>
|
||
|
public class RoleManageBLL : BaseBLL
|
||
|
{
|
||
|
#region 获取角色信息
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取角色信息
|
||
|
/// </summary>
|
||
|
/// <param name="role">条件</param>
|
||
|
/// <returns>角色信息</returns>
|
||
|
public Role Get(Role role)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new RoleManageDAL().Get(role);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 获取角色列表
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取角色列表
|
||
|
/// </summary>
|
||
|
/// <param name="condition">条件</param>
|
||
|
/// <param name="page">数据页</param>
|
||
|
/// <returns>数据页</returns>
|
||
|
public DataPage GetList(Role condition, DataPage page)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new RoleManageDAL().GetList(condition, page);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 获取角色列表
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取全部角色信息
|
||
|
/// </summary>
|
||
|
/// <param name="role">条件</param>
|
||
|
/// <returns>角色信息</returns>
|
||
|
public Role GetAll()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new RoleManageDAL().GetAll();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 获取全部角色信息
|
||
|
/// </summary>
|
||
|
/// <param name="organID">机构主键</param>
|
||
|
/// <returns>数据列表</returns>
|
||
|
public List<Role> GetRolesByOrgan(string organID)
|
||
|
{
|
||
|
return new RoleManageDAL().GetRolesByOrgan(organID);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 判断角色名称是否存在
|
||
|
|
||
|
/// <summary>
|
||
|
/// 判断角色名称是否存在
|
||
|
/// </summary>
|
||
|
/// <param name="role">角色信息</param>
|
||
|
/// <returns>true:已存在;fasel:不存在。</returns>
|
||
|
public bool ExistsRole(Role role)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return new RoleManageDAL().ExistsRole(role);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 插入角色
|
||
|
|
||
|
/// <summary>
|
||
|
/// 插入角色
|
||
|
/// </summary>
|
||
|
/// <param name="role">角色信息</param>
|
||
|
/// <returns>插入数</returns>
|
||
|
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 删除角色
|
||
|
|
||
|
/// <summary>
|
||
|
/// 删除角色信息
|
||
|
/// </summary>
|
||
|
/// <param name="role">角色信息</param>
|
||
|
/// <returns>删除个数</returns>
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 删除角色信息
|
||
|
/// </summary>
|
||
|
/// <param name="role">角色信息</param>
|
||
|
/// <returns>删除行数</returns>
|
||
|
public int Delete(Role role)
|
||
|
{
|
||
|
int count = 0;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
count = new RoleManageDAL().Delete(role);
|
||
|
return count;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
throw ex;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 更新角色
|
||
|
|
||
|
/// <summary>
|
||
|
/// 更新角色
|
||
|
/// </summary>
|
||
|
/// <param name="role">角色信息</param>
|
||
|
/// <returns>更新个数</returns>
|
||
|
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 获取导出的数据
|
||
|
/// <summary>
|
||
|
/// 获取导出的数据
|
||
|
/// </summary>
|
||
|
/// <param name="condition">查询条件</param>
|
||
|
/// <returns>数据</returns>
|
||
|
public DataTable GetExportData(Role condition)
|
||
|
{
|
||
|
return new RoleManageDAL().GetExportData(condition);
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
}
|