Exemple #1
0
        public ActionResult InitJurisdiction(string userId)
        {
            var model = new JurisdictionEditViewModel
            {
                RoleGroupList = new List <RoleGroupDic>(),
            };

            var userinfo = HomeBusiness.GetUserById(long.Parse(EncryptHelper.DesDecrypt(userId)));

            if (userinfo != null)
            {
                model.UserId    = userId;
                model.Username  = userinfo.BUName;
                model.Jobnumber = userinfo.BUJobNumber;
                var relationinfo = JurisdictionBusiness.GetUserRoleRelationByUserId(long.Parse(EncryptHelper.DesDecrypt(userId)));
                if (relationinfo != null)
                {
                    foreach (var roloGroup in relationinfo)
                    {
                        var roloGroupInfo = JurisdictionBusiness.GetGroupById(roloGroup.BURGroupId);
                        if (roloGroupInfo != null)
                        {
                            var dic = new RoleGroupDic();
                            dic.RoleGroupId   = EncryptHelper.DesEncrypt(roloGroup.BURGroupId.ToString());
                            dic.RoleGroupName = roloGroupInfo.BGName;
                            model.RoleGroupList.Add(dic);
                        }
                    }
                }
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public ActionResult JurisdictionSearch(UserSearchViewModel usersearch)
        {
            //分页获取所有的用户信息
            var total  = 0;
            var result = HomeBusiness.SearchUser(usersearch, out total);
            var page   = new Page(total, usersearch.CurrentPage);
            var list   = new List <JurisdictionIndexViewModel>();

            foreach (var item in result)
            {
                var viewModel = new JurisdictionIndexViewModel
                {
                    UserId    = item.UserId,
                    Username  = item.BUName,
                    Jobnumber = item.BUJobNumber,
                    Position  = item.BUTitle,
                };
                //根据用户id去资源权限分类表查询资源信息
                var relationinfo = JurisdictionBusiness.GetUserRoleRelationByUserId(long.Parse(EncryptHelper.DesDecrypt(item.UserId.ToString())));
                if (relationinfo != null)
                {
                    foreach (var roloGroup in relationinfo)
                    {
                        var roloGroupInfo = JurisdictionBusiness.GetGroupById(roloGroup.BURGroupId);
                        if (roloGroupInfo != null)
                        {
                            viewModel.RoleGroup += roloGroupInfo.BGName + ",";
                        }
                    }
                    if (viewModel.RoleGroup != null && viewModel.RoleGroup.Length > 0)
                    {
                        viewModel.RoleGroup = viewModel.RoleGroup.Substring(0, viewModel.RoleGroup.Length - 1);
                    }
                }
                list.Add(viewModel);
            }

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

            return(View(resultModel));
        }