public static int QuickAddUser(string loginID, string roleCode, string defaultPassword, string defaultEmail)
        {
            try
            {
                Membership.CreateUser(loginID, defaultPassword, loginID + defaultEmail);

                SystemUserWrapper user = SystemUserWrapper.FindByLoginID(loginID);

                user.UserName = loginID;

                SystemUserWrapper.Update(user);

                SystemRoleWrapper clientRole = SystemRoleWrapper.GetRoleByCode(roleCode);

                SystemUserWrapper.PatchAssignUserRoles(user, new List <string> {
                    clientRole.RoleID.ToString()
                });

                return(user.UserID);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(-1);
            }
        }
Exemplo n.º 2
0
        public static List <SystemUserWrapper> GetUserByUserLoginId(string userLoginId)
        {
            SystemUserWrapper systemUser = SystemUserWrapper.FindByLoginID(userLoginId);

            SystemRoleWrapper systemRoleWrapper = SystemUserWrapper.GetUserMaxRoleTypeRole(systemUser);



            List <SystemUserWrapper> userWrappers = new List <SystemUserWrapper>();



            if (userLoginId == SystemUserWrapper.DEV_USER_ID || userLoginId == SystemUserWrapper.SYS_USER_ID)
            {
                userWrappers = SystemUserWrapper.FindAll();
            }


            else
            if (systemRoleWrapper.RoleType != "5")
            {
                userWrappers = SystemUserWrapper.ConvertToWrapperList(businessProxy.GetUserByRole(systemRoleWrapper.Entity));
            }
            else
            {
                userWrappers.Add(systemUser);
            }


            return(userWrappers);
        }
Exemplo n.º 3
0
        public static void CreateRole(string roleName)
        {
            var role = new SystemRoleWrapper {
                RoleName = roleName, RoleDescription = "", RoleIsSystemRole = false
            };

            SaveOrUpdate(role);
        }
Exemplo n.º 4
0
        public static List <SystemApplicationWrapper> GetRoleAssignedApplications(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            return(SystemApplicationWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedApplications(role.entity)));
        }
Exemplo n.º 5
0
        public static void PatchAssignRoleMenusInApplication(SystemRoleWrapper role, int applicationID, string[] assignedMenuIDS)
        {
            SystemApplicationWrapper applicationWrapper = SystemApplicationWrapper.FindById(applicationID);

            if (role != null && applicationWrapper != null)
            {
                businessProxy.PatchAssignRoleMenusInApplication(role.entity, applicationWrapper.entity, assignedMenuIDS);
            }
        }
 /// <summary>
 /// 获取角色分配的所有菜单
 /// </summary>
 /// <param name="role">角色对象</param>
 /// <returns></returns>
 public static List <string> GetRoleAssignedMenuIDs(SystemRoleWrapper role)
 {
     if (role != null)
     {
         return(businessProxy.GetRoleAssignedMenuIDs(role.Entity));
     }
     else
     {
         throw new ArgumentNullException("role");
     }
 }
        public static List <SystemRoleWrapper> GetUserWrappersAssignedRoleIDs(SystemUserWrapper userWrapper)
        {
            if (userWrapper == null)
            {
                throw new ArgumentNullException("userWrapper");
            }

            List <SystemRoleEntity> assignedRoles = businessProxy.GetUserAssignedRoleByUser(userWrapper.entity);

            return(SystemRoleWrapper.ConvertToWrapperList(assignedRoles));
        }
Exemplo n.º 8
0
        public static void PatchAssignRolePermissions(SystemRoleWrapper role, List <string> assignedPermissionIDs)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }
            if (assignedPermissionIDs == null)
            {
                throw new ArgumentNullException("assignedPermissionIDs");
            }

            businessProxy.PatchAssignRolePermissions(role.entity, assignedPermissionIDs);
        }
        public static List <SystemApplicationWrapper> GetUserAvaiableApplicationsNotAssigned(SystemUserWrapper currentLoginUser, int roleID)
        {
            List <SystemApplicationWrapper> allAplications = GetUserAvaiableApplications(currentLoginUser);

            SystemRoleWrapper systemRoleWrapper = SystemRoleWrapper.FindById(roleID);

            List <SystemApplicationWrapper> assignedApplications = SystemRoleWrapper.GetRoleAssignedApplications(systemRoleWrapper);

            foreach (SystemApplicationWrapper assignedApplication in assignedApplications)
            {
                int appID = assignedApplication.SystemApplicationID;

                allAplications.RemoveAll(p => (p.SystemApplicationID == appID));
            }

            return(allAplications);
        }
Exemplo n.º 10
0
        public static List <string> GetRoleAssignedApplicationIDs(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            List <string> assignedApplicationIDs = new List <string>();

            List <SystemApplicationEntity> list = businessProxy.GetRoleAssignedApplications(role.entity);

            foreach (SystemApplicationEntity applicationEntity in list)
            {
                assignedApplicationIDs.Add(applicationEntity.SystemApplicationID.ToString());
            }

            return(assignedApplicationIDs);
        }
Exemplo n.º 11
0
        public static List <string> GetRoleAssignedPermissions(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            List <string> assignedPermissions = new List <string>();

            List <SystemPrivilegeEntity> list = businessProxy.GetRoleAssignedPermissions(role.entity);

            foreach (SystemPrivilegeEntity systemPrivilegeEntity in list)
            {
                assignedPermissions.Add(systemPrivilegeEntity.PrivilegeID.ToString());
            }

            return(assignedPermissions);
        }
Exemplo n.º 12
0
        protected void btnSaveSystemRole_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemRoleWrapper obj = new SystemRoleWrapper();
                obj.RoleName = this.txtRoleName.Text.Trim();
                obj.RoleCode = this.txtRoleCode.Text.Trim();
                obj.RoleDescription = this.txtRoleDescription.Text.Trim();
                obj.RoleIsSystemRole = this.chkRoleIsSystemRole.Checked;

                SystemRoleWrapper.Save(obj);

                winSystemRoleAdd.Hide();

            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess = false;
                ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
            }
        }
Exemplo n.º 13
0
        public static List <SystemPrivilegeInRolesWrapper> GetRoleAssignedPrivilegesInRole(SystemRoleWrapper role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            return(SystemPrivilegeInRolesWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedPrivilegesInRole(role.entity)));
        }
 public static SystemRoleWrapper GetUserDefaultRoleByUserID(int userID)
 {
     return(SystemRoleWrapper.ConvertEntityToWrapper(businessProxy.GetUserDefaultRoleByUserID(userID)));
 }
 public static SystemRoleWrapper GetUserMinRoleTypeRole(SystemUserWrapper userWrapper)
 {
     return(SystemRoleWrapper.ConvertEntityToWrapper(businessProxy.GetUserMinRoleTypeRole(userWrapper.entity)));
 }
Exemplo n.º 16
0
 public static List<SystemUserRoleRelationWrapper> FindAllByRoleID(SystemRoleWrapper roleID)
 {
     return ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.entity));
 }
Exemplo n.º 17
0
        public static List<SystemApplicationWrapper> GetRoleAssignedApplications(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            return SystemApplicationWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedApplications(role.entity));
        }
Exemplo n.º 18
0
 public static void SaveOrUpdate(SystemRoleWrapper obj)
 {
     businessProxy.SaveOrUpdate(obj.entity);
 }
Exemplo n.º 19
0
 public static void Refresh(SystemRoleWrapper instance)
 {
     businessProxy.Refresh(instance.entity);
 }
Exemplo n.º 20
0
 public static void Save(SystemRoleWrapper obj)
 {
     businessProxy.Save(obj.entity);
 }
Exemplo n.º 21
0
 public static void CreateRole(string roleName)
 {
     var role = new SystemRoleWrapper { RoleName = roleName, RoleDescription = "", RoleIsSystemRole = false };
     SaveOrUpdate(role);
 }
Exemplo n.º 22
0
        public static void PatchAssignRolePermissions(SystemRoleWrapper role, List<string> assignedPermissionIDs)
        {
            if (role == null)
                throw new ArgumentNullException("role");
            if (assignedPermissionIDs == null)
                throw new ArgumentNullException("assignedPermissionIDs");

            businessProxy.PatchAssignRolePermissions(role.entity, assignedPermissionIDs);
        }
Exemplo n.º 23
0
 public static List<SystemUserRoleRelationWrapper> FindAllByOrderByAndFilterAndRoleID(string orderByColumnName, bool isDesc,   SystemRoleWrapper roleID,  PageQueryParams pageQueryParams)
 {
     return ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndRoleID(orderByColumnName, isDesc,   roleID.entity, pageQueryParams));
 }
Exemplo n.º 24
0
        public static void PatchAssignRoleMenusInApplication(SystemRoleWrapper role, int applicationID, string[] assignedMenuIDS)
        {
            SystemApplicationWrapper applicationWrapper = SystemApplicationWrapper.FindById(applicationID);

            if (role != null && applicationWrapper != null)
            {
                businessProxy.PatchAssignRoleMenusInApplication(role.entity, applicationWrapper.entity, assignedMenuIDS);
            }
        }
Exemplo n.º 25
0
        public static List<SystemPrivilegeInRolesWrapper> GetRoleAssignedPrivilegesInRole(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            return SystemPrivilegeInRolesWrapper.ConvertToWrapperList(businessProxy.GetRoleAssignedPrivilegesInRole(role.entity));
        }
Exemplo n.º 26
0
        public static List<string> GetRoleAssignedPermissions(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            List<string> assignedPermissions = new List<string>();

            List<SystemPrivilegeEntity> list = businessProxy.GetRoleAssignedPermissions(role.entity);

            foreach (SystemPrivilegeEntity systemPrivilegeEntity in list)
            {
                assignedPermissions.Add(systemPrivilegeEntity.PrivilegeID.ToString());
            }

            return assignedPermissions;
        }
Exemplo n.º 27
0
 public static SystemPrivilegeInRolesWrapper GetRelationByRoleAndPrivilege(SystemRoleWrapper systemRoleWrapper, SystemPrivilegeWrapper systemPrivilegeWrapper)
 {
     return(ConvertEntityToWrapper(businessProxy.GetRelationByRoleAndPrivilege(systemRoleWrapper.entity, systemPrivilegeWrapper.entity)));
 }
Exemplo n.º 28
0
 public static void Update(SystemRoleWrapper obj)
 {
     businessProxy.Update(obj.entity);
 }
 public static List <SystemPrivilegeInRolesWrapper> FindAllByRoleID(SystemRoleWrapper roleID)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.Entity)));
 }
Exemplo n.º 30
0
 public static void Delete(SystemRoleWrapper instance)
 {
     businessProxy.Delete(instance.entity);
 }
Exemplo n.º 31
0
 public static void Delete(SystemRoleWrapper instance)
 {
     businessProxy.Delete(instance.entity);
 }
Exemplo n.º 32
0
        public static List<string> GetRoleAssignedApplicationIDs(SystemRoleWrapper role)
        {
            if (role == null)
                throw new ArgumentNullException("role");

            List<string> assignedApplicationIDs = new List<string>();

            List<SystemApplicationEntity> list = businessProxy.GetRoleAssignedApplications(role.entity);

            foreach (SystemApplicationEntity applicationEntity in list)
            {
                assignedApplicationIDs.Add(applicationEntity.SystemApplicationID.ToString());
            }

            return assignedApplicationIDs;
        }
Exemplo n.º 33
0
        public static List <SystemUserWrapper> GetAllUserByRoleName(string roleName)
        {
            SystemRoleWrapper roleWrapper = SystemRoleWrapper.GetRoleByName(roleName);

            return(ConvertToWrapperList(businessProxy.FindAllUserByRole(roleWrapper.entity)));
        }
Exemplo n.º 34
0
 public static List <SystemUserRoleRelationWrapper> FindAllByOrderByAndFilterAndRoleID(string orderByColumnName, bool isDesc, SystemRoleWrapper roleID, PageQueryParams pageQueryParams)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndRoleID(orderByColumnName, isDesc, roleID.entity, pageQueryParams)));
 }
Exemplo n.º 35
0
 public static void Refresh(SystemRoleWrapper instance)
 {
     businessProxy.Refresh(instance.entity);
 }
Exemplo n.º 36
0
 public static List <SystemUserRoleRelationWrapper> FindAllByRoleID(SystemRoleWrapper roleID)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByRoleID(roleID.entity)));
 }