예제 #1
0
        public ActionResult InitInitJurisdictionRoleGroup(string groupId)
        {
            var model = new JurisdictionByRoleGroupEditViewModel
            {
                UserList = new List <UserDic>(),
            };
            var groupInfo = JurisdictionBusiness.GetGroupById(long.Parse(EncryptHelper.DesDecrypt(groupId)));

            if (groupInfo != null)
            {
                model.GroupId   = groupId;
                model.GroupName = groupInfo.BGName;
                var relationinfo = JurisdictionBusiness.GetUserRoleRelationByGroupId(long.Parse(EncryptHelper.DesDecrypt(groupId)));
                if (relationinfo != null)
                {
                    foreach (var rolegroup in relationinfo)
                    {
                        var userInfo = HomeBusiness.GetUserById(rolegroup.BURUserId);
                        if (userInfo != null)
                        {
                            var dic = new UserDic();
                            dic.UserName  = userInfo.BUName;
                            dic.userId    = EncryptHelper.DesEncrypt(userInfo.Id.ToString());
                            dic.JobNumber = userInfo.BUJobNumber;
                            model.UserList.Add(dic);
                        }
                    }
                }
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult JurisdictionRolePackageSearch(RoleSearchViewModel rolesearch)
        {
            //分页获取所有的角色信息
            var total  = 0;
            var result = JurisdictionBusiness.SearchRole(rolesearch, out total);
            var page   = new Page(total, rolesearch.CurrentPage);
            var list   = new List <JurisdictionRoleGroupIndexViewModel>();

            foreach (var item in result)
            {
                var viewModel = new JurisdictionRoleGroupIndexViewModel
                {
                    GroupId   = item.RoleId,
                    GroupName = item.Rolename,
                    GroupCode = item.RoleCode,
                };
                //根据用户id去资源权限分类表查询资源信息
                var relationinfo = JurisdictionBusiness.GetUserRoleRelationByGroupId(long.Parse(EncryptHelper.DesDecrypt(item.RoleId.ToString())));
                if (relationinfo != null)
                {
                    foreach (var roloGroup in relationinfo)
                    {
                        var userInfo = HomeBusiness.GetUserById(roloGroup.BURUserId);
                        if (userInfo != null)
                        {
                            viewModel.UserInfo += userInfo.BUName + "(" + userInfo.BUJobNumber + ")" + ",";
                        }
                    }
                    if (viewModel.UserInfo != null && viewModel.UserInfo.Length > 0)
                    {
                        viewModel.UserInfo = viewModel.UserInfo.Substring(0, viewModel.UserInfo.Length - 1);
                    }
                }
                list.Add(viewModel);
            }

            var resultModel = new JurisdictionRoleGroupSearchModel()
            {
                Models = list,
                Page   = page
            };

            return(View(resultModel));
        }