Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Random Random = new Random();

            randnum = RequestTool.RequestInt("randnum", 0);
            id      = RequestTool.RequestInt("id", 0);
            if (id == 0 || (id > 0 && randnum > 0))
            {
                if (!EX_Admin.Power("product_add", "添加商品"))
                {
                    PageNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("product_edit", "编辑商品"))
                {
                    PageNoPower();
                }
            }
            action = RequestTool.RequestInt("action", 1);
            model  = B_Lebi_Product.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Product();
                model.Type_id_ProductType = 320;
            }
            wap = Ishavewap();

            StepPrices = EX_Product.StepPrice(model.StepPrice);
            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
            if (UserLevelPrices == null)
            {
                UserLevelPrices = new List <ProductUserLevelPrice>();
            }
            UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
            if (UserLevelCounts == null)
            {
                UserLevelCounts = new List <ProductUserLevelCount>();
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
            if (model.IsCombo == 1)
            {
                comboProducts = B_Lebi_Product_Combo.GetList("Product_id=" + model.id + "", "");
            }
            else
            {
                comboProducts = new List <Lebi_Product_Combo>();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 晒单评论
        /// </summary>
        public void Comment_reply()
        {
            int          id         = RequestTool.RequestInt("id", 0);
            int          Product_id = 0;
            Lebi_Product product    = B_Lebi_Product.GetModel(id);

            if (product != null)
            {
                Product_id = product.Product_id;
            }
            Lebi_Comment pmodel = B_Lebi_Comment.GetModel(id);

            if (pmodel == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            string Content = RequestTool.RequestSafeString("comment");

            if (Content == "")
            {
                Response.Write("{\"msg\":\"" + Tag("内容不能为空") + "\"}");
                return;
            }
            Lebi_Comment model = new Lebi_Comment();

            model.TableName = "Product";
            model.Keyid     = id;
            //model.Admin_UserName = CurrentUser.NickName;
            model.Admin_id      = 0;
            model.User_id       = CurrentUser.id;
            model.User_UserName = CurrentUser.NickName;
            model.Content       = Content;
            model.Parentid      = id;
            model.Status        = 280;
            model.Time_Add      = System.DateTime.Now;
            model.Language_Code = CurrentLanguage.Code;
            model.Product_id    = Product_id;
            model.IsRead        = 0;
            model.Supplier_id   = product.Supplier_id;
            if (!Comment.CheckSafeWord(model.Content))
            {
                Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}");
                return;
            }
            B_Lebi_Comment.Add(model);
            //发送邮件
            if (ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("comment"))
            {
                Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id);
                Email.SendEmail_comment(user, model);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userlevelid = RequestTool.RequestInt("userlevelid");

            key       = RequestTool.RequestString("key");
            productid = RequestTool.RequestInt("productid");

            product = B_Lebi_Product.GetModel(productid);

            if (product == null)
            {
                product = new Lebi_Product();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 收藏夹批量添加购物车
        /// </summary>
        public void LikeToBasket()
        {
            string ids = RequestTool.RequestSafeString("id");
            string mes = "";

            if (ids == "")
            {
                Response.Write("{\"msg\":\"" + Tag("请先选择商品") + "\"}");
                return;
            }
            else
            {
                List <Lebi_User_Product> models = B_Lebi_User_Product.GetList("(Type_id_UserProductType=141 or Type_id_UserProductType=144) and User_id=" + CurrentUser.id + " and id in (lbsql{" + ids + "})", "");
                foreach (Lebi_User_Product model in models)
                {
                    //<-{ 判断收藏夹商品是否为上架状态 by lebi.kingdge 2015-02-10
                    Lebi_Product Product = B_Lebi_Product.GetModel("id = " + model.Product_id + " and Type_id_ProductStatus = 101");
                    if (Product == null)
                    {
                        Response.Write("{\"msg\":\"" + Lang(Product.Name) + " " + Tag("该商品已经下架") + "\"}");
                        return;
                    }
                    //}->
                    int num        = model.count;
                    int levelcount = ProductLevelCount(Product);
                    if (num < levelcount)
                    {
                        num = levelcount;
                    }
                    Lebi_User_Product updatemodel = B_Lebi_User_Product.GetModel("User_id=" + CurrentUser.id + " and product_id=" + model.Product_id + " and type_id_UserProductType=142");
                    if (updatemodel != null)
                    {
                        if (updatemodel.count < num)
                        {
                            updatemodel.count = model.count;
                            B_Lebi_User_Product.Update(updatemodel);
                        }
                    }
                    else
                    {
                        model.Type_id_UserProductType = 142;
                        model.count = num;
                        B_Lebi_User_Product.Add(model);
                    }
                }
                mes = Tag("商品已加入购物车") + "<div>" + Tag("数量") + " <span>" + Basket_Product_Count() + "</span> " + Tag("件") + " <span>" + FormatMoney(Basket_Product_Price()) + "</span></div><div><a href='" + URL("P_Basket", "") + "' class='btn btn-7'><s></s>" + Tag("查看购物车") + "</a>&nbsp;&nbsp;<a href='javascript:void(0)' onclick='cloesedialog();' class='btn btn-11'><s></s>" + Tag("关闭") + "</a></div>";
            }
            Response.Write("{\"msg\":\"OK\",\"count\":\"" + Basket_Product_Count() + "\",\"amount\":\"" + FormatMoney(Basket_Product_Price()) + "\",\"mes\":\"" + mes + "\",\"url\":\"" + URL("P_AddToBasket", "") + "\"}");
        }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     pid              = RequestTool.RequestInt("pid", 0);
     tid              = RequestTool.RequestInt("tid", 0);
     randnum          = RequestTool.RequestInt("randnum", 0);
     mutiadd_property = RequestTool.RequestInt("mutiadd_property", 0); //1批量添加规格 0否
     if (pid == 0 || (pid > 0 && randnum > 0))
     {
         if (!EX_Admin.Power("product_add", "添加商品"))
         {
             WindowNoPower();
         }
     }
     else
     {
         if (!EX_Admin.Power("product_edit", "编辑商品"))
         {
             WindowNoPower();
         }
     }
     if (pid > 0 && randnum > 0)
     {
         modelp = B_Lebi_Product.GetModel(randnum);
     }
     else
     {
         modelp = B_Lebi_Product.GetModel(pid);
     }
     if (modelp == null)
     {
         modelp = new Lebi_Product();
         modelp.ProPertyMain = RequestTool.RequestInt("ProPertyMain", 0);
         modelp.ProPerty131  = RequestTool.RequestString("ProPerty131");
     }
     modelLan     = Language.DefaultLanguage();
     string where = "";
     if (pid == 0 || (pid > 0 && randnum > 0))
     {
         where = "Product_id=" + randnum + " and Product_id!=0";
     }
     else
     {
         where = "Product_id=" + pid + " and Product_id!=0";
     }
     models = B_Lebi_Product.GetList(where, "");
 }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     pid     = RequestTool.RequestInt("pid", 0);
     tid     = RequestTool.RequestInt("tid", 0);
     randnum = RequestTool.RequestInt("randnum", 0);
     if (pid == 0 || (pid > 0 && randnum > 0))
     {
         if (!Power("supplier_product_add", "添加商品"))
         {
             WindowNoPower();
         }
     }
     else
     {
         if (!Power("supplier_product_edit", "编辑商品"))
         {
             WindowNoPower();
         }
     }
     if (pid > 0 && randnum > 0)
     {
         modelp = B_Lebi_Product.GetModel("(IsDel!=1 or IsDel is null) and Supplier_id = " + CurrentSupplier.id + " and id = " + randnum);
     }
     else
     {
         modelp = B_Lebi_Product.GetModel("(IsDel!=1 or IsDel is null) and Supplier_id = " + CurrentSupplier.id + " and id = " + pid);
     }
     if (modelp == null)
     {
         modelp = new Lebi_Product();
         modelp.ProPertyMain = RequestTool.RequestInt("ProPertyMain", 0);
         modelp.ProPerty131  = RequestTool.RequestString("ProPerty131");
     }
     modelLan     = Language.DefaultLanguage();
     string where = "(IsDel!=1 or IsDel is null)";
     if (pid == 0 || (pid > 0 && randnum > 0))
     {
         where += " and Supplier_id = " + CurrentSupplier.id + " and Product_id=" + randnum + " and Product_id!=0";
     }
     else
     {
         where += " and Product_id=" + pid + " and Product_id!=0";
     }
     models = B_Lebi_Product.GetList(where, "");
 }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Random Random = new Random();

            randnum = RequestTool.RequestInt("randnum", 0);
            id      = RequestTool.RequestInt("id", 0);
            if (id == 0 || (id > 0 && randnum > 0))
            {
                if (!Power("supplier_product_add", "添加商品"))
                {
                    PageNoPower();
                }
            }
            else
            {
                if (!Power("supplier_product_edit", "编辑商品"))
                {
                    PageNoPower();
                }
            }
            action = RequestTool.RequestInt("action", 1);
            model  = B_Lebi_Product.GetModel("Supplier_id = " + CurrentSupplier.id + " and (IsDel!=1 or IsDel is null) and id = " + id);
            if (model == null)
            {
                model = new Lebi_Product();
                model.Type_id_ProductType = 320;
            }
            wap        = Ishavewap();
            StepPrices = EX_Product.StepPrice(model.StepPrice);
            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
            if (UserLevelPrices == null)
            {
                UserLevelPrices = new List <ProductUserLevelPrice>();
            }
            UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
            if (UserLevelCounts == null)
            {
                UserLevelCounts = new List <ProductUserLevelCount>();
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
        }
Esempio n. 8
0
        public void LoadPage()
        {
            LoadTheme();
            PageSize = RequestTool.RequestInt("Count", 20);
            id       = RequestTool.RequestInt("id", 0);
            tag      = RequestTool.RequestString("tag");
            tag      = tag.Replace(",", ",");
            if (tag == "" || tag == null)
            {
                tag = "NO TAGS";
            }
            string where = "";
            if (tag.IndexOf(",") > -1)
            {
                string[] tagsArr;
                tagsArr = tag.Split(new char[1] {
                    ','
                });
                foreach (string tags in tagsArr)
                {
                    if (where == "")
                    {
                        where = "Name like lbsql{'%" + tags + "%'}";
                    }
                    else
                    {
                        where += " or Name like lbsql{'%" + tags + "%'}";
                    }
                }
            }
            else
            {
                where = "Name like lbsql{'%" + tag + "%'}";
            }
            where = " (" + where + ") and " + ProductWhere;
            //Response.Write(where);

            //Response.End();
            //return;

            LB.DataAccess.SQLPara sp = new LB.DataAccess.SQLPara(where, " Sort desc,id desc", "*");
            products = B_Lebi_Product.GetList(sp, PageSize, pageindex);
        }
Esempio n. 9
0
        /// <summary>
        /// 发表商品咨询
        /// </summary>
        public void Ask_Write()
        {
            int          id         = RequestTool.RequestInt("id", 0);
            int          Product_id = 0;
            Lebi_Product product    = B_Lebi_Product.GetModel(id);

            if (product != null)
            {
                Product_id = product.Product_id;
            }
            Lebi_Comment model = new Lebi_Comment();

            model.TableName      = "Product_Ask";
            model.Keyid          = id;
            model.Admin_UserName = "******";
            model.Admin_id       = 0;
            model.User_id        = CurrentUser.id;
            model.User_UserName  = CurrentUser.UserName;
            model.Content        = RequestTool.RequestSafeString("Content");
            model.Star           = 0;
            model.Parentid       = 0;
            model.Status         = 282; //283已回复
            model.Time_Add       = System.DateTime.Now;
            model.Language_Code  = CurrentLanguage.Code;
            model.Product_id     = Product_id;
            model.IsRead         = 1;
            model.Supplier_id    = product.Supplier_id;
            if (!Comment.CheckSafeWord(model.Content))
            {
                Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}");
                return;
            }
            B_Lebi_Comment.Add(model);
            //发送邮件
            Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id);

            Email.SendEmail_ask(user, model);
            //发送短信
            SMS.SendSMS_ask(user, model);
            Response.Write("{\"msg\":\"OK\"}");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("product_user_price", "商品会员价格"))
            {
                WindowNoPower();
            }
            userlevelid = RequestTool.RequestInt("userlevelid");
            userid      = RequestTool.RequestInt("userid");
            productid   = RequestTool.RequestInt("productid");
            key         = RequestTool.RequestString("key");
            userlevel   = B_Lebi_UserLevel.GetModel(userlevelid);
            product     = B_Lebi_Product.GetModel(productid);
            if (product == null)
            {
                product = new Lebi_Product();
            }
            if (userlevel == null)
            {
                userlevel = new Lebi_UserLevel();
            }
            string where = "IsAnonymous<>1";
            if (key != "")
            {
                where += " and (UserName like '%" + key + "%' or RealName like '%" + key + "%' or NickName like '%" + key + "%')";
            }
            if (userlevelid > 0)
            {
                where += " and UserLevel_id =" + userlevelid + "";
            }
            PageSize = RequestTool.getpageSize(10);
            int recordCount = B_Lebi_User.Counts(where);

            PageString = Pager.GetPaginationStringForJS("reloadproducts({0},'" + key + "'," + userlevel.id + ");", page, PageSize, recordCount);
            users      = B_Lebi_User.GetList(where, "", PageSize, page);

            userlevellimit = B_Lebi_Product_Price.GetModel("Product_id=" + product.id + "");
            if (userlevellimit == null)
            {
                userlevellimit = new Lebi_Product_Price();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("product_edit", "编辑商品"))
            {
                WindowNoPower();
            }
            Number = RequestTool.RequestString("Number");
            string       sql      = "";
            Lebi_Product pro      = B_Lebi_Product.GetModel("Number = lbsql{'" + Number + "'}");
            int          SonCount = B_Lebi_Product.Counts("Product_id = " + pro.id + "");

            if (SonCount == 0)
            {
                sql = "Product_Number = lbsql{'" + Number + "'}";
            }
            else
            {
                sql = "Product_Number in (select Lebi_Product.Number from Lebi_Product where Lebi_Product.Product_id = " + pro.id + ")";
            }
            pros = B_Lebi_Order_Product.GetList("" + sql + " and Order_id in(select Lebi_Order.id from Lebi_Order where Lebi_Order_Product.Order_id = Lebi_Order.id and Lebi_Order.Type_id_OrderType=211 and Lebi_Order.IsCompleted = 1)", "");
        }
Esempio n. 12
0
        private void Reset_Count_Freeze()
        {
            string ProductStockFreezeTime = ShopCache.GetBaseConfig().ProductStockFreezeTime;
            List <Lebi_Product> parents   = B_Lebi_Product.GetList("Product_id = 0", "");

            foreach (Lebi_Product parent in parents)
            {
                List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id = " + parent.id + "", "");
                if (pros.Count > 0)
                {
                    foreach (Lebi_Product pro in pros)
                    {
                        EX_Product.Reset_Count_Freeze(pro);
                    }
                }
                else
                {
                    EX_Product.Reset_Count_Freeze(parent);
                }
            }
        }
Esempio n. 13
0
 public static int TypeProductCount(int supplier_id, int id)
 {
     string where = "Product_id=0 and Supplier_id = " + supplier_id + "";
     if (id > 0)
     {
         if (DataBase.DBType == "sqlserver")
         {
             where += " and Charindex('," + id + ",',','+Supplier_ProductType_ids+',')>0";
         }
         if (DataBase.DBType == "access")
         {
             where += " and Instr(','+Supplier_ProductType_ids+',','," + id + ",')>0";
         }
     }
     else
     {
         where += " and Supplier_ProductType_ids = ''";
     }
     return(B_Lebi_Product.Counts(where));
     //return TypeIds(id);
 }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int    orderid = RequestTool.RequestInt("orderid", 0);
            int    id      = RequestTool.RequestInt("id", 0);
            string pnumber = RequestTool.RequestString("pnumber").Trim();

            order        = B_Lebi_Order.GetModel(orderid);
            orderproduct = B_Lebi_Order_Product.GetModel(id);
            if (orderproduct == null)
            {
                product      = B_Lebi_Product.GetModel("Number=lbsql{'" + pnumber + "'} order by id desc");
                orderproduct = new Lebi_Order_Product();
            }
            else
            {
                product = B_Lebi_Product.GetModel(orderproduct.Product_id);
            }
            if (order == null || product == null)
            {
                Response.Write(Tag("参数错误"));
                Response.End();
                return;
            }
            //int pid = product.Product_id == 0 ? product.id : product.Product_id;
            if (product.Product_id > 0)
            {
                models = B_Lebi_Product.GetList("Product_id=" + product.Product_id + "", "");
            }
            else
            {
                models = B_Lebi_Product.GetList("Product_id=" + product.id + "", "");
                if (models.Count == 0)
                {
                    models = new List <Lebi_Product>();
                    models.Add(product);
                }
            }
        }
Esempio n. 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("product_user_limit", "商品会员权限"))
            {
                WindowNoPower();
            }
            userlevelid = RequestTool.RequestInt("userlevelid");
            userid      = RequestTool.RequestInt("userid");
            typeid      = RequestTool.RequestInt("typeid");
            showall     = RequestTool.RequestInt("showall");
            key         = RequestTool.RequestString("key");
            user        = B_Lebi_User.GetModel(userid);
            userlevel   = B_Lebi_UserLevel.GetModel(userlevelid);
            if (user == null)
            {
                user = new Lebi_User();
            }
            if (userlevel == null)
            {
                userlevel = new Lebi_UserLevel();
            }
            string where = "Product_id=0 and (IsDel!=1 or IsDel is null)";
            if (key != "")
            {
                where += " and (Name like '%" + key + "%' or Number like '%" + key + "%' or Code like '%" + key + "%')";
            }
            if (typeid > 0)
            {
                string tids = EX_Product.TypeIds(typeid);
                where += " and Pro_Type_id in (" + tids + ")";
            }

            PageSize = RequestTool.getpageSize(10);
            int recordCount = B_Lebi_Product.Counts(where);

            PageString = Pager.GetPaginationStringForJS("reloadproducts({0}," + typeid + ",'" + key + "'," + user.id + "," + userlevel.id + ");", page, PageSize, recordCount);
            products   = B_Lebi_Product.GetList(where, "", PageSize, page);
        }
Esempio n. 16
0
        /// <summary>
        /// 同步库存
        /// </summary>
        public void mUpdateStock()
        {
            //mType	请求类别,同步库存时,该值为“mUpdateStock”。
            //GoodsNO	货品编号
            //BarCode	货品条码(主条码)
            //Stock	库存量
            string       GoodsNO = RequestTool.RequestString("GoodsNO");
            int          Stock   = RequestTool.RequestInt("Stock");
            string       res     = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
            Lebi_Product product = B_Lebi_Product.GetModel("Number=lbsql{'" + GoodsNO + "'}");

            if (product == null)
            {
                res += "<rsp><result>0</result><cause>无此商品</cause></rsp>";
                Response.Write(res);
            }
            product.Count_Stock = Stock;
            B_Lebi_Product.Update(product);
            if (product.Product_id > 0)
            {
                //子商品库存变更,修改父商品库存
                Lebi_Product model = B_Lebi_Product.GetModel(product.Product_id);
                if (model != null)
                {
                    List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id=" + model.id + "", "");
                    int count = 0;
                    foreach (Lebi_Product pro in pros)
                    {
                        count = count + pro.Count_Stock;
                    }
                    model.Count_Stock = count;
                    B_Lebi_Product.Update(model);
                }
            }
            res += "<rsp><result>1</result></rsp>";
            Log.Add("商品编码:" + GoodsNO + "数量:" + Stock + "--" + res, "网店管家同步库存", "");
            Response.Write(res);
        }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int tid = RequestTool.RequestInt("tid", 0);
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Product.GetModel(pid);
            if (model == null)
            {
                model = new Lebi_Product();
            }
            //Lebi_ProPerty_Type ptype = B_Lebi_ProPerty_Type.GetModel(tid);
            string property = EX_Product.ProductType_ProPertystr(tid, CurrentSupplier.id);

            if (property != "")
            {
                pros = B_Lebi_ProPerty.GetList("Type_id_ProPertyType in (132,133) and id in (" + property + ")", "Sort desc");
            }
            if (pros == null)
            {
                pros = new List <Lebi_ProPerty>();
            }
            ProPerty133 = Common.KeyValueToList(model.ProPerty133);
        }
Esempio n. 18
0
        /// <summary>
        /// 条形码
        /// </summary>
        public void ProductCode()
        {
            string lang = RequestTool.RequestSafeString("lang", "CN");
            string Code = RequestTool.RequestSafeString("Code");
            JavaScriptSerializer jss = new JavaScriptSerializer();
            LBAPI        api         = new LBAPI();
            Lebi_Product pro         = B_Lebi_Product.GetModel("Code=lbsql{'" + Code + "'}");

            if (pro != null)
            {
                api.data = Shop.Bussiness.ThemeUrl.GetURL("P_Product", pro.id.ToString(), "", lang);
                api.msg  = "OK";
                //Response.Write("{\"msg\":\"OK\",\"url\":\"" + Shop.Bussiness.ThemeUrl.GetURL("P_Product", pro.id.ToString(), "", lang) + "\"}");
            }
            else
            {
                api.msg = Tag("未找到商品");
                //Response.Write("{\"msg\":\"" + Tag("未找到商品") + "\"}");
            }
            string json = jss.Serialize(api);

            SystemLog.Add(json);
            Response.Write(json);
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            id     = RequestTool.RequestInt("id", 0);
            modelp = B_Lebi_Product.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + id);
            if (modelp == null)
            {
                modelp = new Lebi_Product();
                modelp.ProPertyMain = RequestTool.RequestInt("ProPertyMain", 0);
                modelp.ProPerty131  = RequestTool.RequestString("ProPerty131");
            }
            if (!Power("supplier_product_edit", "编辑商品"))
            {
                WindowNoPower();
            }
            string property = EX_Product.ProductType_ProPertystr(modelp.Pro_Type_id);

            if (property != "")
            {
                try
                {
                    ggs = B_Lebi_ProPerty.GetList("Type_id_ProPertyType=131 and id in (lbsql{" + property + "})", "Sort desc");
                }
                catch (System.Data.SqlClient.SqlException)
                {
                    ggs = new List <Lebi_ProPerty>();
                }
            }
            if (ggs == null)
            {
                ggs = new List <Lebi_ProPerty>();
            }
            modelLan     = Language.DefaultLanguage();
            string where = "";
            where        = "Product_id=" + id + " and Product_id!=0 and (IsDel!=1 or IsDel is null)";
            models       = B_Lebi_Product.GetList(where, "");
        }
Esempio n. 20
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Exchange'");
            list        = Rstring_Para("0");
            sort        = Rstring_Para("1");
            pageindex   = RequestTool.RequestInt("page", 1);
            path        = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a class=\"text\"><span>" + Tag("积分兑换") + "</span></a>";
            where       = ProductWhere + " and Type_id_ProductType = 323 and (Time_Start < '" + FormatTime(System.DateTime.Now) + "' and Time_Expired > '" + FormatTime(System.DateTime.Now) + "')";
            if (sort == "1")
            {
                order = " Count_Sales desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple("?page={0}&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage);
            NextPage = "?page=" + (pageindex + 1) + "&sort=" + sort + "&list=" + list + "";
        }
Esempio n. 21
0
        /// <summary>
        /// 生成新订单
        /// </summary>
        public void order_save()
        {
            if (CurrentUserLevel.BuyRight != 1)
            {
                Response.Write("{\"msg\":\"" + Tag("您所在的分组不允许下单") + "\"}");
                return;
            }
            int         pay_id        = RequestTool.RequestInt("pay_id", 0);
            int         sid           = RequestTool.RequestInt("sid", 0);//结算供应商ID
            int         onlinepay_id  = RequestTool.RequestInt("onlinepay_id", 0);
            decimal     Money_UserCut = RequestTool.RequestDecimal("Money_UserCut", 0);
            int         usermoneytype = RequestTool.RequestInt("usermoneytype", 0);
            string      Pay_Password  = RequestTool.RequestSafeString("Pay_Password");
            Lebi_PickUp pick          = null;
            DateTime    pickdate      = System.DateTime.Now;

            if (usermoneytype == 3)
            {
                if (Pay_Password == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("请输入支付密码") + "\"}");
                    return;
                }
                else
                {
                    if (EX_User.MD5(Pay_Password) != CurrentUser.Pay_Password)
                    {
                        Response.Write("{\"msg\":\"" + Tag("支付密码不正确") + "\"}");
                        return;
                    }
                }
                if (Money_UserCut > 0 && Money_UserCut > CurrentUser.Money)
                {
                    Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                    return;
                }
            }
            Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id);

            if (pay == null)
            {
                Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}");
                return;
            }
            Basket  basket             = new Basket(sid);
            int     CustomOfflineMoney = RequestTool.RequestInt("CustomOfflineMoney" + pay.id, 0);
            decimal OfflineMoney       = RequestTool.RequestDecimal("OfflineMoney" + pay.id, 0);

            if (CustomOfflineMoney == 1)
            {
                if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay")
                {
                    //订单如果选择了线下支付,并且非货到付款
                    if (OfflineMoney < basket.Money_Product)
                    {
                        Response.Write("{\"msg\":\"" + Tag("打款金额不能少于订单金额") + "\"}");
                        return;
                    }
                }
            }
            if (pay.Code == "OnlinePay")
            {
                Lebi_OnlinePay onpay = B_Lebi_OnlinePay.GetModel(onlinepay_id);
                if (onpay == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}");
                    return;
                }
            }

            if (basket.Products.Count == 0)
            {
                Response.Write("{\"msg\":\"" + Tag("购物车为空") + "\"}");
                return;
            }
            foreach (Lebi_User_Product up in basket.Products)
            {
                if (up.count < 1)
                {
                    Response.Write("{\"msg\":\"" + Tag("购物车异常") + "\"}");
                    return;
                }
            }
            if (basket.Point_Buy > 0 && (basket.Point_Buy > CurrentUser.Point))
            {
                Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}");
                return;
            }
            int ProductCount = 0;

            foreach (Lebi_User_Product up in basket.Products)
            {
                Lebi_Product pro = B_Lebi_Product.GetModel(up.Product_id);
                if (pro.Type_id_ProductType != 323)
                {
                    ProductCount += up.count;
                }
                //<-{ 判断是否上架状态 by lebi.kingdge 2015-02-10
                if (pro.Type_id_ProductStatus != 101)
                {
                    Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经下架") + "\"}");
                    return;
                }
                //}->
                if (pro.Type_id_ProductType != 324)
                {
                    int levelcount = ProductLevelCount(pro);
                    if (up.count < levelcount)
                    {
                        Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("起订量") + " " + levelcount + "\"}");
                        return;
                    }
                }
                if (pro.Type_id_ProductType != 320 && pro.Time_Expired > System.DateTime.Now)
                {
                    if (pro.Count_Limit < up.count && pro.Count_Limit > 0)
                    {
                        Response.Write("{\"msg\":\"" + Tag("购买数量大于限购数量") + "\"}");
                        return;
                    }
                }
                if (SYS.IsNullStockSale != "1")
                {
                    if (pro.Count_Stock - pro.Count_Freeze < up.count && pro.Type_id_ProductType != 324)
                    {
                        Response.Write("{\"msg\":\"" + Lang(pro.Name) + "" + Tag("库存不足") + "\"}");
                        return;
                    }
                }
            }
            //验证当前分组允许的最低订单提交金额
            if (CurrentUserLevel.OrderSubmit > 0)
            {
                if (basket.Money_Product < CurrentUserLevel.OrderSubmit)
                {
                    Response.Write("{\"msg\":\"" + Tag("单笔订单最低金额为:") + FormatMoney(CurrentUserLevel.OrderSubmit) + "\"}");
                    return;
                }
            }
            //验证当前分组允许的最低订单提交数量
            if (CurrentUserLevel.OrderSubmitCount > 0 && ProductCount > 0)
            {
                if (ProductCount < CurrentUserLevel.OrderSubmitCount)
                {
                    Response.Write("{\"msg\":\"" + Tag("单笔订单最低数量为:") + CurrentUserLevel.OrderSubmitCount + "\"}");
                    return;
                }
            }
            Lebi_User_Address shouhuo = B_Lebi_User_Address.GetModel(CurrentUser.User_Address_id);

            if (shouhuo == null)
            {
                Response.Write("{\"msg\":\"" + Tag("未设置收获地址") + "\"}");
                return;
            }
            if (CurrentUser.Transport_Price_id == "")
            {
                Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                return;
            }

            foreach (BasketShop shop in basket.Shops)
            {
                Lebi_Transport_Price tprice = B_Lebi_Transport_Price.GetModel("id in (lbsql{" + CurrentUser.Transport_Price_id + "}) and Supplier_id=" + shop.Shop.id + "");
                if (tprice == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                    return;
                }
                Lebi_Transport transport = B_Lebi_Transport.GetModel(tprice.Transport_id);
                if (tprice == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                    return;
                }
                //检查运费设置是否正确
                if (!EX_Area.CheckAreaPrice(tprice, shouhuo.Area_id))
                {
                    Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}");
                    return;
                }
                if (transport.Type_id_TransportType == 332)//自提检查
                {
                    int    pickup_id = RequestTool.RequestInt("pickup_id" + shop.Shop.id);
                    string pickdate_ = RequestTool.RequestString("pickupdate_" + pickup_id);

                    try
                    {
                        pickdate = Convert.ToDateTime(pickdate_);
                    }
                    catch
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }

                    pick = B_Lebi_PickUp.GetModel(pickup_id);
                    if (pick == null)
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                    if (pick.IsCanWeekend == 0 && (pickdate.DayOfWeek == DayOfWeek.Saturday || pickdate.DayOfWeek == DayOfWeek.Sunday))
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                    if (System.DateTime.Now.Date.AddDays(pick.BeginDays) > pickdate)
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                    string NoServiceDays = pick.NoServiceDays.TrimStart('0').Replace(".0", ".");
                    string nowday        = pickdate.ToString("M.d");
                    if (("," + NoServiceDays + ",").Contains("," + nowday + ","))
                    {
                        Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}");
                        return;
                    }
                }
            }
            //检查代金券
            string pay312 = RequestTool.RequestSafeString("pay312");

            if (pay312 != "")
            {
                List <Lebi_Card> cs = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + pay312 + "})", "id asc");
                int flag            = cs.FirstOrDefault().IsCanOtherUse;
                if (flag == 0 && cs.Count > 1)
                {
                    Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}");
                    return;
                }
                foreach (Lebi_Card c in cs)
                {
                    if (flag != c.IsCanOtherUse)
                    {
                        Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}");
                        return;
                    }
                    if (!Basket.CheckCard(basket, c))
                    {
                        Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}");
                        return;
                    }
                }
            }
            //检查代金券结束
            //检查发票信息
            int           billtype_id = RequestTool.RequestInt("billtype_id", 0);
            Lebi_BillType billtype    = B_Lebi_BillType.GetModel(billtype_id);

            if (ShopCache.GetBaseConfig().BillFlag == "1")
            {
                if (billtype == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("请设置发票内容") + "\"}");
                    return;
                }
            }
            CurrentUser.Pay_id       = pay.id;
            CurrentUser.OnlinePay_id = onlinepay_id;
            Lebi_Order        ordergroup;
            List <Lebi_Order> orders = Shop.Bussiness.Order.CreateOrder(CurrentUser, basket, shouhuo, billtype, CurrentCurrency, CurrentSite, CurrentLanguage, out ordergroup);

            CurrentUser.Count_Order = CurrentUser.Count_Order + orders.Count;
            B_Lebi_User.Update(CurrentUser);
            List <Lebi_Order> ordermodel = B_Lebi_Order.GetList("User_id=" + CurrentUser.id + "", "id desc");

            ordergroup = ordermodel.FirstOrDefault();
            if (OfflineMoney == 0)
            {
                OfflineMoney = ordergroup.Money_Order;
            }
            string remark = RequestTool.RequestSafeString("remark");

            ordergroup.Remark_User = remark;
            bool needupdate = false;

            if (remark != "")
            {
                Lebi_Comment model = new Lebi_Comment();
                model.Content       = remark;
                model.Keyid         = ordergroup.id;
                model.TableName     = "Order";
                model.User_id       = CurrentUser.id;
                model.User_UserName = CurrentUser.UserName;
                B_Lebi_Comment.Add(model);
                needupdate = true;
            }

            if (pick != null)
            {
                ordergroup.PickUp_Date = pickdate;
                ordergroup.PickUp_id   = pick.id;
                ordergroup.PickUp_Name = pick.Name;
                needupdate             = true;
            }
            if (needupdate)
            {
                B_Lebi_Order.Update(ordergroup);
            }

            if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay")
            {
                //订单如果选择了线下支付,并且非货到付款
                //生成一笔充值单
                //OfflineMoney

                Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1");
                if (DefaultCurrency == null)
                {
                    DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault();
                }
                Lebi_Order order = new Lebi_Order();
                order.Code                  = "M" + Shop.Bussiness.Order.CreateOrderCode();
                order.Money_Order           = OfflineMoney;
                order.Money_Pay             = OfflineMoney;
                order.User_id               = CurrentUser.id;
                order.User_UserName         = CurrentUser.UserName;
                order.IsPaid                = 0;
                order.Currency_Code         = ordergroup.Currency_Code;
                order.Currency_ExchangeRate = ordergroup.Currency_ExchangeRate;
                order.Currency_id           = ordergroup.Currency_id;
                order.Currency_Msige        = ordergroup.Currency_Msige;
                order.Type_id_OrderType     = 214;
                order.Pay_id                = pay.id;
                order.Pay          = pay.Name;
                order.Site_id      = CurrentSite.id;
                order.Language_id  = CurrentLanguage.id;
                order.Remark_Admin = "";
                order.Order_id     = ordergroup.id;
                B_Lebi_Order.Add(order);
            }
            //if (orders.Count == 1)
            //    ordergroup = orders.FirstOrDefault();
            //Shop.Bussiness.Order.SupplierOrder(order);//根据商品供应商分单
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + ordergroup.id + "\"}");
            return;
        }
Esempio n. 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Random Random = new Random();

            t     = RequestTool.RequestString("t");
            id    = RequestTool.RequestInt("id", 0);
            model = B_Lebi_Product.GetModel(id);
            int Type_id_ProductType = RequestTool.RequestInt("Type_id_ProductType", 320);

            if (id == 0 || (id > 0 && t == "copy"))
            {
                if (!EX_Admin.Power("product_add", "添加商品"))
                {
                    PageReturnMsg = PageNoPowerMsg();
                }
                ////如果添加商品时随机数小于9位数 重定向生成随机数 防止破坏已有数据
                //if (randnum.ToString().Length < 9)
                //{
                //    Response.Redirect(site.AdminPath + "/product/product_edit.aspx?id=" + id + "&t=" + t + "&randnum=" + Random.Next(100000000, 999999999));
                //    Response.End();
                //    return;
                //}
            }
            else
            {
                if (!EX_Admin.Power("product_edit", "编辑商品"))
                {
                    PageReturnMsg = PageNoPowerMsg();
                }
                if (site.SiteCount > 1 && CurrentAdmin.Site_ids != "" && model.Site_ids != "")
                {
                    string[] psids = model.Site_ids.Split(',');
                    bool     flag  = false;
                    foreach (string pdis in psids)
                    {
                        if (("," + CurrentAdmin.Site_ids + ",").Contains("," + pdis + ","))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        PageReturnMsg = PageErrorMsg();
                    }
                }
            }

            action = RequestTool.RequestInt("action", 1);

            if (model == null)
            {
                model                     = new Lebi_Product();
                model.Site_ids            = site.Sitesid();
                model.Type_id_ProductType = Type_id_ProductType;
                Lebi_Product modellast = B_Lebi_Product.GetModel("Type_id_ProductType = " + Type_id_ProductType + " and Supplier_id = 0 order by Time_Edit desc,id desc");
                if (modellast != null)
                {
                    model.Pro_Type_id = modellast.Pro_Type_id;
                }
            }
            else
            {
                if (t == "copy")
                {
                    model.id = 0;
                }
            }
            if (model.Images != "")
            {
                if (model.Images.Substring(model.Images.Length - 1, 1) == "@")
                {
                    model.Images = model.Images.Substring(0, model.Images.Length - 1);
                }
                if (model.Images.Substring(0, 1) != "@")
                {
                    model.Images = "@" + model.Images;
                }
            }
            StepPrices = EX_Product.StepPrice(model.StepPrice);
            if (StepPrices == null)
            {
                StepPrices = new List <ProductStepPrice>();
            }
            UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice);
            if (UserLevelPrices == null)
            {
                UserLevelPrices = new List <ProductUserLevelPrice>();
            }
            UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount);
            if (UserLevelCounts == null)
            {
                UserLevelCounts = new List <ProductUserLevelCount>();
            }
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
            wap        = Ishavewap();

            if (model.IsCombo == 1)
            {
                comboProducts = B_Lebi_Product_Combo.GetList("Product_id=" + model.id + "", "");
            }
            else
            {
                comboProducts = new List <Lebi_Product_Combo>();
            }
        }
Esempio n. 23
0
 public int CountSon(int pid)
 {
     return(B_Lebi_Product.Counts("Product_id=" + pid + " and Product_id<>0"));
 }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("product_batch_edit", "批量编辑"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            PageSize    = RequestTool.getpageSize(25);
            key         = RequestTool.RequestString("key");
            Pro_Type_id = RequestTool.RequestString("Pro_Type_id");
            status      = RequestTool.RequestInt("status", 0);
            brand       = RequestTool.RequestInt("brand", 0);
            tag         = RequestTool.RequestInt("tag", 0);
            dateFrom    = RequestTool.RequestString("dateFrom");
            dateTo      = RequestTool.RequestString("dateTo");
            OrderBy     = RequestTool.RequestString("OrderBy");
            lang        = RequestTool.RequestString("lang");
            DateTime lbsql_dateFrom = RequestTool.RequestDate("dateFrom");
            DateTime lbsql_dateTo   = RequestTool.RequestDate("dateTo");

            Type_id_ProductType = RequestTool.RequestInt("Type_id_ProductType", 320);
            if (lang == "")
            {
                lang = "CN";
            }
            string where = "Product_id=0 and (IsDel!=1 or IsDel is null)";
            if (Pro_Type_id != "")
            {
                where += " and Pro_Type_id in (" + Shop.Bussiness.EX_Product.Categoryid(Pro_Type_id) + ")";
            }
            if (status > 0)
            {
                where += " and Type_id_ProductStatus=" + status + "";
            }
            if (Type_id_ProductType > 0)
            {
                where += " and Type_id_ProductType=" + Type_id_ProductType + "";
            }
            if (tag > 0)
            {
                if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "sqlserver")
                {
                    where += " and Charindex('" + tag + "',Pro_Tag_id)>0";
                }
                else if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "access")
                {
                    where += " and Instr(Pro_Tag_id,'" + tag + "')>0";
                }
                else if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "mysql")
                {
                    where += " and Instr(Pro_Tag_id,'" + tag + "')>0";
                }
            }
            if (brand > 0)
            {
                where += " and Brand_id=" + brand + "";
            }
            if (key != "")
            {
                where += " and (Name like lbsql{'%" + key + "%'} or Number like lbsql{'%" + key + "%'})";
            }
            if (dateFrom != "" && dateTo != "")
            {
                where += " and Time_Add>='" + FormatDate(lbsql_dateFrom) + "' and Time_Add<='" + FormatDate(lbsql_dateTo) + " 23:59:59'";
            }

            if (!string.IsNullOrEmpty(EX_Admin.Project().Site_ids))
            {
                string[] arr      = EX_Admin.Project().Site_ids.Split(',');
                string   sonwhere = "";
                foreach (string sid in arr)
                {
                    if (sonwhere == "")
                    {
                        sonwhere = "','+Site_ids+',' like '%," + sid + ",%'";
                    }
                    else
                    {
                        sonwhere += " or ','+Site_ids+',' like '%," + sid + ",%'";
                    }
                }
                where += " and (" + sonwhere + " or Site_ids='')";
            }
            if (!string.IsNullOrEmpty(EX_Admin.Project().Pro_Type_ids))
            {
                string[] ids      = EX_Admin.Project().Pro_Type_ids.Split(',');
                string   sonwhere = "";
                foreach (string id in ids)
                {
                    sonwhere += " or Path like '%," + id + ",%'";
                }
                sonwhere = "select id from Lebi_Pro_Type where id in (" + EX_Admin.Project().Pro_Type_ids + ")" + sonwhere;
                where   += " and (Pro_Type_id in (" + sonwhere + ") or Pro_Type_id=0)";
            }
            if (!string.IsNullOrEmpty(EX_Admin.Project().Supplier_ids))
            {
                where += " and (Supplier_id in (" + EX_Admin.Project().Supplier_ids + "))";
            }
            //if (!string.IsNullOrEmpty(OrderBy))
            //{
            //    if (OrderBy.Contains("Desc"))
            //    {
            //        orderstr = " " + OrderBy.Substring(0, OrderBy.Length - 4) + " desc";
            //    }
            //    else
            //    {
            //        orderstr = " " + OrderBy.Substring(0, OrderBy.Length - 3) + " asc";
            //    }
            //}
            //else
            //{
            //    orderstr = " id desc";
            //}
            if (OrderBy == "StatusDesc")
            {
                orderstr = " Type_id_ProductStatus desc";
            }
            else if (OrderBy == "StatusAsc")
            {
                orderstr = " Type_id_ProductStatus asc";
            }
            else if (OrderBy == "ViewsDesc")
            {
                orderstr = " Count_Views desc";
            }
            else if (OrderBy == "ViewsAsc")
            {
                orderstr = " Count_Views asc";
            }
            else if (OrderBy == "SalesDesc")
            {
                orderstr = " Count_Sales desc";
            }
            else if (OrderBy == "SalesAsc")
            {
                orderstr = " Count_Sales asc";
            }
            else if (OrderBy == "CountDesc")
            {
                orderstr = " Count_Stock desc";
            }
            else if (OrderBy == "CountAsc")
            {
                orderstr = " Count_Stock asc";
            }
            else if (OrderBy == "Price_MarketDesc")
            {
                orderstr = " Price_Market desc";
            }
            else if (OrderBy == "Price_MarketAsc")
            {
                orderstr = " Price_Market asc";
            }
            else if (OrderBy == "Price_CostDesc")
            {
                orderstr = " Price_Cost desc";
            }
            else if (OrderBy == "Price_CostAsc")
            {
                orderstr = " Price_Cost asc";
            }
            else if (OrderBy == "PriceDesc")
            {
                orderstr = " Price desc";
            }
            else if (OrderBy == "PriceAsc")
            {
                orderstr = " Price asc";
            }
            else if (OrderBy == "FreezeDesc")
            {
                orderstr = " Count_Freeze desc";
            }
            else if (OrderBy == "FreezeAsc")
            {
                orderstr = " Count_Freeze asc";
            }
            else if (OrderBy == "SortDesc")
            {
                orderstr = " Sort desc";
            }
            else if (OrderBy == "SortAsc")
            {
                orderstr = " Sort asc";
            }
            else
            {
                orderstr = " id desc";
            }
            LB.DataAccess.SQLPara sp = new LB.DataAccess.SQLPara(where, orderstr, "*");
            models = B_Lebi_Product.GetList(sp, PageSize, page);
            int recordCount = B_Lebi_Product.Counts(sp);

            PageString = Pager.GetPaginationString("?page={0}&brand=" + brand + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "&key=" + key + "&lang=" + lang + "&OrderBy=" + OrderBy + "&Pro_Type_id=" + Pro_Type_id + "&status=" + status + "&Type_id_ProductType=" + Type_id_ProductType + "&tag=" + tag, page, PageSize, recordCount);
            userlevels = B_Lebi_UserLevel.GetList("", "Grade asc");
        }
Esempio n. 25
0
        /// <summary>
        /// 订单发货通知-不更新库存
        /// </summary>
        public void mSndGoods()
        {
            //OrderID	订单编号
            //OrderNO	原始订单编号
            //CustomerID	客户网名
            //SndStyle	发货方式
            //BillID	货运单号
            //SndDate	发货时间
            string             OrderID    = RequestTool.RequestString("OrderID");
            string             OrderNO    = RequestTool.RequestString("OrderNO");
            string             CustomerID = RequestTool.RequestString("CustomerID");
            string             SndStyle   = RequestTool.RequestString("SndStyle");
            string             BillID     = RequestTool.RequestString("BillID");
            string             SndDate    = RequestTool.RequestString("SndDate");
            Lebi_Order         model      = B_Lebi_Order.GetModel("Code=lbsql{'" + OrderNO + "'}");
            Lebi_Language_Code lang       = Language.DefaultLanguage();
            string             res        = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";

            if (model == null)
            {
                res += "<rsp><result>0</result><cause>无此单号</cause></rsp>";
                Response.Write(res);
                return;
            }

            Lebi_Transport tran = B_Lebi_Transport.GetModel("[Name]=lbsql{'" + SndStyle + "'}");

            if (tran == null)
            {
                tran = new Lebi_Transport();
            }
            Lebi_Transport_Order torder = new Lebi_Transport_Order();

            torder.Code     = BillID;
            torder.Order_id = model.id;

            torder.T_Address      = model.T_Address;
            torder.T_Email        = model.T_Email;
            torder.T_MobilePhone  = model.T_MobilePhone;
            torder.T_Name         = model.T_Name;
            torder.T_Phone        = model.T_Phone;
            torder.Transport_Code = tran == null ? model.Transport_Code : tran.Code;
            torder.Transport_id   = tran == null ? model.Transport_id : tran.id;
            torder.Transport_Name = tran == null ? model.Transport_Name : tran.Name;
            torder.User_id        = model.User_id;
            List <TransportProduct>   tps = new List <TransportProduct>();
            TransportProduct          tp;
            List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", "");
            bool isfahuo_all = true;

            foreach (Lebi_Order_Product pro in pros)
            {
                tp                = new TransportProduct();
                tp.Count          = pro.Count;
                tp.ImageBig       = pro.ImageBig;
                tp.ImageMedium    = pro.ImageMedium;
                tp.ImageOriginal  = pro.ImageOriginal;
                tp.ImageSmall     = pro.ImageSmall;
                tp.Product_Number = pro.Product_Number;
                tp.Product_id     = pro.Product_id;
                tp.Product_Name   = pro.Product_Name;
                tps.Add(tp);

                pro.Count_Shipped = pro.Count;

                B_Lebi_Order_Product.Update(pro);
                //更新库存
                Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id);
                EX_Product.ProductStock_Change(product, (0 - pro.Count), 302, model);
            }

            JavaScriptSerializer jss = new JavaScriptSerializer();

            torder.Product = jss.Serialize(tps);
            torder.Type_id_TransportOrderStatus = 220;//默认状态:在途
            B_Lebi_Transport_Order.Add(torder);
            model.IsShipped     = 1;
            model.IsShipped_All = isfahuo_all ? 1 : 0;
            model.Time_Shipped  = System.DateTime.Now;;
            B_Lebi_Order.Update(model);
            Log.Add("订单发货-网站管家", "Order", model.id.ToString());
            //发送邮件
            if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdanfahuo"))
            {
                Lebi_User user = B_Lebi_User.GetModel(model.User_id);
                Email.SendEmail_ordershipping(user, model, torder);
            }
            res += "<rsp><result>1</result></rsp>";
            Response.Write(res);
            Log.Add("订单编号:" + OrderNO + "--" + res, "网店管家同步发货", "");
        }
Esempio n. 26
0
        /// <summary>
        /// 订单下载,获得一个订单的详细信息
        /// </summary>
        public void mGetOrder()
        {
            string             OrderNO = RequestTool.RequestString("OrderNO");
            Lebi_Order         model   = B_Lebi_Order.GetModel("Code=lbsql{'" + OrderNO + "'}");
            Lebi_Language_Code lang    = Language.DefaultLanguage();

            if (model == null)
            {
                Response.Write("无此单号");
                return;
            }
            List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", "");
            StringBuilder             sb   = new System.Text.StringBuilder();

            sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
            sb.Append("<Order>\r\n");
            sb.Append("<Ver>2.0</Ver>\r\n");
            //OrderNO	订单号
            sb.Append("<OrderNO>" + model.Code + "</OrderNO>\r\n");
            //DateTime	成交日期
            sb.Append("<DateTime>" + model.Time_Add.ToString("yyyy-MM-dd HH:mm:ss") + "</DateTime>\r\n");
            //BuyerID	买家用户名
            sb.Append("<BuyerID>" + FormatXMLStr(model.User_UserName) + "</BuyerID>\r\n");
            //BuyerName	买家姓名
            sb.Append("<BuyerName>" + FormatXMLStr(model.T_Name) + "</BuyerName>\r\n");
            //Country	国家
            sb.Append("<Country>" + FormatXMLStr(EX_Area.GetAreaNameNoPath(model.T_Area_id, 4)) + "</Country>\r\n");
            //Province	省/州
            sb.Append("<Province>" + FormatXMLStr(EX_Area.GetAreaNameNoPath(model.T_Area_id, 3)) + "</Province>\r\n");
            //City	市/县
            sb.Append("<City>" + FormatXMLStr(EX_Area.GetAreaNameNoPath(model.T_Area_id, 2)) + "</City>\r\n");
            //Town	区/镇
            sb.Append("<Town>" + FormatXMLStr(EX_Area.GetAreaNameNoPath(model.T_Area_id, 1)) + "</Town>\r\n");
            //Adr	地址
            sb.Append("<Adr>" + FormatXMLStr(model.T_Address) + "</Adr>\r\n");
            //Zip	邮编
            sb.Append("<Zip>" + FormatXMLStr(model.T_Postalcode) + "</Zip>\r\n");
            //Email	Email
            sb.Append("<Email>" + FormatXMLStr(model.T_Email) + "</Email>\r\n");
            //Phone	联系电话
            sb.Append("<Phone>" + FormatXMLStr(model.T_MobilePhone) + "</Phone>\r\n");
            //Total	货款总额
            sb.Append("<Total>" + model.Money_Product + "</Total>\r\n");
            //Postage	货运费用
            sb.Append("<Postage>" + model.Money_Transport + "</Postage>\r\n");
            //PayAccount	支付方式
            sb.Append("<PayAccount>" + FormatXMLStr(Language.Content(model.Pay, lang.Code)) + "</PayAccount>\r\n");
            //PayID	支付编号
            sb.Append("<PayID></PayID>\r\n");
            //LogisticsName	发货方式
            sb.Append("<LogisticsName>" + FormatXMLStr(model.Transport_Name) + "</LogisticsName>\r\n");
            //Chargetype	结算方式
            sb.Append("<Chargetype>" + FormatXMLStr(Language.Content(model.OnlinePay, lang.Code)) + "</Chargetype>\r\n");
            //CustomerRemark	客户备注
            //发票信息

            sb.Append("<CustomerRemark>" + FormatXMLStr(model.Remark_User) + "</CustomerRemark>\r\n");
            //Remark	客服备注
            sb.Append("<Remark>" + FormatXMLStr(model.Remark_Admin) + "</Remark>\r\n");

            foreach (Lebi_Order_Product pro in pros)
            {
                Lebi_Product p = B_Lebi_Product.GetModel(pro.Product_id);
                if (p == null)
                {
                    continue;
                }
                sb.Append(" <Item>\r\n");
                //GoodsID	库存编码
                sb.Append(" <GoodsID>" + FormatXMLStr(pro.Product_Number) + "</GoodsID>\r\n");
                //GoodsName	货品名称
                sb.Append(" <GoodsName>" + FormatXMLStr(Language.Content(pro.Product_Name, lang.Code)) + "</GoodsName>\r\n");
                //GoodsSpec	货品规格
                //sb.Append(" <GoodsSpec>" + FormatXMLStr(EX_Product.ProPertyNameStr(p.ProPerty131, lang)) + "</GoodsSpec>\r\n");
                sb.Append(" <GoodsSpec></GoodsSpec>\r\n");//书生定制
                //Count	数量
                sb.Append(" <Count>" + pro.Count + "</Count>\r\n");
                //Price	单价
                sb.Append(" <Price>" + pro.Price + "</Price>\r\n");
                sb.Append(" </Item>\r\n");
            }


            sb.Append("</Order>\r\n");
            Log.Add(sb.ToString(), "网店管家下载订单", "");
            Response.Write(sb.ToString());
        }
Esempio n. 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("product_list", "商品列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            sp                  = new SearchProduct(CurrentAdmin, CurrentLanguage.Code);
            PageSize            = RequestTool.getpageSize(25);
            key                 = RequestTool.RequestString("key");
            Type_id_ProductType = RequestTool.RequestInt("Type_id_ProductType", 320);
            //Pro_Type_id = RequestTool.RequestString("Pro_Type_id");
            //status = RequestTool.RequestInt("status", 0);
            //brand = RequestTool.RequestInt("brand", 0);
            //tag = RequestTool.RequestInt("tag", 0);
            //dateFrom = RequestTool.RequestString("dateFrom");
            //dateTo = RequestTool.RequestString("dateTo");
            OrderBy = RequestTool.RequestString("OrderBy");
            //lang = RequestTool.RequestString("lang");
            //if (lang == "")
            //    lang = "CN";
            string where = "Product_id=0 and (IsDel!=1 or IsDel is null)";
            //if (Pro_Type_id != "")
            //    where += " and Pro_Type_id in (" + Shop.Bussiness.EX_Product.Categoryid(Pro_Type_id) + ")";
            //if (status > 0)
            //    where += " and Type_id_ProductStatus=" + status + "";
            //if (tag > 0)
            //    where += " and Pro_Tag_id=" + tag + "";
            //if (brand > 0)
            //    where += " and Brand_id=" + brand + "";
            if (key != "")
            {
                where += " and (Name like lbsql{'%" + key + "%'} or Number like lbsql{'%" + key + "%'} or Code like lbsql{'%" + key + "%'} or id like lbsql{'%" + key + "%'})";
            }
            //if (dateFrom != "" && dateTo != "")
            //    where += " and (datediff(d,Time_Add,'" + dateFrom + "')<=0 and datediff(d,Time_Add,'" + dateTo + "')>=0)";

            where += sp.SQL;
            if (domain3admin && CurrentAdmin.Site_ids != "")
            {
                string[] arr      = CurrentAdmin.Site_ids.Split(',');
                string   sonwhere = "";
                foreach (string sid in arr)
                {
                    if (sonwhere == "")
                    {
                        sonwhere = "','+Site_ids+',' like '%," + sid + ",%'";
                    }
                    else
                    {
                        sonwhere += " or ','+Site_ids+',' like '%," + sid + ",%'";
                    }
                }
                where += " and (" + sonwhere + " or Site_ids='')";
            }
            if (CurrentAdmin.Pro_Type_ids != "")
            {
                string[] ids      = CurrentAdmin.Pro_Type_ids.Split(',');
                string   sonwhere = "";
                foreach (string id in ids)
                {
                    sonwhere += " or Path like '%," + id + ",%'";
                }
                sonwhere = "select id from Lebi_Pro_Type where id in (" + CurrentAdmin.Pro_Type_ids + ")" + sonwhere;
                where   += " and (Pro_Type_id in (" + sonwhere + ") or Pro_Type_id=0)";
            }
            if (OrderBy == "StatusDesc")
            {
                orderstr = " Type_id_ProductStatus desc";
            }
            else if (OrderBy == "StatusAsc")
            {
                orderstr = " Type_id_ProductStatus asc";
            }
            else if (OrderBy == "ViewsDesc")
            {
                orderstr = " Count_Views desc";
            }
            else if (OrderBy == "ViewsAsc")
            {
                orderstr = " Count_Views asc";
            }
            else if (OrderBy == "SalesDesc")
            {
                orderstr = " Count_Sales desc";
            }
            else if (OrderBy == "SalesAsc")
            {
                orderstr = " Count_Sales asc";
            }
            else if (OrderBy == "CountDesc")
            {
                orderstr = " Count_Stock desc";
            }
            else if (OrderBy == "CountAsc")
            {
                orderstr = " Count_Stock asc";
            }
            else if (OrderBy == "Price_CostDesc")
            {
                orderstr = " Price_Cost desc";
            }
            else if (OrderBy == "Price_CostAsc")
            {
                orderstr = " Price_Cost asc";
            }
            else if (OrderBy == "PriceDesc")
            {
                orderstr = " Price desc";
            }
            else if (OrderBy == "PriceAsc")
            {
                orderstr = " Price asc";
            }
            else if (OrderBy == "FreezeDesc")
            {
                orderstr = " Count_Freeze desc";
            }
            else if (OrderBy == "FreezeAsc")
            {
                orderstr = " Count_Freeze asc";
            }
            else if (OrderBy == "SortDesc")
            {
                orderstr = " Sort desc";
            }
            else if (OrderBy == "SortAsc")
            {
                orderstr = " Sort asc";
            }
            else
            {
                orderstr = " id desc";
            }
            models = B_Lebi_Product.GetList(where, orderstr, PageSize, page);
            int recordCount = B_Lebi_Product.Counts(where);

            PageString = Pager.GetPaginationString("?page={0}&OrderBy=" + OrderBy + "&key=" + key + "&" + sp.URL, page, PageSize, recordCount);
            //Response.Write(where);
        }
Esempio n. 28
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopIndex";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = RequestTool.RequestInt("id", 0);          //商家ID
            cid       = RequestTool.RequestInt("cid", 0);         //商品分类
            list      = RequestTool.RequestString("list");        //列表或网格
            sort      = RequestTool.RequestString("sort");        //排序
            key       = RequestTool.RequestSafeString("keyword"); //关键词
            pageindex = RequestTool.RequestInt("page", 1);
            parentcid = 0;
            supplier  = B_Lebi_Supplier.GetModel("id = " + id);
            if (supplier == null)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int Supplier_id = supplier.User_id;

            if (cid != 0)
            {
                producttype = B_Lebi_Supplier_ProductType.GetModel(cid);
                if (producttype.parentid > 0)
                {
                    parentcid = producttype.parentid;
                }
                else
                {
                    parentcid = cid;
                }
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a>";

            where = ProductWhere + " and Supplier_id = " + id + "";
            if (cid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + cid + ",',','+Supplier_ProductType_ids+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Supplier_ProductType_ids+',','," + cid + ",')>0";
                }
            }
            if (key != "")
            {
                where += " and Name like '%" + key + "%'";
            }
            if (sort == "")
            {
                sort = "1";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ShopIndex", id + "," + cid + "," + list + "," + sort + ",{0}," + key + "");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
            NextPage = URL("P_ShopIndex", id + "," + cid + "," + list + "," + sort + "," + (pageindex + 1) + "," + key + "");
            string supplierservicepannelcon = supplier.ServicePanel;

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
            if (CurrentSite.IsMobile == 0)  //只针对PC站点 lebi.kingdge 2015-12-30
            {
                //跳转至设置的皮肤页面
                Lebi_Supplier_Skin skin = B_Lebi_Supplier_Skin.GetModel(supplier.Supplier_Skin_id);
                if (skin != null)
                {
                    string filename = HttpContext.Current.Request.Url.AbsolutePath.ToString().ToLower();
                    if (!filename.Contains("default" + skin.id + ".aspx"))
                    {
                        string tourl = Shop.Bussiness.Site.Instance.WebPath + "/" + CurrentLanguage.Path + "/shop/default" + skin.id + ".aspx?id=" + supplier.id + "&cid=" + cid + "&list=" + list + "&sort=" + sort + "&page=" + pageindex;
                        tourl = ThemeUrl.CheckPath(tourl);
                        Response.Redirect(tourl);
                        //Response.Write(tourl);
                    }
                }
            }
        }
Esempio n. 29
0
        /// <summary>
        /// 发表商品评价
        /// </summary>
        public void Comment_Write()
        {
            int id = RequestTool.RequestInt("id", 0);

            //int Product_id = 0;
            if (!Comment.CheckSafeWord(RequestTool.RequestSafeString("Content")))
            {
                Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}");
                return;
            }
            Lebi_Order_Product Order_Product = B_Lebi_Order_Product.GetModel("User_id=" + CurrentUser.id + " and id = " + id);

            if (Order_Product == null)
            {
                Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}");
                return;
            }
            else
            {
                Lebi_Order order = B_Lebi_Order.GetModel(Order_Product.Order_id);
                if (order == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("无效订单") + "\"}");
                    return;
                }
                else
                {
                    if (order.IsReceived == 0)
                    {
                        Response.Write("{\"msg\":\"" + Tag("已购买商品在已收货之后才可以发表评价") + "\"}");
                        return;
                    }
                }
                Order_Product.IsCommented = 1;
                B_Lebi_Order_Product.Update(Order_Product);
            }
            Lebi_Product checkproduct = B_Lebi_Product.GetModel(Order_Product.Product_id);

            if (checkproduct == null)
            {
                Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}");
                return;
            }
            Lebi_Comment model = new Lebi_Comment();

            model.TableName      = "Product";
            model.Keyid          = Order_Product.Product_id;
            model.Admin_UserName = "******";
            model.Admin_id       = 0;
            model.User_id        = CurrentUser.id;
            model.User_UserName  = CurrentUser.NickName;
            model.Content        = RequestTool.RequestSafeString("Content");
            model.Star           = RequestTool.RequestInt("Star", 5);
            model.Parentid       = 0;
            model.Status         = 280;
            model.Time_Add       = System.DateTime.Now;
            model.Language_Code  = CurrentLanguage.Code;
            model.Images         = RequestTool.RequestSafeString("Images");
            model.ImagesSmall    = RequestTool.RequestSafeString("ImagesSmall");
            model.Product_id     = Order_Product.Product_id;
            model.IsRead         = 1;
            model.Supplier_id    = checkproduct.Supplier_id;
            B_Lebi_Comment.Add(model);
            //List<Lebi_Order_Product> modelproducts = B_Lebi_Order_Product.GetList("User_id=" + CurrentUser.id + " and id = " + id + "", "");
            //foreach (Lebi_Order_Product modelproduct in modelproducts)
            //{
            //    modelproduct.IsCommented = 1;
            //    B_Lebi_Order_Product.Update(modelproduct);
            //}
            Lebi_Product product = B_Lebi_Product.GetModel(Order_Product.Product_id);

            if (product != null)
            {
                EX_Product.UpdateStar(product);
            }
            model.id = B_Lebi_Comment.GetMaxId();
            //处理图片
            ImageHelper.LebiImagesUsed(model.Images, "comment", model.id);
            //发送邮件
            Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id);

            Email.SendEmail_comment(user, model);
            //发送短信
            SMS.SendSMS_comment(user, model);
            Response.Write("{\"msg\":\"OK\"}");
        }
Esempio n. 30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("product_list", "商品列表"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }
            sp           = new SearchProduct(CurrentAdmin, CurrentLanguage.Code);
            PageSize     = RequestTool.getpageSize(25);
            key          = RequestTool.RequestSafeString("key");
            OrderBy      = RequestTool.RequestString("OrderBy");
            mode         = RequestTool.RequestString("mode");
            string where = "Product_id=0 and (IsDel!=1 or IsDel is null)";
            if (mode == "recycle")
            {
                where = "IsDel=1";
            }
            if (key != "")
            {
                where += " and (";
                where += " Name like lbsql{'%" + key + "%'} or Number like lbsql{'%" + key + "%'} or Code like lbsql{'%" + key + "%'} or id like lbsql{'%" + key + "%'}";
                List <Lebi_Product> parents = B_Lebi_Product.GetList("Number like lbsql{'%" + key + "%'} or Code like lbsql{'%" + key + "%'} or id like lbsql{'%" + key + "%'}", "");
                if (parents.Count > 0)
                {
                    foreach (Lebi_Product parent in parents)
                    {
                        where += " or id =" + parent.Product_id + "";
                    }
                }
                where += " )";
            }
            where += sp.SQL;
            if (mode != "recycle")
            {
                if (!string.IsNullOrEmpty(EX_Admin.Project().Site_ids))
                {
                    string[] arr      = EX_Admin.Project().Site_ids.Split(',');
                    string   sonwhere = "";
                    foreach (string sid in arr)
                    {
                        if (sonwhere == "")
                        {
                            sonwhere = "','+Site_ids+',' like '%," + sid + ",%'";
                        }
                        else
                        {
                            sonwhere += " or ','+Site_ids+',' like '%," + sid + ",%'";
                        }
                    }
                    where += " and (" + sonwhere + " or Site_ids='')";
                }
                if (!string.IsNullOrEmpty(EX_Admin.Project().Pro_Type_ids))
                {
                    string[] ids      = EX_Admin.Project().Pro_Type_ids.Split(',');
                    string   sonwhere = "";
                    foreach (string id in ids)
                    {
                        sonwhere += " or Path like '%," + id + ",%'";
                    }
                    sonwhere = "select id from Lebi_Pro_Type where id in (" + EX_Admin.Project().Pro_Type_ids + ")" + sonwhere;
                    where   += " and (Pro_Type_id in (" + sonwhere + "))";
                }
                if (!string.IsNullOrEmpty(EX_Admin.Project().Supplier_ids))
                {
                    where += " and (Supplier_id in (" + EX_Admin.Project().Supplier_ids + "))";
                }
            }
            if (OrderBy == "StatusDesc")
            {
                orderstr = " Type_id_ProductStatus desc";
            }
            else if (OrderBy == "StatusAsc")
            {
                orderstr = " Type_id_ProductStatus asc";
            }
            else if (OrderBy == "ViewsDesc")
            {
                orderstr = " Count_Views desc";
            }
            else if (OrderBy == "ViewsAsc")
            {
                orderstr = " Count_Views asc";
            }
            else if (OrderBy == "SalesDesc")
            {
                orderstr = " Count_Sales desc";
            }
            else if (OrderBy == "SalesAsc")
            {
                orderstr = " Count_Sales asc";
            }
            else if (OrderBy == "CountDesc")
            {
                orderstr = " (Count_Stock+Count_Freeze) desc";
            }
            else if (OrderBy == "CountAsc")
            {
                orderstr = " (Count_Stock+Count_Freeze) asc";
            }
            else if (OrderBy == "Price_CostDesc")
            {
                orderstr = " Price_Cost desc";
            }
            else if (OrderBy == "Price_CostAsc")
            {
                orderstr = " Price_Cost asc";
            }
            else if (OrderBy == "PriceDesc")
            {
                orderstr = " Price desc";
            }
            else if (OrderBy == "PriceAsc")
            {
                orderstr = " Price asc";
            }
            else if (OrderBy == "FreezeDesc")
            {
                orderstr = " Count_Freeze desc";
            }
            else if (OrderBy == "FreezeAsc")
            {
                orderstr = " Count_Freeze asc";
            }
            else if (OrderBy == "SortDesc")
            {
                orderstr = " Sort desc";
            }
            else if (OrderBy == "SortAsc")
            {
                orderstr = " Sort asc";
            }
            else
            {
                orderstr = " id desc";
            }
            models = B_Lebi_Product.GetList(where, orderstr, PageSize, page);
            int recordCount = B_Lebi_Product.Counts(where);

            PageString = Pager.GetPaginationString("?page={0}&OrderBy=" + OrderBy + "&key=" + key + "&mode=" + mode + "&" + sp.URL, page, PageSize, recordCount);
            //Response.Write(where);
        }