コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public int SaveRoleMenu(string roleId, string menuId, string loginName)
        {
            RoleDA da     = new RoleDA();
            var    result = da.SaveRoleMenu(roleId, menuId, loginName);

            return(result);
        }
コード例 #5
0
        public int AddRole(RoleEntity role, string loginName)
        {
            RoleDA da     = new RoleDA();
            var    result = da.AddRole(role, loginName);

            return(result);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public RoleEntity GetRoleByKey(string roleId)
        {
            RoleDA da     = new RoleDA();
            var    result = da.GetRoleByKey(roleId);

            return(result);
        }
コード例 #8
0
        public int DeleteRoleMenuByRoleId(string roleId)
        {
            RoleDA da     = new RoleDA();
            var    result = da.DeleteRoleMenuByRoleId(roleId);

            return(result);
        }
コード例 #9
0
        public DataTable GetRolesApplications(string strValue)
        {
            var roleDa    = new RoleDA(_configuration);
            var datatable = roleDa.GetRolesApplications(strValue);

            roleDa.Dispose();
            return(datatable);
        }
コード例 #10
0
        public DataTable GetRoleApplication(UsersApplicationsRoles userApplicationRole, int tipo)
        {
            var roleDa    = new RoleDA(_configuration);
            var datatable = roleDa.GetRoleApplications(userApplicationRole, tipo);

            roleDa.Dispose();
            return(datatable);
        }
コード例 #11
0
        public List <Role> GetRoleforApplications(UsersApplicationsRoles userApplicationRole, int tipo)
        {
            var roleda   = new RoleDA(_configuration);
            var listRole = roleda.GetRoleforApplication(userApplicationRole, tipo);

            roleda.Dispose();
            return(listRole);
        }
コード例 #12
0
        public List <Role> GetAllRole()
        {
            var roleDa   = new RoleDA(_configuration);
            var listrole = roleDa.GetAllroles();

            roleDa.Dispose();
            return(listrole);
        }
コード例 #13
0
        public List <Role> GetRoles(string strValue)
        {
            var roleDa   = new RoleDA(_configuration);
            var listrole = roleDa.GetRoles(strValue);

            roleDa.Dispose();
            return(listrole);
        }
コード例 #14
0
        public Role GetRole(Role role)
        {
            var roleDa     = new RoleDA(_configuration);
            var roleresult = roleDa.GetRole(role.RoleId);

            roleDa.Dispose();
            return(roleresult);
        }
コード例 #15
0
 /// <summary>
 /// 删除Role信息
 /// </summary>
 public void DeleteRole(int sysNo)
 {
     if (sysNo == 1)
     {
         throw new BusinessException("超级管理员不能删除");
     }
     RoleDA.DeleteRole(sysNo);
 }
コード例 #16
0
 public void SaveUsersRoleForRPC(int userSysNo, IEnumerable <int> rolesysnos)
 {
     if (userSysNo <= 0 || rolesysnos == null || rolesysnos.Count() == 0)
     {
         return;
     }
     RoleDA.InsertUsersRole(userSysNo, rolesysnos);
 }
コード例 #17
0
 public List <Role> GetAllRolesByApplicationID(string applicationID)
 {
     if (string.IsNullOrWhiteSpace(applicationID))
     {
         return(new List <Role>());
     }
     return(RoleDA.GetAllRolesByApplicationID(applicationID));
 }
コード例 #18
0
        public List <Role> GetRoleList(ApplicationPMX application)
        {
            var roleDa   = new RoleDA(_configuration);
            var listrole = roleDa.GetRoleList(application);

            roleDa.Dispose();
            return(listrole);
        }
コード例 #19
0
 /// <summary>
 /// 更新Role信息
 /// </summary>
 public void UpdateRole(Role entity)
 {
     if (entity.SysNo == 1)
     {
         throw new BusinessException("超级管理员不能修改");
     }
     CheckRole(entity, false);
     RoleDA.UpdateRole(entity);
 }
コード例 #20
0
        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 }));
        }
コード例 #21
0
 /// <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);
 }
コード例 #22
0
 /// <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);
 }
コード例 #23
0
 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);
 }
コード例 #24
0
        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);
            }
        }
コード例 #25
0
        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);
        }
コード例 #26
0
ファイル: RoleBL.cs プロジェクト: Keatmar/Physiotherapy
        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);
        }
コード例 #27
0
ファイル: RoleBL.cs プロジェクト: Keatmar/Physiotherapy
        public RoleVO GetAdminRole()
        {
            RoleVO roles;

            try
            {
                using (var _ctx = new RoleContext())
                {
                    roles = new RoleDA().FindAdminRole(_ctx);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(roles);
        }
コード例 #28
0
        /// <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();
            }
        }
コード例 #29
0
        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);
        }
コード例 #30
0
        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);
        }