Exemplo n.º 1
0
        /// <summary>
        /// 编辑后台菜单
        /// </summary>
        public void Menu_Edit()
        {
            if (!EX_Admin.Power("supplier_menu_edit", "编辑菜单"))
            {
                EX_Admin.NoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int pid = RequestTool.RequestInt("pid", 0);
            Lebi_Supplier_Menu model = B_Lebi_Supplier_Menu.GetModel(id);

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

            Log.Add(action, "Supplier_Menu", id.ToString(), CurrentAdmin, model.Name);
            Response.Write("{\"msg\":\"OK\"}");
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_menu_edit", "编辑菜单"))
            {
                WindowNoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Supplier_Menu.GetModel(id);
            if (model == null)
            {
                model          = new Lebi_Supplier_Menu();
                model.parentid = pid;
                model.Isshow   = 1;
            }
            else
            {
                pid = model.parentid;
            }
            pmodel = B_Lebi_Supplier_Menu.GetModel(pid);
            if (pmodel == null)
            {
                pmodel      = new Lebi_Supplier_Menu();
                pmodel.Name = "-";
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除一个菜单
        /// </summary>
        public void Menu_Del()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_Menu model = B_Lebi_Supplier_Menu.GetModel(id);

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

            Log.Add(action, "Supplier_Menu", id.ToString(), CurrentAdmin, "");
            Response.Write("{\"msg\":\"OK\"}");
        }
Exemplo n.º 4
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_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(" 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)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Exemplo n.º 5
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_Menu](");
                strSql.Append("Name,URL,Sort,parentid,Isshow,Image,Code,IsSYS)");
                strSql.Append(" values (");
                strSql.Append("@Name,@URL,@Sort,@parentid,@Isshow,@Image,@Code,@IsSYS)");
                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)
                };

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

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
Exemplo n.º 6
0
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Supplier_Menu GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

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

                Lebi_Supplier_Menu model = new Lebi_Supplier_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());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemplo n.º 7
0
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Supplier_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_Supplier_Menu] ");
                strSql.Append(" where " + strWhere + "");
                Lebi_Supplier_Menu model = new Lebi_Supplier_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());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
Exemplo n.º 8
0
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_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(" 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)
                };
                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;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Exemplo n.º 9
0
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_Menu model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_Menu](");
                strSql.Append("[Name],[URL],[Sort],[parentid],[Isshow],[Image],[Code],[IsSYS])");
                strSql.Append(" values (");
                strSql.Append("@Name,@URL,@Sort,@parentid,@Isshow,@Image,@Code,@IsSYS)");
                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)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Exemplo n.º 10
0
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Supplier_Menu ReaderBind(IDataReader dataReader)
            {
                Lebi_Supplier_Menu model = new Lebi_Supplier_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;
                }
                return(model);
            }
Exemplo n.º 11
0
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Supplier_Menu SafeBindForm(Lebi_Supplier_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);
     }
     return(model);
 }
Exemplo n.º 12
0
        protected override void OnLoad(EventArgs e)
        {
            if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang"))
            {
                Response.Redirect(WebPath + "/");
                Response.End();
                return;
            }
            PageLoadCheck(); //页面载入检查
            #region 当前用户信息
            int selectsupplierid = RequestTool.RequestInt("selectsupplierid");
            if (selectsupplierid > 0)
            {
                //切换超级账号
                string msg = "";
                EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg);
                CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011");
            }
            if (CurrentSupplierUser == null)
            {
                CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser);
            }

            if (CurrentSupplierUser.id == 0)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id);
            if (CurrentSupplier.Type_id_SupplierStatus != 442)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id);
            if (CurrentSupplierUserGroup == null)
            {
                CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup();
            }
            if (CurrentSupplier != null)
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);

                if (CurrentSupplierGroup == null)
                {
                    CurrentSupplierGroup = new Lebi_Supplier_Group();
                }
            }
            else
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            DateTime LastDate      = CurrentSupplier.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);
            #endregion

            #region 配合前台主题
            string themecode = "";
            int    siteid    = 0;
            var    nv        = CookieTool.GetCookie("ThemeStatus");
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("site")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }
            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true);
            #endregion

            #region 处理菜单
            MenuType = Shop.Tools.CookieTool.GetCookieString("Menu");
            if (MenuType == "")
            {
                MenuType = "Index";
            }

            string menu_ids = "";
            if (CurrentSupplierUserGroup != null && CurrentSupplierUser.User_id != CurrentSupplier.User_id)
            {
                menu_ids = CurrentSupplierUserGroup.Menu_ids;
            }
            else
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);
                if (CurrentSupplierGroup != null)
                {
                    menu_ids = CurrentSupplierGroup.Menu_ids;
                }
            }
            //lebi菜单
            if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese"))
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></span></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\"><script language='javascript'>";
                    strscript += "document.onreadystatechange = loadlicense;";
                    strscript += "function loadlicense(){";
                    strscript += "if(document.readyState == \"complete\"){";
                    strscript += "if ($(\"#lebicopy\")[0] == undefined) {alert('页面布局异常')}";
                    strscript += "$('#lebicopy').html('" + license + "')";
                    strscript += "}}</script>";
                    Response.Write(strscript);
                }
            }
            else
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></ul>";
            }
            //处理菜单
            desk     = RequestTool.RequestInt("desk", 0);
            AllMenus = new List <Lebi_Supplier_Menu>();
            List <Lebi_Supplier_Menu> All = B_Lebi_Supplier_Menu.GetList("Isshow=1", "Sort desc");
            string currentgroupmenu       = "," + menu_ids + ",";
            foreach (Lebi_Supplier_Menu m in All)
            {
                if (currentgroupmenu.Contains("," + m.id + ","))
                {
                    AllMenus.Add(m);
                }
            }
            TopMenus = (from m in AllMenus
                        where m.parentid == 0
                        select m).ToList();
            if (desk != 1)
            {
                try
                {
                    var temp = from m in AllMenus
                               where reqPage.Contains(m.URL.ToLower()) && 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("sMenu", nvs, 365);
                    //}
                }
                catch (NullReferenceException)
                {
                    var menu = CookieTool.GetCookie("sMenu");
                    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("sMenu", nvs, 365);
            }
            if (CurrentTopMenu == null)
            {
                CurrentTopMenu = new Lebi_Supplier_Menu();
                desk           = 1;
            }
            #endregion
            Suppliers = GetSuppliers();


            base.OnLoad(e);
        }
Exemplo n.º 13
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Supplier_Menu model)
 {
     D_Lebi_Supplier_Menu.Instance.Update(model);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Supplier_Menu model)
 {
     return(D_Lebi_Supplier_Menu.Instance.Add(model));
 }
Exemplo n.º 15
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Supplier_Menu SafeBindForm(Lebi_Supplier_Menu model)
 {
     return(D_Lebi_Supplier_Menu.Instance.SafeBindForm(model));
 }