public int Update(List <RoleDC> objRoles) { int updatedCount = 0; DBConnection objConnection = new DBConnection(); RoleDA objRoleDA = new RoleDA(); try { objConnection.Open(true); updatedCount = objRoleDA.Update(objConnection, objRoles); IsDirty = objRoleDA.IsDirty; if (IsDirty) { objConnection.Rollback(); } else { objConnection.Commit(); } } catch (Exception ex) { objConnection.Rollback(); throw ex; } finally { objConnection.Close(); } return(updatedCount); }
public Response GetRoleCombinationNotAllowedByApplication(ApplicationPMX application, out DataTable roleCombinationsNotAllowed) { var response = new Response { Result = false, Message = "Not initialized" }; roleCombinationsNotAllowed = new DataTable(); var roleDa = new RoleDA(_configuration); try { roleCombinationsNotAllowed = roleDa.GetRoleCombinationsNotAllowed(application); response.Message = string.Format("Se encontraron {0} combinaciones no permitidas para la aplicación {1}.", roleCombinationsNotAllowed.Rows.Count.ToString(), application.ApplicationName); response.Result = true; } catch (Exception e) { response.Message = string.Format("Ocurrió un error al obtener las combinaciones de rol no autorizadas. {0}", e.Message); response.Result = false; } roleDa.Dispose(); return(response); }
public Response RoleNotAllowedCombinationExistAndDate(ApplicationPMX application, Role roleA, Role roleB) { //Se debe de regresar falso si no existe y se debe de interpretar en la llamada de la funcion var response = new Response { Message = "No existe la combinacion", Result = true }; var roleDa = new RoleDA(_configuration); try { response.Result = roleDa.RoleNotAllowedCombinationExistAndDate(application, roleA, roleB); if (response.Result) { response.Message = string.Format( "La combinación no permitida de rol se encuentra registrada."); } } catch (Exception e) { response.Message = string.Format( "Ocurrio un error al verificar si la combinacion de operaciones no permititda existe. {0}", e.Message); response.Result = true; } roleDa.Dispose(); return(response); }
public int SaveRoleMenu(string roleId, string menuId, string loginName) { RoleDA da = new RoleDA(); var result = da.SaveRoleMenu(roleId, menuId, loginName); return(result); }
public int AddRole(RoleEntity role, string loginName) { RoleDA da = new RoleDA(); var result = da.AddRole(role, loginName); return(result); }
public Response DeleteRoleCombinationNotAllowed(ApplicationPMX application, Role roleA, Role roleB) { //Se debe de regresar falso si no existe y se debe de interpretar en la llamada de la funcion var response = new Response { Message = "No existe la combinacion", Result = false }; var roleDa = new RoleDA(_configuration); try { roleDa.DeleteRoleNotAllowedCombination(application, roleA, roleB); } catch (Exception e) { response.Message = string.Format( "Ocurrio un error al eliminar la combinacion de operaciones. {0}", e.Message); response.Result = false; } response.Result = true; response.Message = string.Format( "Se eliminó la combinación no permitida de la operacion {0} y {1} de la aplicacion {2}.", roleA.RoleName, roleB.RoleName, application.ApplicationName); roleDa.Dispose(); return(response); }
public RoleEntity GetRoleByKey(string roleId) { RoleDA da = new RoleDA(); var result = da.GetRoleByKey(roleId); return(result); }
public int DeleteRoleMenuByRoleId(string roleId) { RoleDA da = new RoleDA(); var result = da.DeleteRoleMenuByRoleId(roleId); return(result); }
public DataTable GetRolesApplications(string strValue) { var roleDa = new RoleDA(_configuration); var datatable = roleDa.GetRolesApplications(strValue); roleDa.Dispose(); return(datatable); }
public DataTable GetRoleApplication(UsersApplicationsRoles userApplicationRole, int tipo) { var roleDa = new RoleDA(_configuration); var datatable = roleDa.GetRoleApplications(userApplicationRole, tipo); roleDa.Dispose(); return(datatable); }
public List <Role> GetRoleforApplications(UsersApplicationsRoles userApplicationRole, int tipo) { var roleda = new RoleDA(_configuration); var listRole = roleda.GetRoleforApplication(userApplicationRole, tipo); roleda.Dispose(); return(listRole); }
public List <Role> GetAllRole() { var roleDa = new RoleDA(_configuration); var listrole = roleDa.GetAllroles(); roleDa.Dispose(); return(listrole); }
public List <Role> GetRoles(string strValue) { var roleDa = new RoleDA(_configuration); var listrole = roleDa.GetRoles(strValue); roleDa.Dispose(); return(listrole); }
public Role GetRole(Role role) { var roleDa = new RoleDA(_configuration); var roleresult = roleDa.GetRole(role.RoleId); roleDa.Dispose(); return(roleresult); }
/// <summary> /// 删除Role信息 /// </summary> public void DeleteRole(int sysNo) { if (sysNo == 1) { throw new BusinessException("超级管理员不能删除"); } RoleDA.DeleteRole(sysNo); }
public void SaveUsersRoleForRPC(int userSysNo, IEnumerable <int> rolesysnos) { if (userSysNo <= 0 || rolesysnos == null || rolesysnos.Count() == 0) { return; } RoleDA.InsertUsersRole(userSysNo, rolesysnos); }
public List <Role> GetAllRolesByApplicationID(string applicationID) { if (string.IsNullOrWhiteSpace(applicationID)) { return(new List <Role>()); } return(RoleDA.GetAllRolesByApplicationID(applicationID)); }
public List <Role> GetRoleList(ApplicationPMX application) { var roleDa = new RoleDA(_configuration); var listrole = roleDa.GetRoleList(application); roleDa.Dispose(); return(listrole); }
/// <summary> /// 更新Role信息 /// </summary> public void UpdateRole(Role entity) { if (entity.SysNo == 1) { throw new BusinessException("超级管理员不能修改"); } CheckRole(entity, false); RoleDA.UpdateRole(entity); }
public RedirectToRouteResult Unlock(Guid id) { var rolerDa = new RoleDA("#"); var membership = rolerDa.GetListByMembership(id); membership.IsLockedOut = membership.IsLockedOut != true; rolerDa.Save(); return(RedirectToAction("Details", new { id })); }
/// <summary> /// 更新数据 /// </summary> /// <param name="role">数据实体</param> public void Update(RoleEntity role, AuthUserModel authUserModel) { if (!role.BusinessId.HasValue) { throw new BusinessException("角色Id不允许为空"); } role.Id = role.BusinessId.Value; this.CheckEntity(role); this.BindBasisInfo(role, authUserModel); RoleDA.Update(role); }
/// <summary> /// 批量删除 /// </summary> /// <param name="sysNos"></param> public void DeleteRoleBatch(IEnumerable <int> sysNos) { if (sysNos == null || sysNos.Count() == 0) { throw new BusinessException("请传入要批量操作的编号"); } if (sysNos.Any(x => x == 1)) { throw new BusinessException("传入的要批量删除的角色中含有超级管理员,不能执行删除"); } RoleDA.DeleteRoleBatch(sysNos); }
public void UpdateRoleStatusBatch(IEnumerable <int> sysNos, CommonStatus status) { if (sysNos == null || sysNos.Count() == 0) { throw new BusinessException("请传入要批量操作的编号"); } if (sysNos.Any(x => x == 1)) { throw new BusinessException("传入的要批量操作的角色中含有超级管理员,不能执行"); } RoleDA.UpdateRoleStatusBatch(sysNos, status); }
public void SaveUsersRole(int userSysNo, List <Role> roles, string ApplicationID) { var rolesysnos = from r in roles select r.SysNo; if (!string.IsNullOrWhiteSpace(ApplicationID)) { RoleDA.SaveUsersRoleByApplicationID(userSysNo, rolesysnos, ApplicationID); } else { RoleDA.SaveUsersRole(userSysNo, rolesysnos); } }
public static List <Role> GetList(string where) { List <Role> roleInfoList = new List <Role>(); foreach (RoleDA roleDA in RoleDA.FindAll(where)) { Role Role = new Role(roleDA); roleInfoList.Add(Role); } roleInfoList.Sort(); return(roleInfoList); }
public RoleVO GetRoleById(int id) { RoleVO model = new RoleVO(); try { using (var ctx = new RoleContext()) { IRoleDA da = new RoleDA(); model = da.FindRoleById(ctx, id); } }catch { throw; } return(model); }
public RoleVO GetAdminRole() { RoleVO roles; try { using (var _ctx = new RoleContext()) { roles = new RoleDA().FindAdminRole(_ctx); } } catch (Exception ex) { throw ex; } return(roles); }
/// <summary> /// 更新数据 /// </summary> /// <param name="role">数据实体</param> public void Delete(int roleId) { var hasAassociationRoleUser = RoleUserService.HasExistUserRoleAssociation(roleId); if (hasAassociationRoleUser) { throw new BusinessException("该角色下已存在关联用户,不允许删除该角色"); } using (ITransaction transaction = TransactionManager.Create()) { // 删除角色 以及删除角色对应的功能权限数据 RoleDA.Delete(new RoleEntity() { Id = roleId, CommonStatus = CommonStatus.Deleted }); RoleFunctionService.BatchDeleteFunction(roleId); transaction.Complete(); } }
public RoleDC LoadByPrimaryKey(string RoleID) { DBConnection objConnection = new DBConnection(); RoleDA objRoleDA = new RoleDA(); RoleDC objRoleDC = null; try { objConnection.Open(false); objRoleDC = objRoleDA.LoadByPrimaryKey(objConnection, RoleID); } catch (Exception ex) { throw ex; } finally { objConnection.Close(); } return(objRoleDC); }
public List <RoleDC> LoadAll() { DBConnection objConnection = new DBConnection(); RoleDA objRoleDA = new RoleDA(); List <RoleDC> objRoleDC = null; try { objConnection.Open(false); objRoleDC = objRoleDA.LoadAll(objConnection); } catch (Exception ex) { throw ex; } finally { objConnection.Close(); } return(objRoleDC); }