コード例 #1
0
        private void getmymenus(HttpContext context)
        {
            int ID = WebUtil.GetIntValue(context, "ID");

            if (ID < 0)
            {
                WebUtil.WriteJson(context, new { status = false });
                return;
            }
            string GroupName = context.Request["GroupName"];

            string[] modulecodes = WebUtil.GetModuleCodes(context);
            GroupName = string.IsNullOrEmpty(GroupName) ? Utility.EnumModel.SysMenuGroupNameDefine.wynk.ToString() : GroupName;
            var    modules      = SysMenu.GetSysMenuForUser(WebUtil.GetUser(context).UserID, ID, GroupName: GroupName).Where(p => modulecodes.Contains(p.ModuleCode)).OrderBy(p => p.SortOrder);
            string context_path = WebUtil.getApplicationPath();
            var    items        = modules.Select(p =>
            {
                var item         = p.ToJsonObject();
                item["IconPath"] = !string.IsNullOrEmpty(p.IconPath) ? context_path + p.IconPath : string.Empty;
                return(item);
            });

            WebUtil.WriteJson(context, new { status = true, list = items });
        }
コード例 #2
0
ファイル: subpage.aspx.cs プロジェクト: sd009896/CustomerMall
        protected void Page_Load(object sender, EventArgs e)
        {
            string pageurl = string.Empty;

            if (Request.QueryString["pageurl"] != null)
            {
                pageurl = Request.QueryString["pageurl"];
            }
            var module = new Foresight.DataAccess.SysMenu();

            if (!string.IsNullOrEmpty(pageurl))
            {
                string title = "";
                if (Request.QueryString["title"] != null)
                {
                    title = Request.QueryString["title"];
                }
                if (Request.QueryString["expired"] != null)
                {
                    string expired = Request.QueryString["expired"];
                    pageurl = pageurl + "?expired=" + expired;
                }
                module.Title = title;
                module.Url   = pageurl;
                this.rptsubpage.DataSource = new SysMenu[] { module };
                this.rptsubpage.DataBind();
                iframeUrl = pageurl;
                return;
            }
            int ID = 0;

            if (string.IsNullOrEmpty(Request.QueryString["ID"]))
            {
                return;
            }
            int.TryParse(Request.QueryString["ID"], out ID);
            int RoomID = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["roomid"]))
            {
                int.TryParse(Request.QueryString["roomid"], out RoomID);
            }
            List <SysMenu> data_list = new List <SysMenu>();

            module = SysMenu.GetSysMenu(ID);
            if (module == null)
            {
                return;
            }
            if (module.UsingImgURL)
            {
                module.Url = "../SysSeting/ViewStaticPage.aspx?ID=" + module.ID;
                data_list.Add(module);
                this.rptsubpage.DataSource = data_list;
                this.rptsubpage.DataBind();
                iframeUrl = data_list[0].Url;
                return;
            }
            var modules = SysMenu.GetSysMenuForUser(this.CurrentUser.UserID, ID).ToList();

            if (string.IsNullOrEmpty(module.GroupName) || module.GroupName.Equals(Utility.EnumModel.SysMenuGroupNameDefine.wynk.ToString()))
            {
            }
            string[] modulecodes = WebUtil.GetModuleCodes(this.Context);
            modules = modules.Where(p => modulecodes.Contains(p.ModuleCode)).OrderBy(p => p.SortOrder).ToList();

            var modules_1 = modules.Where(p => !p.IsAuthority).ToList();

            data_list.AddRange(modules_1);
            var modules_2 = modules.Where(p => p.IsAuthority && !string.IsNullOrEmpty(p.Url)).ToList();

            if (modules_2.Count > 0 || data_list.Count == 0)
            {
                if (!string.IsNullOrEmpty(module.Url) && RoomID > 0 && module.ID == 11)
                {
                    module.Url = module.Url + "?RoomID=" + RoomID;
                }
                if (string.IsNullOrEmpty(module.Url))
                {
                    module.Url = "../SysSeting/MainSetup.aspx?ParentID=" + module.ID;
                }
                data_list.Add(module);
            }
            foreach (var item in data_list)
            {
                if (string.IsNullOrEmpty(item.Url))
                {
                    item.Url = "../SysSeting/MainSetup.aspx?ParentID=" + item.ID;
                }
            }
            if (data_list.Count > 0)
            {
                this.rptsubpage.DataSource = data_list;
                this.rptsubpage.DataBind();
                iframeUrl = data_list[0].Url;
            }
        }