Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var roleName  = context.Request["roleName"];
            var groupName = context.Request["groupName"];

            var roleInfo  = JurisdictionBusiness.GetRoleByRoleName(roleName);
            var groupInfo = JurisdictionBusiness.GetGroupByGroupName(groupName);
            var result    = new ResultInfoModel {
                IsSuccess = false
            };

            if (roleInfo != null && groupInfo != null)
            {
                result = JurisdictionBusiness.DiRoleToGroup(roleInfo.Id, groupInfo.Id);
            }
            if (result.IsSuccess)
            {
                context.Response.Write("Success");
            }
            else
            {
                context.Response.Write(result.Message);
            }
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        public ActionResult GetGroupCode()
        {
            var list = JurisdictionBusiness.GetAllGroupCodeByUserid(LoginUser);

            if (list != null)
            {
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(string.Empty, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 5
0
        public ActionResult SaveByGroup(string paraStr)
        {
            var model  = JsonHelper.Deserialize <SaveByGroupIdModel>(paraStr);
            var result = new ResultInfoModel {
                IsSuccess = false
            };

            if (model != null)
            {
                result = JurisdictionBusiness.SaveRoleGroupRelationByGroup(model, this.LoginUser);
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
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));
        }
Exemplo n.º 7
0
        public ActionResult GetRoleCode()
        {
            //判断是否是管理员
            if (HomeBusiness.IsAdmin(LoginUser.UserId))
            {
                return(Json("isadmin", JsonRequestBehavior.AllowGet));
            }
            var list = JurisdictionBusiness.GetAllRoleCodeByUserid(LoginUser);

            if (list != null)
            {
                return(Json(list, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(string.Empty, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 8
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));
        }
Exemplo n.º 9
0
        public ActionResult Login(string account, string password, string dbtype)
        {
            var msg     = string.Empty;
            var success = false;

            try
            {
                if (!string.IsNullOrEmpty(dbtype))
                {
                    Session.Timeout = 1440;
                    Session[SessionKey.SESSION_KEY_DBINFO] = dbtype;
                }
                else
                {
                    return(RedirectToAction("LoginPage"));
                }
                var result = HomeBusiness.Login(account, password);

                //写入cookie
                string key  = CommonHelper.Md5(CookieKey.COOKIE_KEY_USERINFO);
                string data = JsonHelper.Serializer <UserLoginInfo>(result);
                CookieHelper.SetCookie(
                    key,
                    CommonHelper.DesEncrypt(data, HomeContent.CookieKeyEncrypt),
                    DateTime.Now.AddDays(1).Date,
                    ServerInfo.GetTopDomain);

                //写入权限信息
                var    list     = JurisdictionBusiness.GetAllRoleCodeByUserid(LoginUser);
                string roleKey  = CommonHelper.Md5(CookieKey.COOKIE_KEY_ROLEINFO);
                string roleData = JsonHelper.Serializer <List <string> >(list);
                CookieHelper.SetCookie(roleKey, CommonHelper.DesEncrypt(roleData, CookieKey.COOKIE_KEY_ENCRYPT),
                                       DateTime.Now.AddDays(1).Date, ServerInfo.GetTopDomain);

                success = true;
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            return(Json(new { Success = success, Message = msg }));
        }
Exemplo n.º 10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            try
            {
                if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["dbTyPe"]))
                {
                    HttpContext.Current.Session.Timeout = 1440;
                    HttpContext.Current.Session[SessionKey.SESSION_KEY_DBINFO] = HttpContext.Current.Request.QueryString["dbTyPe"];
                }
                else
                {
                    context.Response.Write("Plese Check dbType");
                    return;
                }
                //初始化页面权限
                JurisdictionBusiness.InititalPageRole();
                JurisdictionBusiness.InititalProblemRole();
                JurisdictionBusiness.InititalSolvingteamRole();
                JurisdictionBusiness.InititalQualityalertRole();
                JurisdictionBusiness.InititalSortingactivityRole();
                JurisdictionBusiness.InititalContainmentactionRole();
                JurisdictionBusiness.InititalFactanalyRole();
                JurisdictionBusiness.InititalWhyAnalyRole();
                JurisdictionBusiness.InititalCorrectiveActionRole();
                JurisdictionBusiness.InititalPreventiveMeasuresRole();
                JurisdictionBusiness.InititalLayeredAuditRole();
                JurisdictionBusiness.InititalVerificationRole();
                JurisdictionBusiness.InititalStandardizationRole();

                //初始化资源包
                JurisdictionBusiness.InitialPageGroup();
                context.Response.Write("Initial Success");
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.Message);
            }
        }
Exemplo n.º 11
0
        public ActionResult JurisdictionEdit()
        {
            var rgList      = new List <SelectListItem>();
            var defaultItem = new SelectListItem {
                Text = "请选择", Value = EncryptHelper.DesEncrypt("0")
            };

            rgList.Add(defaultItem);
            var list = JurisdictionBusiness.GetAllGroup();

            if (list != null && list.Count > 0)
            {
                foreach (var rg in list)
                {
                    var item = new SelectListItem();
                    item.Text  = rg.BGName;
                    item.Value = EncryptHelper.DesEncrypt(rg.Id.ToString());
                    rgList.Add(item);
                }
            }
            ViewBag.RoleGroup = rgList;
            return(View());
        }