コード例 #1
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

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

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

            string resultStr = "添加失败";

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

            NFMT.User.Model.Role role = new NFMT.User.Model.Role()
            {
                 RoleName = roleName
            };

            NFMT.User.BLL.RoleBLL roleBLL = new NFMT.User.BLL.RoleBLL();
            var result = roleBLL.Insert(user, role);
            resultStr = result.Message;

            context.Response.Write(resultStr);
        }
コード例 #2
0
ファイル: EmpRoleDetail.aspx.cs プロジェクト: weiliji/NFMT
        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();
                }
            }
        }
コード例 #3
0
ファイル: RoleUpdate.aspx.cs プロジェクト: weiliji/NFMT
        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;
                        }
                    }
                }
            }
        }
コード例 #4
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();
        }
コード例 #5
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            context.Response.ContentType = "text/plain";
            int id = 0;
            int operateId = 0;

            if (!int.TryParse(context.Request.Form["id"], out id) || id <= 0)
            {
                context.Response.Write("序号错误");
                context.Response.End();
            }

            if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0)
            {
                context.Response.Write("操作错误");
                context.Response.End();
            }

            NFMT.User.BLL.RoleBLL bll = new NFMT.User.BLL.RoleBLL();
            NFMT.User.Model.Role role = new NFMT.User.Model.Role()
            {
                LastModifyId = user.EmpId,
                RoleId = id
            };

            NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId;
            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

            switch (operateEnum)
            {
                case NFMT.Common.OperateEnum.作废:
                    result = bll.Invalid(user, role);
                    break;
                case NFMT.Common.OperateEnum.撤返:
                    result = bll.GoBack(user, role);
                    break;
                case NFMT.Common.OperateEnum.冻结:
                    result = bll.Freeze(user, role);
                    break;
                case NFMT.Common.OperateEnum.解除冻结:
                    result = bll.UnFreeze(user, role);
                    break;
            }

            context.Response.Write(result.Message);
        }
コード例 #6
0
ファイル: RoleListHandler.ashx.cs プロジェクト: weiliji/NFMT
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            int pageIndex = 1, pageSize = 10;
            string orderStr = string.Empty, whereStr = string.Empty;

            string key = context.Request["k"];//模糊搜索

            int status = 0;
            if (!string.IsNullOrEmpty(context.Request["s"]))
                int.TryParse(context.Request["s"], out status);

            if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"]))
                int.TryParse(context.Request.QueryString["pagenum"], out pageIndex);
            pageIndex++;
            if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"]))
                int.TryParse(context.Request.QueryString["pagesize"], out pageSize);

            if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"]))
                orderStr = string.Format("{0} {1}", context.Request.QueryString["sortdatafield"].Trim(), context.Request.QueryString["sortorder"].Trim());

            NFMT.User.BLL.RoleBLL roleBLL = new NFMT.User.BLL.RoleBLL();
            NFMT.Common.SelectModel select = roleBLL.GetSelectModel(pageIndex, pageSize, orderStr, key, status);
            NFMT.Common.ResultModel result = roleBLL.Load(user, select);

            context.Response.ContentType = "application/json; charset=utf-8";
            if (result.ResultStatus != 0)
            {
                context.Response.Write(result.Message);
                context.Response.End();
            }

            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            System.Collections.Generic.Dictionary<string, object> dic = new System.Collections.Generic.Dictionary<string, object>();

            dic.Add("count", result.AffectCount);
            dic.Add("data", dt);

            string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dic);

            context.Response.Write(postData);
        }
コード例 #7
0
ファイル: RoleDetail.aspx.cs プロジェクト: weiliji/NFMT
        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;
                        }
                    }
                }
            }
        }