Exemple #1
0
        /// <summary>
        /// 初始化栏目、模块、权限信息
        /// </summary>
        private void InitAllPrivs()
        {
            System.Text.StringBuilder      html = new System.Text.StringBuilder();
            EyouSoft.BLL.SysStructure.BSys bll  = new EyouSoft.BLL.SysStructure.BSys();
            var items = bll.GetMenus();

            bll = null;

            if (items != null && items.Count > 0)
            {
                foreach (var big in items)
                {
                    html.AppendFormat("<div class=\"pBig\"><input type=\"checkbox\" id=\"chk_p_big_{1}\" value=\"{1}\" name=\"chk_p_big\" /><label for=\"chk_p_big_{1}\">{0}</label><span class=\"pno\">[{1}]</div></span>", big.Name
                                      , big.MenuId);

                    if (big.Menu2s == null || big.Menu2s.Count < 1)
                    {
                        continue;
                    }

                    html.Append("<div>");

                    int i = 0;
                    foreach (var small in big.Menu2s)
                    {
                        html.Append("<ul class=\"pSmall\">");
                        html.AppendFormat("<li class=\"pSmallTitle\"><input type=\"checkbox\" id=\"chk_p_small_{1}\" value=\"{1}\" name=\"chk_p_small\" /><label for=\"chk_p_small_{1}\">{0}</label><span class=\"pno\">[{1}]</span></li>", small.Name
                                          , small.MenuId);

                        if (small.Privs != null && small.Privs.Count > 0)
                        {
                            foreach (var permission in small.Privs)
                            {
                                html.AppendFormat("<li class=\"pThird\" title=\"{2}\"><input type=\"checkbox\" id=\"chk_p_third_{1}\" value=\"{1}\" name=\"chk_p_third\"  /><label for=\"chk_p_third_{1}\">{0}</label><span class=\"pno\">[{1}]</span></li>", permission.Name
                                                  , permission.PrivsId, permission.Remark);
                            }
                        }

                        html.Append("</ul>");

                        if (i % 4 == 3)
                        {
                            html.Append("<ul class=\"pSmallSpace\"><li></li></ul>");
                        }
                        i++;
                    }

                    html.Append("<ul class=\"pSmallSpace\"><li></li></ul>");
                    html.Append("</div>");
                }
            }

            this.ltrPermissions.Text = html.ToString();

            string script = "var allPrivs={0};";

            script = string.Format(script, Newtonsoft.Json.JsonConvert.SerializeObject(items));
            this.RegisterScript(script);
        }
Exemple #2
0
        /// <summary>
        /// init sys default menus
        /// </summary>
        void InitSysMenus()
        {
            EyouSoft.BLL.SysStructure.BSys bll = new EyouSoft.BLL.SysStructure.BSys();
            var items = bll.GetMenus();

            bll = null;

            if (items != null && items.Count > 0)
            {
                this.rptMenus.DataSource = items;
                this.rptMenus.DataBind();
            }
        }