Пример #1
0
        /// <summary>
        /// 删除一个菜单
        /// </summary>
        public void Menu_Del()
        {
            if (!EX_Admin.Power("admin_menu_edit", "编辑菜单"))
            {
                EX_Admin.NoPower();
                return;
            }
            int       id    = RequestTool.RequestInt("id", 0);
            Lebi_Menu model = B_Lebi_Menu.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg" + Tag("参数错误") + "\"}");
                return;
            }
            else
            {
                //if (model.IsSYS == 0)
                B_Lebi_Menu.Delete(id);
            }
            string action = Tag("删除菜单");

            Log.Add(action, "Admin_Power", id.ToString(), CurrentAdmin, "");
            Response.Write("{\"msg\":\"OK\"}");
        }
Пример #2
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Menu] set ");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[URL]=@URL,");
                strSql.Append("[Sort]=@Sort,");
                strSql.Append("[parentid]=@parentid,");
                strSql.Append("[Isshow]=@Isshow,");
                strSql.Append("[Image]=@Image,");
                strSql.Append("[Code]=@Code,");
                strSql.Append("[IsSYS]=@IsSYS,");
                strSql.Append("[parentCode]=@parentCode");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",       model.Name),
                    new OleDbParameter("@URL",        model.URL),
                    new OleDbParameter("@Sort",       model.Sort),
                    new OleDbParameter("@parentid",   model.parentid),
                    new OleDbParameter("@Isshow",     model.Isshow),
                    new OleDbParameter("@Image",      model.Image),
                    new OleDbParameter("@Code",       model.Code),
                    new OleDbParameter("@IsSYS",      model.IsSYS),
                    new OleDbParameter("@parentCode", model.parentCode)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Пример #3
0
        /// <summary>
        /// 更新插件菜单
        /// </summary>
        /// <param name="c"></param>
        /// <param name="m"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private Lebi_Menu updatemenu(string c, PluginConfig.menuconfig m, Lebi_Menu parent)
        {
            string code = c + "_" + m.name;

            Lebi_Menu menu = B_Lebi_Menu.GetModel("Code=lbsql{'" + code + "'}");

            if (parent == null && m.parentcode != "")
            {
                parent = B_Lebi_Menu.GetModel("Code=lbsql{'" + m.parentcode + "'}");
            }
            if (parent == null)
            {
                parent = new Lebi_Menu();
            }
            if (menu == null)
            {
                menu            = new Lebi_Menu();
                menu.Code       = code;
                menu.Isshow     = 1;
                menu.Name       = m.name;
                menu.parentCode = parent.Code;
                menu.parentid   = parent.id;
                if (m.url == null)
                {
                    menu.URL = "";
                }
                else
                {
                    menu.URL = m.url.TrimStart('/');
                }
                B_Lebi_Menu.Add(menu);
                menu.id = B_Lebi_Menu.GetMaxId();
            }
            return(menu);
        }
Пример #4
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Menu](");
                strSql.Append("Name,URL,Sort,parentid,Isshow,Image,Code,IsSYS,parentCode)");
                strSql.Append(" values (");
                strSql.Append("@Name,@URL,@Sort,@parentid,@Isshow,@Image,@Code,@IsSYS,@parentCode)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Name",       model.Name),
                    new SqlParameter("@URL",        model.URL),
                    new SqlParameter("@Sort",       model.Sort),
                    new SqlParameter("@parentid",   model.parentid),
                    new SqlParameter("@Isshow",     model.Isshow),
                    new SqlParameter("@Image",      model.Image),
                    new SqlParameter("@Code",       model.Code),
                    new SqlParameter("@IsSYS",      model.IsSYS),
                    new SqlParameter("@parentCode", model.parentCode)
                };

                object obj = SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("admin_menu_edit", "编辑菜单"))
            {
                WindowNoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Menu.GetModel(id);
            if (model == null)
            {
                model          = new Lebi_Menu();
                model.parentid = pid;
                model.Isshow   = 1;
            }
            else
            {
                pid = model.parentid;
            }
            pmodel = B_Lebi_Menu.GetModel(pid);
            if (pmodel == null)
            {
                pmodel      = new Lebi_Menu();
                pmodel.Name = "-";
            }
        }
Пример #6
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Menu GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Menu] ");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id", SqlDbType.Int, 4)
                };
                parameters[0].Value = id;

                Lebi_Menu model = new Lebi_Menu();
                DataSet   ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    model.URL  = ds.Tables[0].Rows[0]["URL"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Isshow"].ToString() != "")
                    {
                        model.Isshow = int.Parse(ds.Tables[0].Rows[0]["Isshow"].ToString());
                    }
                    model.Image = ds.Tables[0].Rows[0]["Image"].ToString();
                    model.Code  = ds.Tables[0].Rows[0]["Code"].ToString();
                    if (ds.Tables[0].Rows[0]["IsSYS"].ToString() != "")
                    {
                        model.IsSYS = int.Parse(ds.Tables[0].Rows[0]["IsSYS"].ToString());
                    }
                    model.parentCode = ds.Tables[0].Rows[0]["parentCode"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Пример #7
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Menu GetModel(string strWhere)
            {
                if (strWhere.IndexOf("lbsql{") > 0)
                {
                    SQLPara para = new SQLPara(strWhere, "", "");
                    return(GetModel(para));
                }
                StringBuilder strSql = new StringBuilder();

                strSql.Append("select  top 1  * from [Lebi_Menu] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_Menu model = new Lebi_Menu();
                DataSet   ds    = SqlUtils.SqlUtilsInstance.TextExecuteDataset(strSql.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                    model.URL  = ds.Tables[0].Rows[0]["URL"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["Isshow"].ToString() != "")
                    {
                        model.Isshow = int.Parse(ds.Tables[0].Rows[0]["Isshow"].ToString());
                    }
                    model.Image = ds.Tables[0].Rows[0]["Image"].ToString();
                    model.Code  = ds.Tables[0].Rows[0]["Code"].ToString();
                    if (ds.Tables[0].Rows[0]["IsSYS"].ToString() != "")
                    {
                        model.IsSYS = int.Parse(ds.Tables[0].Rows[0]["IsSYS"].ToString());
                    }
                    model.parentCode = ds.Tables[0].Rows[0]["parentCode"].ToString();
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Пример #8
0
        /// <summary>
        /// 更新插件菜单
        /// </summary>
        public void Plugin_updatemenu()
        {
            if (!EX_Admin.Power("pluginconfig_edit", "插件设置"))
            {
                AjaxNoPower();
                return;
            }
            string name = RequestTool.RequestString("id");
            List <PluginConfig> models = Event.GetPluginConfig();

            foreach (PluginConfig model in models)
            {
                if (model.Assembly == name)
                {
                    foreach (PluginConfig.menuconfig m in model.MenuConfigs)
                    {
                        Lebi_Menu menu0 = updatemenu(model.Assembly, m, null);
                        foreach (PluginConfig.menuconfig m1 in m.son)
                        {
                            Lebi_Menu menu1 = updatemenu(model.Assembly, m1, menu0);
                            foreach (PluginConfig.menuconfig m2 in m1.son)
                            {
                                updatemenu(model.Assembly, m2, menu1);
                            }
                        }
                    }
                    foreach (PluginConfig.menurewrite m in model.MenuRewrites)
                    {
                        Lebi_Menu menu = B_Lebi_Menu.GetModel("Code='" + m.code + "'");
                        if (menu != null)
                        {
                            if (menu.URL != m.url)
                            {
                                menu.URL = m.url;
                            }
                            B_Lebi_Menu.Update(menu);
                        }
                    }
                }
            }

            Response.Write("{\"msg\":\"OK\"}");
        }
Пример #9
0
 public bool IsNew(string name)
 {
     foreach (PluginConfig model in models)
     {
         if (model.Assembly == name)
         {
             foreach (PluginConfig.menuconfig m in model.MenuConfigs)
             {
                 if (countmenu(model.Assembly + "_" + m.name) == 0)
                 {
                     return(true);
                 }
                 foreach (PluginConfig.menuconfig m1 in m.son)
                 {
                     if (countmenu(model.Assembly + "_" + m1.name) == 0)
                     {
                         return(true);
                     }
                     foreach (PluginConfig.menuconfig m2 in m1.son)
                     {
                         if (countmenu(model.Assembly + "_" + m2.name) == 0)
                         {
                             return(true);
                         }
                     }
                 }
             }
             foreach (PluginConfig.menurewrite m in model.MenuRewrites)
             {
                 Lebi_Menu menu = B_Lebi_Menu.GetModel("Code='" + m.code + "'");
                 if (menu != null)
                 {
                     if (menu.URL != m.url)
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }
Пример #10
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Menu] set ");
                strSql.Append("Name= @Name,");
                strSql.Append("URL= @URL,");
                strSql.Append("Sort= @Sort,");
                strSql.Append("parentid= @parentid,");
                strSql.Append("Isshow= @Isshow,");
                strSql.Append("Image= @Image,");
                strSql.Append("Code= @Code,");
                strSql.Append("IsSYS= @IsSYS,");
                strSql.Append("parentCode= @parentCode");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",         SqlDbType.Int,        4),
                    new SqlParameter("@Name",       SqlDbType.NVarChar,  50),
                    new SqlParameter("@URL",        SqlDbType.NVarChar, 500),
                    new SqlParameter("@Sort",       SqlDbType.Int,        4),
                    new SqlParameter("@parentid",   SqlDbType.Int,        4),
                    new SqlParameter("@Isshow",     SqlDbType.Int,        4),
                    new SqlParameter("@Image",      SqlDbType.NVarChar, 100),
                    new SqlParameter("@Code",       SqlDbType.NVarChar,  50),
                    new SqlParameter("@IsSYS",      SqlDbType.Int,        4),
                    new SqlParameter("@parentCode", SqlDbType.NVarChar, 50)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Name;
                parameters[2].Value = model.URL;
                parameters[3].Value = model.Sort;
                parameters[4].Value = model.parentid;
                parameters[5].Value = model.Isshow;
                parameters[6].Value = model.Image;
                parameters[7].Value = model.Code;
                parameters[8].Value = model.IsSYS;
                parameters[9].Value = model.parentCode;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Пример #11
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Menu SafeBindForm(Lebi_Menu model)
 {
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["URL"] != null)
     {
         model.URL = Shop.Tools.RequestTool.RequestSafeString("URL");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     if (HttpContext.Current.Request["parentid"] != null)
     {
         model.parentid = Shop.Tools.RequestTool.RequestInt("parentid", 0);
     }
     if (HttpContext.Current.Request["Isshow"] != null)
     {
         model.Isshow = Shop.Tools.RequestTool.RequestInt("Isshow", 0);
     }
     if (HttpContext.Current.Request["Image"] != null)
     {
         model.Image = Shop.Tools.RequestTool.RequestSafeString("Image");
     }
     if (HttpContext.Current.Request["Code"] != null)
     {
         model.Code = Shop.Tools.RequestTool.RequestSafeString("Code");
     }
     if (HttpContext.Current.Request["IsSYS"] != null)
     {
         model.IsSYS = Shop.Tools.RequestTool.RequestInt("IsSYS", 0);
     }
     if (HttpContext.Current.Request["parentCode"] != null)
     {
         model.parentCode = Shop.Tools.RequestTool.RequestSafeString("parentCode");
     }
     return(model);
 }
Пример #12
0
        /// <summary>
        /// 编辑后台菜单
        /// </summary>
        public void Menu_Edit()
        {
            if (!EX_Admin.Power("admin_menu_edit", "编辑菜单"))
            {
                EX_Admin.NoPower();
                return;
            }
            int    id         = RequestTool.RequestInt("id", 0);
            int    pid        = RequestTool.RequestInt("pid", 0);
            int    parentid   = RequestTool.RequestInt("parentid", 0);
            string parentCode = "";

            if (parentid > 0)
            {
                Lebi_Menu parent = B_Lebi_Menu.GetModel(parentid);
                parentCode = parent.Code;
            }
            Lebi_Menu model = B_Lebi_Menu.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Menu();
                B_Lebi_Menu.BindForm(model);
                model.Isshow     = 1;
                model.parentCode = parentCode;
                B_Lebi_Menu.Add(model);
            }
            else
            {
                model.parentCode = parentCode;
                B_Lebi_Menu.BindForm(model);
                B_Lebi_Menu.Update(model);
            }
            ImageHelper.LebiImagesUsed(model.Image, "menu", id);
            string action = Tag("编辑菜单");

            Log.Add(action, "Admin_Power", id.ToString(), CurrentAdmin, model.Name);
            Response.Write("{\"msg\":\"OK\"}");
        }
Пример #13
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Menu ReaderBind(IDataReader dataReader)
            {
                Lebi_Menu model = new Lebi_Menu();
                object    ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Name = dataReader["Name"].ToString();
                model.URL  = dataReader["URL"].ToString();
                ojb        = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                ojb = dataReader["parentid"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.parentid = (int)ojb;
                }
                ojb = dataReader["Isshow"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Isshow = (int)ojb;
                }
                model.Image = dataReader["Image"].ToString();
                model.Code  = dataReader["Code"].ToString();
                ojb         = dataReader["IsSYS"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.IsSYS = (int)ojb;
                }
                model.parentCode = dataReader["parentCode"].ToString();
                return(model);
            }
Пример #14
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Menu](");
                strSql.Append("[Name],[URL],[Sort],[parentid],[Isshow],[Image],[Code],[IsSYS],[parentCode])");
                strSql.Append(" values (");
                strSql.Append("@Name,@URL,@Sort,@parentid,@Isshow,@Image,@Code,@IsSYS,@parentCode)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",       model.Name),
                    new OleDbParameter("@URL",        model.URL),
                    new OleDbParameter("@Sort",       model.Sort),
                    new OleDbParameter("@parentid",   model.parentid),
                    new OleDbParameter("@Isshow",     model.Isshow),
                    new OleDbParameter("@Image",      model.Image),
                    new OleDbParameter("@Code",       model.Code),
                    new OleDbParameter("@IsSYS",      model.IsSYS),
                    new OleDbParameter("@parentCode", model.parentCode)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Пример #15
0
        protected override void OnLoad(EventArgs e)
        {
            if (!EX_Admin.LoginStatus() && RequestTool.GetRequestUrlNonDomain().ToLower().IndexOf("login.aspx") < 0)
            {
                //Response.Redirect(site.AdminPath + "/login.aspx?url=" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "");
                string url = site.AdminPath + "/login.aspx?url=" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "&token=" + EX_Admin.MD5(SYS.InstallCode + RequestTool.GetRequestUrlNonDomain()) + "";
                url = "<script type=\"text/javascript\">window.location='" + url + "';</script>";
                Response.Write(url);
                Response.End();
                return;
            }
            CurrentAdmin = EX_Admin.CurrentAdmin();
            //CurrentAdminGroup = (Lebi_Admin_Group)Session["admin_group"];
            CurrentAdminGroup = B_Lebi_Admin_Group.GetModel(CurrentAdmin.Admin_Group_id);
            DateTime LastDate      = CurrentAdmin.Time_This;
            TimeSpan ts            = System.DateTime.Now - LastDate;
            int      NewEventTimes = 0;

            int.TryParse(SYS.NewEventTimes, out NewEventTimes);
            LeftNewEventTimes = Convert.ToInt32(ts.TotalSeconds % (NewEventTimes / 1000));
            LeftNewEventTimes = NewEventTimes - (LeftNewEventTimes * 1000);
            MenuType          = LB.Tools.CookieTool.GetCookieString("Menu");
            if (MenuType == "")
            {
                MenuType = "Index";
            }

            if (Shop.LebiAPI.Service.Instanse.ServicepackName(SYS.LicensePackage) == "免费版")
            {
                LicenseString = "<div class=\"licensecheck\" style=\"display:block;float:left;margin:7px 0 0 0;padding:0;height:25px;line-height:25px;color:#ffffff;\"><span><a href=\"http://www.lebi.cn/license/\" target=\"_blank\" style=\"color:#fff;font-size:12px;\">" + Tag("免费版") + "</a></span></div>";
            }
            if (Shop.Bussiness.EX_Admin.CheckPower("version"))
            {
                int vers = B_Lebi_Version.Counts("IsUpdate=0 and Version_Check like '%" + SYS.Version + "." + SYS.Version_Son + "%'");
                if (vers > 0)
                {
                    Version = "<div id=\"version\"><a href=\"" + site.AdminPath + "/config/Version.aspx\" style=\"color:red\" >" + Tag("发现新版本") + " " + Tag("点击此处更新") + " </a></div>";
                }
            }
            //lebi菜单
            if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese"))
            {
                var licenseuserurl = "username="******"&password="******"&vc=" + EX_User.MD5(SYS.LicensePWD);
                lbmenu  = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0\">" + Tag("桌面") + "</a> | <a href=\"javascript:void(0);\" onclick=\"Copyright();\">" + Tag("关于") + "</a></span></li></ul>";
                lbmenu += "<ul class=\"faq\"><li><a href=\"http://www.lebi.cn/support/checkuser.aspx?" + licenseuserurl + "\" title=\"" + Tag("客服中心") + "\" target=\"_blank\"><b></b><span>" + Tag("客服中心") + "</span></a></li></ul>";
                string license = "Copyright 2003-" + DateTime.Now.Year + " <a href=\"http://www.lebi.cn/\" target=\"_blank\" class=\"footcopy\">Lebi.cn</a> , All Rights Reserved. Powered by <a href=\"http://www.lebi.cn/support/license/?url=" + Request.ServerVariables["SERVER_NAME"] + "\" target=\"_blank\" title=\"LebiShop\" class=\"footcopy\">LebiShop</a> V<a href=\"" + site.AdminPath + "/config/version.aspx\">" + SYS.Version + "." + SYS.Version_Son + "</a>";
                try
                {
                    Label LBLicense = (Label)this.Page.FindControl("LBLicense");
                    LBLicense.Text = license;
                }
                catch
                {
                    string strscript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
                    //strscript = "<script language='javascript'>";
                    //strscript += "document.onreadystatechange = loadlicense;";
                    //strscript += "function loadlicense(){";
                    //strscript += "if(document.readyState == \"complete\"){";
                    //strscript += "if ($(\"#lebicopy\")[0] == undefined) {alert('页面布局异常')}else{";
                    //strscript += "$('#lebicopy').html('" + license + "')}";
                    //strscript += "}}</script>";
                    strscript += license;
                    Response.Write(strscript);
                }
            }
            else
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0\">" + Tag("桌面") + "</a> | <a href=\"javascript:void(0);\" onclick=\"Copyright();\">" + Tag("关于") + "</a></span></li></ul>";
            }
            //处理菜单
            desk     = RequestTool.RequestInt("desk", 0);
            AllMenus = new List <Lebi_Menu>();
            List <Lebi_Menu> All = B_Lebi_Menu.GetList("Isshow=1", "Sort desc");
            string           currentgroupmenu = "," + CurrentAdminGroup.Menu_ids + ",";

            if (CurrentAdmin.AdminType == "super")
            {
                AllMenus = All;
            }
            else
            {
                foreach (Lebi_Menu m in All)
                {
                    if (currentgroupmenu.Contains("," + m.id + ","))
                    {
                        AllMenus.Add(m);
                    }
                }
            }
            TopMenus = (from m in AllMenus
                        where m.parentid == 0
                        select m).ToList();
            string currentPage = RequestTool.GetRequestUrl().ToLower();
            int    apathindex  = currentPage.IndexOf(site.AdminPath.ToLower());

            currentPage = currentPage.Substring(apathindex, currentPage.Length - apathindex);
            currentPage = currentPage.Substring(site.AdminPath.Length, currentPage.Length - site.AdminPath.Length).TrimStart('/');
            if (desk != 1)
            {
                try
                {
                    var temp = from m in AllMenus
                               where currentPage.IndexOf(m.URL.ToLower().TrimStart('/')) == 0 && m.parentid > 0 && m.URL != ""
                               select m;
                    //if (temp == null)
                    //    CurrentLeftMenu = new Lebi_Menu();
                    //else
                    //{
                    CurrentLeftMenu = temp.ToList().FirstOrDefault();
                    CurrentTopMenu  = (from m in AllMenus
                                       where m.id == CurrentLeftMenu.parentid
                                       select m).ToList().FirstOrDefault();
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == CurrentTopMenu.parentid
                                      select m).ToList().FirstOrDefault();
                    ////写入cookie
                    NameValueCollection nvs = new NameValueCollection();
                    nvs.Add("top", CurrentTopMenu.id.ToString());
                    nvs.Add("left", CurrentLeftMenu.id.ToString());
                    CookieTool.WriteCookie("Menu", nvs, 30);
                    //}
                }
                catch (NullReferenceException)
                {
                    var menu = CookieTool.GetCookie("Menu");
                    int tid  = 0;
                    int lid  = 0;
                    int.TryParse(menu.Get("top"), out tid);
                    int.TryParse(menu.Get("left"), out lid);
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == tid
                                      select m).ToList().FirstOrDefault();
                    CurrentLeftMenu = (from m in AllMenus
                                       where m.id == lid
                                       select m).ToList().FirstOrDefault();
                }
            }
            else
            {
                //写入cookie
                NameValueCollection nvs = new NameValueCollection();
                nvs.Add("top", "0");
                nvs.Add("left", "0");
                CookieTool.WriteCookie("Menu", nvs, 365);
            }
            if (CurrentTopMenu == null)
            {
                CurrentTopMenu = new Lebi_Menu();
                desk           = 1;
            }

            CheckPagePower();
            if (CurrentAdmin.Avatar == "")
            {
                CurrentAdmin.Avatar = site.AdminImagePath + "/Avatar.jpg";
            }
            base.OnLoad(e);
        }
Пример #16
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Menu model)
 {
     D_Lebi_Menu.Instance.Update(model);
 }
Пример #17
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Menu model)
 {
     return(D_Lebi_Menu.Instance.Add(model));
 }
Пример #18
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Menu SafeBindForm(Lebi_Menu model)
 {
     return(D_Lebi_Menu.Instance.SafeBindForm(model));
 }