예제 #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));
        }
예제 #2
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));
        }
예제 #3
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));
        }
예제 #4
0
        /// <summary>
        /// 描述:初始化用户信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ActionResult InitAdUser(string userId)
        {
            long userIdlong = long.Parse(EncryptHelper.DesDecrypt(userId));
            var  userInfo   = HomeBusiness.GetUserById(userIdlong);
            var  userView   = new UserView();

            if (userInfo != null)
            {
                userView.UserId      = EncryptHelper.DesEncrypt(userInfo.Id.ToString());
                userView.BUSurname   = userInfo.BUSurname;
                userView.BUGivenname = userInfo.BUGivenname;
                userView.BUJobNumber = userInfo.BUJobNumber;
                userView.BUSex       = userInfo.BUSex;
                userView.BUAvatars   = userInfo.BUAvatars;
                userView.BUPhoneNum  = userInfo.BUPhoneNum;
                userView.BUEmail     = userInfo.BUEmail;
                userView.DepartId    = EncryptHelper.DesEncrypt(userInfo.BUDepartId.ToString());
                userView.BUTitle     = userInfo.BUTitle;
                userView.BUIsValid   = userInfo.BUIsValid;
            }
            return(Json(userView, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult UsrSave(UserView model)
        {
            var result = new ResultInfoModel
            {
                IsSuccess = true
            };

            try
            {
                if (string.IsNullOrEmpty(model.UserId) || model.UserId.Equals("0"))
                {
                    //新增
                    var user = new UserModel();
                    user.BUName = model.BUName;
                    user.BUSex  = model.BUSex;
                    if (!string.IsNullOrWhiteSpace(model.BUAvatars))
                    {
                        var path = model.BUAvatars.Substring(ServerInfo.RootURI.Length);
                        user.BUAvatars = path;
                    }
                    else
                    {
                        user.BUAvatars = string.Empty;
                    }
                    user.BUPhoneNum = model.BUPhoneNum;
                    user.BUEmail    = model.BUEmail;
                    //user.BUDepartId = int.Parse(EncryptHelper.DesDecrypt(model.DepartId));
                    user.BUTitle           = model.BUTitle;
                    user.BUIsValid         = model.BUIsValid;
                    user.BUCreateUserNo    = LoginUser.JobNum;
                    user.BUCreateUserName  = LoginUser.UserName;
                    user.BUCreateTime      = DateTime.Now;
                    user.BUOperateUserNo   = LoginUser.JobNum;;
                    user.BUOperateUserName = LoginUser.UserName;
                    user.BUOperateTime     = DateTime.Now;

                    user.BUDepartName     = model.BUDepartName;
                    user.BUExtensionPhone = model.BUExtensionPhone;
                    user.BUEnglishName    = model.BUEnglishName;
                    user.BUPosition       = model.BUPosition;
                    user.BUMobilePhone    = model.BUMobilePhone;
                    user.BUJobNumber      = HomeBusiness.GenerateNewJobNumber(string.Empty);
                    user.Account          = model.Account;
                    result = HomeBusiness.SaveNewUser(user);
                }
                else
                {
                    //解密id
                    model.UserId = EncryptHelper.DesDecrypt(model.UserId);
                    var user = HomeBusiness.GetUserById(long.Parse(model.UserId));
                    user.BUName     = model.BUName;
                    user.BUSex      = model.BUSex;
                    user.BUAvatars  = model.BUAvatars;
                    user.BUPhoneNum = model.BUPhoneNum;
                    user.BUEmail    = model.BUEmail;
                    //user.BUDepartId = int.Parse(EncryptHelper.DesDecrypt(model.DepartId));
                    user.BUTitle           = model.BUTitle;
                    user.BUIsValid         = model.BUIsValid;
                    user.BUOperateUserNo   = LoginUser.JobNum;
                    user.BUOperateUserName = LoginUser.UserName;
                    //user.BUOperateUserNo = "33029";
                    //user.BUOperateUserName = "******";
                    user.BUOperateTime    = DateTime.Now;
                    user.BUDepartName     = model.BUDepartName;
                    user.BUExtensionPhone = model.BUExtensionPhone;
                    user.BUEnglishName    = model.BUEnglishName;
                    user.BUPosition       = model.BUPosition;
                    user.BUMobilePhone    = model.BUMobilePhone;
                    user.Account          = model.Account;
                    var isExistAccount = model.IsExistAccount;
                    result = HomeBusiness.SaveUser(user, isExistAccount);
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;
            }
            return(Json(result));
        }