コード例 #1
0
ファイル: VerificationUtility.cs プロジェクト: weiliji/NFMT
        public void JudgeOperate(System.Web.UI.Page page, int menuId, List<NFMT.Common.OperateEnum> operateTypes)
        {
            NFMT.Common.UserModel user = new SiteUtility.UserUtility().CurrentUser;

            try
            {
                NFMT.User.BLL.AuthOperateBLL bll = new NFMT.User.BLL.AuthOperateBLL();
                NFMT.Common.ResultModel result = bll.JudgeOperate(user, menuId, operateTypes);
                if (result.ResultStatus != 0)
                {
                    string oids = string.Empty;
                    foreach (NFMT.Common.OperateEnum operate in operateTypes)
                    {
                        oids += operate.ToString() + ",";
                    }

                    if (!string.IsNullOrEmpty(oids) && oids.IndexOf(',') > -1)
                        oids = oids.Substring(0, oids.Length - 1);

                    NFMT.User.BLL.MenuBLL menuBLL = new NFMT.User.BLL.MenuBLL();
                    result = menuBLL.Get(user, menuId);
                    if (result.ResultStatus != 0)
                        throw new Exception("获取菜单失败");

                    NFMT.User.Model.Menu menu = result.ReturnValue as NFMT.User.Model.Menu;

                    string redirectUrl = string.Format("{0}/ErrorPage.aspx?t={1}&r={2}", NFMT.Common.DefaultValue.NfmtSiteName, string.Format("用户无{0}-{1}权限", menu.MenuName, oids), "/MainForm.aspx");
                    page.Response.Redirect(redirectUrl, false);
                }
            }
            catch
            {
                page.Response.Redirect("/MainForm.aspx");
            }
        }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
                NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();

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

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

                NFMT.User.BLL.MenuBLL bll = new NFMT.User.BLL.MenuBLL();
                result = bll.GetOperateList(user, menuId, empId);

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

                context.Response.Write(result.ReturnValue);
            }
            catch (Exception e)
            {
                context.Response.Write(e.Message);
            }
        }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;
            string postData = string.Empty;

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

            string menuIds = context.Request["menuIds"].ToString();

            NFMT.User.BLL.MenuBLL bll = new NFMT.User.BLL.MenuBLL();
            NFMT.Common.ResultModel result = bll.GetMenuOperateList(empId, menuIds);
            if (result.ResultStatus == 0)
                postData = Newtonsoft.Json.JsonConvert.SerializeObject(result.ReturnValue as System.Data.DataTable);

            context.Response.Write(postData);
        }