Пример #1
0
        public ActionResult SetDepartment(string departmentId, string companyName)
        {
            UserCenter_LoginUserInfo loginUserInfo = WebUserHelp.GetNowLoginUser();
            int result = 1;

            companyName = companyName.DecodeField();
            if (departmentId.CheckInteger())//修改
            {
                List <int>      functionCodes = WebUserHelp.GetNowPageFunctionCodes(loginUserInfo.UserName, loginUserInfo.FxtCompanyId, WebCommon.Url_DepartmentInfo_DepartmentManager);
                PriviDepartment department    = PriviDepartmentManager.GetDepartmentById(Convert.ToInt32(departmentId));
                if (functionCodes.Contains(SYSCodeManager.FunOperCode_7))
                {
                }
                else if (functionCodes.Contains(SYSCodeManager.FunOperCode_5))//修改自己
                {
                    PriviDepartment nowDep = PriviDepartmentManager.GetDepartmentByUserName(WebUserHelp.GetNowCityId(), loginUserInfo.FxtCompanyId, loginUserInfo.UserName);
                    if (nowDep == null || !nowDep.DepartmentId.ToString().Equals(departmentId))
                    {
                        return(WebUserHelp.GetActionNotRightPage());//无权限
                    }
                }
                else
                {
                    return(WebUserHelp.GetActionNotRightPage());//无权限
                }
                if (department != null)
                {
                    ViewBag.DepartmentName = department.DepartmentName;
                    ViewBag.DepartmentId   = departmentId;
                }
                else
                {
                    result = 0;
                }
            }
            else//新增
            {
                if (!WebUserHelp.CheckNowPageFunctionCode(loginUserInfo.UserName, loginUserInfo.FxtCompanyId, WebCommon.Url_DepartmentInfo_DepartmentManager, SYSCodeManager.FunOperCode_4))
                {
                    return(WebUserHelp.GetActionNotRightPage());//无权限
                }
            }
            ViewBag.Result      = result;
            ViewBag.CompanyName = companyName;
            return(View());
        }
Пример #2
0
        public ActionResult UserManager()
        {
            UserCenter_LoginUserInfo loginUserInfo = WebUserHelp.GetNowLoginUser();
            int cityId    = WebUserHelp.GetNowCityId();
            int companyId = loginUserInfo.FxtCompanyId;
            IList <PriviDepartment> departmentList = PriviDepartmentManager.GetDepartmentByCompanyId(cityId, companyId);
            IList <SYSRole>         roleList       = SYSRoleManager.GetSYSRoleByCompanyId(0, 0);

            ViewBag.DepartmentList = departmentList;
            ViewBag.RoleList       = roleList;
            //获取是否有修改用户权限
            ViewBag.UpdateRight = 0;
            bool updateRight = WebUserHelp.CheckNowPageFunctionCode(loginUserInfo.UserName, loginUserInfo.FxtCompanyId, WebCommon.Url_UserInfo_UserManager, SYSCodeManager.FunOperCode_7);

            if (updateRight)
            {
                ViewBag.UpdateRight = 1;
            }
            return(View());
        }
Пример #3
0
        public ActionResult SetDepartment_SubmitData_Api(string departmentId, string departmentName)
        {
            string json = "";

            departmentName = departmentName.DecodeField().TrimBlank();
            if (string.IsNullOrEmpty(departmentName))
            {
                Response.Write(json.MvcResponseJson(result: 0, message: "请填写组名"));
                Response.End();
                return(null);
            }
            string message = "";
            bool   result  = true;
            UserCenter_LoginUserInfo loginUserInfo = WebUserHelp.GetNowLoginUser();

            //如果是修改
            if (departmentId.CheckInteger())
            {
                List <int>      functionCodes = WebUserHelp.GetNowPageFunctionCodes(loginUserInfo.UserName, loginUserInfo.FxtCompanyId, WebCommon.Url_DepartmentInfo_DepartmentManager);
                PriviDepartment department    = PriviDepartmentManager.GetDepartmentById(Convert.ToInt32(departmentId));
                if (functionCodes.Contains(SYSCodeManager.FunOperCode_7))//修改全部
                {
                }
                else if (functionCodes.Contains(SYSCodeManager.FunOperCode_5))//修改自己
                {
                    PriviDepartment nowDep = PriviDepartmentManager.GetDepartmentByUserName(WebUserHelp.GetNowCityId(), loginUserInfo.FxtCompanyId, loginUserInfo.UserName);
                    if (nowDep == null || !nowDep.DepartmentId.ToString().Equals(departmentId))
                    {
                        Response.Write(json.MvcResponseJson(result: 0, message: "无权限修改此信息"));
                        Response.End();
                        return(null);
                    }
                }
                else//无修改权限
                {
                    Response.Write(json.MvcResponseJson(result: 0, message: "无权限修改此信息"));
                    Response.End();
                    return(null);
                }
                result = PriviDepartmentManager.UpdateDepartment(Convert.ToInt32(departmentId), departmentName, out message);
            }
            else//新增
            {
                if (!WebUserHelp.CheckNowPageFunctionCode(loginUserInfo.UserName, loginUserInfo.FxtCompanyId, WebCommon.Url_DepartmentInfo_DepartmentManager, SYSCodeManager.FunOperCode_4))
                {
                    Response.Write(json.MvcResponseJson(result: 0, message: "无权限新增信息"));
                    Response.End();
                    return(null);
                }
                int             cityId        = WebUserHelp.GetNowCityId();
                int             companyId     = loginUserInfo.FxtCompanyId;
                string          loginusername = loginUserInfo.UserName;
                string          loginsignname = loginUserInfo.SignName;
                PriviDepartment department    = PriviDepartmentManager.InsertDepartment(cityId, companyId, departmentName, out message);
                if (department == null)
                {
                    result = false;
                }
                else
                {
                    json = department.EncodeField <PriviDepartment>().ToJSONjss();
                }
            }
            //失败
            if (!result)
            {
                Response.Write(json.MvcResponseJson(result: 0, message: "提交失败:" + message));
                Response.End();
                return(null);
            }
            //成功
            Response.Write(json.MvcResponseJson(result: 1, message: ""));
            Response.End();
            return(null);
        }