Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 83, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

                string redirectUrl = string.Format("{0}User/EmpRoleList.aspx", NFMT.Common.DefaultValue.NftmSiteName);
                this.navigation1.Routes.Add("员工角色分配-角色列表", redirectUrl);
                this.navigation1.Routes.Add("角色员工分配", string.Empty);

                int id = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect(redirectUrl);

                if (!int.TryParse(Request.QueryString["id"], out id) || id == 0)
                    Response.Redirect(redirectUrl);

                NFMT.User.BLL.RoleBLL roleBLL = new NFMT.User.BLL.RoleBLL();
                var result = roleBLL.Get(user, id);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                NFMT.User.Model.Role role = result.ReturnValue as NFMT.User.Model.Role;
                if (role != null)
                {
                    this.txbRoleName.InnerText = role.RoleName;
                    this.hidId.Value = role.RoleId.ToString();
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 19, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

                this.navigation1.Routes.Add("角色管理", string.Format("{0}User/RoleList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("角色修改", string.Empty);

                int id = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    if (int.TryParse(Request.QueryString["id"], out id))
                    {
                        if (id == 0)
                            Response.Redirect("RoleList.aspx");

                        NFMT.User.BLL.RoleBLL roleBLL = new NFMT.User.BLL.RoleBLL();
                        var result = roleBLL.Get(user, id);
                        if (result.ResultStatus != 0)
                            Response.Redirect("RoleList.aspx");

                        NFMT.User.Model.Role role = result.ReturnValue as NFMT.User.Model.Role;
                        if (role != null)
                        {
                            this.txbRoleName.Value = role.RoleName;
                        }
                    }
                }
            }
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";

            string roleName = context.Request.Form["roleName"];

            int id = 0;

            string resultStr = "修改失败";

            if (string.IsNullOrEmpty(context.Request.Form["id"]))
            {
                resultStr = "id未知";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["id"], out id))
            {
                resultStr = "id未知";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            if (string.IsNullOrEmpty(roleName))
            {
                resultStr = "角色名称不能为空";
                context.Response.Write(resultStr);
                context.Response.End();
            }

            NFMT.User.BLL.RoleBLL roleBLL = new NFMT.User.BLL.RoleBLL();
            NFMT.Common.ResultModel result = roleBLL.Get(user, id);
            if (result.ResultStatus != 0)
            {
                resultStr = "获取数据错误";
                context.Response.Write(resultStr);
                context.Response.End();
            }
            NFMT.User.Model.Role role = result.ReturnValue as NFMT.User.Model.Role;
            if (role != null)
            {
                role.RoleName = roleName;

                result = roleBLL.Update(user, role);
                resultStr = result.Message;
            }

            context.Response.Write(resultStr);
            context.Response.End();
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 19, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.冻结, NFMT.Common.OperateEnum.解除冻结 });

                this.navigation1.Routes.Add("角色管理", string.Format("{0}User/RoleList.aspx", NFMT.Common.DefaultValue.NftmSiteName));
                this.navigation1.Routes.Add("角色明细", string.Empty);

                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    if (int.TryParse(Request.QueryString["id"], out id))
                    {
                        if (id == 0)
                            Response.Redirect("RoleList.aspx");

                        NFMT.User.BLL.RoleBLL roleBLL = new NFMT.User.BLL.RoleBLL();
                        var result = roleBLL.Get(user, id);
                        if (result.ResultStatus != 0)
                            Response.Redirect("RoleList.aspx");

                        NFMT.User.Model.Role role = result.ReturnValue as NFMT.User.Model.Role;
                        if (role != null)
                        {
                            this.txbRoleName.InnerText = role.RoleName;

                            this.hidId.Value = role.RoleId.ToString();

                            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                            string json = serializer.Serialize(role);
                            this.hidModel.Value = json;
                        }
                    }
                }
            }
        }