Пример #1
0
 /// <summary>
 /// 检查购物车是否满足代金券使用条件
 /// </summary>
 /// <param name="basket"></param>
 /// <param name="card"></param>
 /// <returns></returns>
 public static bool CheckCard(Basket basket, Lebi_Card card)
 {
     if (card.Time_Begin > System.DateTime.Now)
     {
         return(false);
     }
     if (card.Time_End <= System.DateTime.Now)
     {
         card.Type_id_CardStatus = 204;
         B_Lebi_Card.Update(card);
         return(false);
     }
     if ((basket.Money_Product - basket.Money_Cut) < card.Money_Buy)
     {
         return(false);
     }
     if (card.Pro_Type_ids == "")
     {
         return(true);
     }
     foreach (Lebi_User_Product p in basket.Products)
     {
         Lebi_Product  pro  = B_Lebi_Product.GetModel(p.Product_id);
         Lebi_Pro_Type type = EX_Product.TopProductType(pro);
         if (("," + card.Pro_Type_ids + ",").Contains("," + type.id + ","))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
        private string CreateProductTypeSelect(int id)
        {
            string        str  = "<select id=\"ProductType_" + id + "\" name=\"ProductType_" + id + "\" shop=\"true\" onchange=\"SelectProductType('ProductType_" + id + "');\">";
            Lebi_Pro_Type area = B_Lebi_Pro_Type.GetModel(id);

            if (area == null)
            {
                return("");
            }
            List <Lebi_Pro_Type> models = B_Lebi_Pro_Type.GetList("Parentid=" + area.Parentid + "", "Sort desc");

            if (models.Count == 0)
            {
                return("");
            }
            foreach (Lebi_Pro_Type model in models)
            {
                if (id == model.id)
                {
                    str += "<option value=\"" + model.id + "\" selected>" + Lang(model.Name) + "</option>";
                }
                else
                {
                    str += "<option value=\"" + model.id + "\">" + Lang(model.Name) + "</option>";
                }
            }
            str += "</select> ";
            str  = CreateProductTypeSelect(area.Parentid) + str;
            return(str);
        }
Пример #3
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            int id = Rint_Para("0");

            product = GetProduct(id);
            if (product.id == 0)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            PageSize = 20;
            pro_type = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type != null)
            {
                string[,] parr = Categorypath(pro_type.id);
                for (int i = 0; i <= parr.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>&raquo;</em>";
                }
            }
            path += "<a href=\"" + URL("P_Product", product.id) + "\"><span>" + Lang(product.Name) + "</span></a><em>&raquo;</em>";
            path += "<a><span>" + Tag("商品咨询") + "</span></a>";
        }
Пример #4
0
        /// <summary>
        /// 下载商品分类
        /// </summary>
        public void Taobao_category()
        {
            List <Lebi_Pro_Type> ts = Shop.LebiAPI.Service.Instanse.Taobao_ProType();

            if (ts == null)
            {
                Response.Write("{\"msg\":\"系统异常\"}");
            }
            else
            {
                List <Lebi_Pro_Type> parents = (from m in ts
                                                where m.Parentid == 0
                                                select m).ToList();
                foreach (Lebi_Pro_Type t in parents)
                {
                    int                  pid   = t.id;
                    Lebi_Pro_Type        model = DoOneCategory(t);
                    List <Lebi_Pro_Type> sons  = (from m in ts
                                                  where m.Parentid == pid
                                                  select m).ToList();
                    foreach (Lebi_Pro_Type sont in sons)
                    {
                        sont.Parentid = model.id;
                        DoOneCategory(sont);
                    }
                }
                ShopCache.SetProductType();
                Response.Write("{\"msg\":\"OK\"}");
            }
        }
Пример #5
0
        /// <summary>
        /// 某个商品分类的路径
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string Categorypath(int id)
        {
            Shop.Model.Lebi_Pro_Type pro_type = Shop.Bussiness.B_Lebi_Pro_Type.GetModel(id);
            if (pro_type == null)
            {
                pro_type = new Shop.Model.Lebi_Pro_Type();
            }
            string str = EX_Product.TypePath(pro_type, id.ToString());

            string[] arr = str.Split(',');
            string   res = "";

            for (int i = 0; i < arr.Length; i++)
            {
                Lebi_Pro_Type model = B_Lebi_Pro_Type.GetModel("id = " + int.Parse(arr[i]) + " and IsShow = 1");
                if (model == null)
                {
                    continue;
                }
                res += Lang(model.Name);
                if (i < arr.Length - 1)
                {
                    res += " &raquo; ";
                }
            }
            return(res);
        }
Пример #6
0
        public string tabname(int id)
        {
            Lebi_Pro_Type t = B_Lebi_Pro_Type.GetModel(id);

            if (t == null)
            {
                return("");
            }
            return(Language.Content(t.Name, CurrentLanguage.Code));
        }
Пример #7
0
        public string Categorypath_ids(int id)
        {
            Lebi_Pro_Type model = B_Lebi_Pro_Type.GetModel(id);
            string        str   = model.id.ToString();

            if (model.Parentid > 0)
            {
                str += "," + Categorypath_ids(model.Parentid);
            }
            return(str);
        }
Пример #8
0
        /// <summary>
        /// 处理一个商品分类
        /// </summary>
        private Lebi_Pro_Type DoOneCategory(Lebi_Pro_Type t)
        {
            Lebi_Pro_Type model = B_Lebi_Pro_Type.GetModel("taobaoid='" + t.taobaoid + "'");

            if (model == null)
            {
                model = t;
                if (t.ProPerty131 != "")
                {
                    List <Lebi_ProPerty> ps131 = B_Lebi_ProPerty.GetList("taobaoid in (" + t.ProPerty131 + ")", "");
                    if (ps131 != null)
                    {
                        string pid131 = "";
                        foreach (Lebi_ProPerty p131 in ps131)
                        {
                            if (pid131 == "")
                            {
                                pid131 = p131.id.ToString();
                            }
                            else
                            {
                                pid131 += "," + p131.id.ToString();
                            };
                        }
                        model.ProPerty131 = pid131;
                    }
                }
                if (t.ProPerty132 != "")
                {
                    List <Lebi_ProPerty> ps132 = B_Lebi_ProPerty.GetList("taobaoid in (" + t.ProPerty132 + ")", "");
                    if (ps132 != null)
                    {
                        string pid132 = "";
                        foreach (Lebi_ProPerty p132 in ps132)
                        {
                            if (pid132 == "")
                            {
                                pid132 = p132.id.ToString();
                            }
                            else
                            {
                                pid132 += "," + p132.id.ToString();
                            };
                        }
                        model.ProPerty132 = pid132;
                    }
                }
                B_Lebi_Pro_Type.Add(model);
                model.id = B_Lebi_Pro_Type.GetMaxId();
            }
            return(model);
        }
Пример #9
0
        /// <summary>
        /// 返回子分类
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List <Lebi_Pro_Type> Cateporys(int id)
        {
            List <Lebi_Pro_Type> models = EX_Product.ShowTypes(id, CurrentSite.id);

            if (models.Count == 0)
            {
                Lebi_Pro_Type m = B_Lebi_Pro_Type.GetModel(id);
                if (m.Parentid > 0)
                {
                    return(Cateporys(m.Parentid));
                }
            }
            return(models);
        }
Пример #10
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            int id = Rint_Para("0");

            comment = B_Lebi_Comment.GetModel(id);
            if (comment.id == 0)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            product      = GetProduct(comment.Keyid);
            string where = "Parentid =" + id;
            comments     = B_Lebi_Comment.GetList(where, "id desc", PageSize, pageindex);
            int recordCount = B_Lebi_Comment.Counts(where);

            PageString  = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id, pageindex, PageSize, recordCount, CurrentLanguage);
            ProductStar = Convert.ToInt32(product.Star_Comment);
            if (ProductStar > 5)
            {
                ProductStar = 5;
            }
            if (ProductStar < 0)
            {
                ProductStar = 0;
            }
            pro_type = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type != null)
            {
                string[,] parr = Categorypath(pro_type.id);
                for (int i = 0; i <= parr.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>&raquo;</em>";
                }
            }
            path += "<a href=\"" + URL("P_Product", product.id) + "\"><span>" + Lang(product.Name) + "</span></a><em>&raquo;</em>";
            path += "<a><span>" + Tag("晒单") + "</span></a>";
            //path += "<a href=\"" + URL("P_Product", id) + "\"><span>" + Lang(product.Name) + "</span></a>";

            smalls = comment.ImagesSmall.Split('@');
            bigs   = comment.Images.Split('@');
            if (bigs.Count() > 1)
            {
                DefaultImage = bigs[1];
            }

            productcomments = B_Lebi_Comment.GetList("TableName='Product' and Keyid=" + comment.Keyid + " and id!=" + comment.id + "", "id desc", 5, 1);
        }
Пример #11
0
        /// <summary>
        /// 某个商品分类的路径
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string[,] Categorypath(int id)
        {
            string str = Categorypath_ids(id);

            string[] arr = str.Split(',');
            string[,] res = new string[arr.Length, 2];
            for (int i = 0; i < arr.Length; i++)
            {
                Lebi_Pro_Type model = B_Lebi_Pro_Type.GetModel(int.Parse(arr[i]));
                int           j     = arr.Length - i - 1;
                res[j, 0] = model.id.ToString();
                res[j, 1] = Lang(model.Name);
            }
            return(res);
        }
Пример #12
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            int id = Rint_Para("0");

            product = GetProduct(id);
            if (product.id == 0)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            string where = "Parentid = 0 and TableName = 'Product' and (Keyid = " + id + "";
            if (product.Product_id != 0)
            {
                where += " or Product_id = " + product.Product_id + "";
            }
            where   += ") and (Status = 281 or User_id = " + CurrentUser.id + ")";
            comments = B_Lebi_Comment.GetList(where, "id desc", PageSize, pageindex);
            int recordCount = B_Lebi_Comment.Counts(where);

            PageString  = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id, pageindex, PageSize, recordCount, CurrentLanguage);
            NextPage    = "?page=" + (pageindex + 1) + "&id=" + id + "";
            ProductStar = Convert.ToInt32(product.Star_Comment);
            if (ProductStar > 5)
            {
                ProductStar = 5;
            }
            if (ProductStar < 0)
            {
                ProductStar = 0;
            }
            pro_type = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            path     = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type != null)
            {
                string[,] parr = Categorypath(pro_type.id);
                for (int i = 0; i <= parr.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>&raquo;</em>";
                }
            }
            path += "<a href=\"" + URL("P_Product", product.id) + "\"><span>" + Lang(product.Name) + "</span></a><em>&raquo;</em>";
            path += "<a><span>" + Tag("商品评论") + "</span></a>";
        }
Пример #13
0
        public void LoadPage()
        {
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Product'");
            int id = Rint("id");

            product = EX_Product.GetProduct(id);
            if (product.id == 0)
            {
                Response.End();
            }
            Protype = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            GetProWords();
            supplier = B_Lebi_Supplier.GetModel(product.Supplier_id);
            if (supplier == null)
            {
                supplier = new Lebi_Supplier();
            }
            product.IsSupplierTransport = supplier.IsSupplierTransport;
        }
Пример #14
0
        /// <summary>
        /// 某个商品分类的路径
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string[,] Categorypath(int id)
        {
            string str = Categorypath_ids(id);

            string[] arr = str.Split(',');
            string[,] res = new string[arr.Length, 3];
            for (int i = 0; i < arr.Length; i++)
            {
                Lebi_Pro_Type model = B_Lebi_Pro_Type.GetModel("id = " + int.Parse(arr[i]) + " and IsShow = 1");
                if (model == null)
                {
                    continue;
                }
                int j = arr.Length - i - 1;
                res[j, 0] = model.id.ToString();
                res[j, 1] = Lang(model.Name);
                res[j, 2] = Lang(model.Url);
            }
            return(res);
        }
Пример #15
0
        /// <summary>
        /// 生成商品分类选择框
        /// </summary>
        public void GetProductTypeList()
        {
            int id       = RequestTool.RequestInt("id", 0);
            int Parentid = 0;
            List <Lebi_Pro_Type> models = B_Lebi_Pro_Type.GetList("Parentid=" + id + "", "Sort desc");
            Lebi_Pro_Type        area   = B_Lebi_Pro_Type.GetModel(id);

            if (models.Count == 0)
            {
                if (area == null)
                {
                    Parentid = 0;
                }
                else
                {
                    Parentid = area.Parentid;
                }
                models = B_Lebi_Pro_Type.GetList("Parentid=" + Parentid + "", "Sort desc");
            }
            else
            {
                Parentid = id;
            }
            string str = "<select id=\"Pro_Type_id\" name=\"Pro_Type_id\" shop=\"true\" onchange=\"SelectProductType('Pro_Type_id');\">";

            str += "<option value=\"0\" selected>" + Tag(" 请选择 ") + "</option>";
            foreach (Lebi_Pro_Type model in models)
            {
                if (id == model.id)
                {
                    str += "<option value=\"" + model.id + "\" selected>" + Lang(model.Name) + "</option>";
                }
                else
                {
                    str += "<option value=\"" + model.id + "\">" + Lang(model.Name) + "</option>";
                }
            }
            str += "</select>";
            str  = CreateProductTypeSelect(Parentid) + str;
            Response.Write(str);
        }
Пример #16
0
        public string ThreadGetProductTypeList(int id, int Parentid)
        {
            List <Lebi_Pro_Type> models = B_Lebi_Pro_Type.GetList("Parentid=" + id + "", "Sort desc");
            Lebi_Pro_Type        area   = B_Lebi_Pro_Type.GetModel(id);

            if (models.Count == 0)
            {
                if (area == null)
                {
                    Parentid = 0;
                }
                else
                {
                    Parentid = area.Parentid;
                }
                models = B_Lebi_Pro_Type.GetList("Parentid=" + Parentid + "", "Sort desc");
            }
            else
            {
                Parentid = id;
            }
            string str = "<select id=\"Pro_Type_id\" name=\"Pro_Type_id\" shop=\"true\" onchange=\"SelectProductType('Pro_Type_id');\" class=\"form-control\">";

            str += "<option value=\"0\" selected>" + Tag(" 请选择 ") + "</option>";
            foreach (Lebi_Pro_Type model in models)
            {
                if (id == model.id)
                {
                    str += "<option value=\"" + model.id + "\" selected>" + Lang(model.Name) + "</option>";
                }
                else
                {
                    str += "<option value=\"" + model.id + "\">" + Lang(model.Name) + "</option>";
                }
            }
            str += "</select>";
            str  = CreateProductTypeSelect(Parentid) + str;
            return(str);
        }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            if (id == 0)
            {
                if (!EX_Admin.Power("pro_type_add", "添加商品分类"))
                {
                    PageNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("pro_type_edit", "编辑商品分类"))
                {
                    PageNoPower();
                }
            }
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Pro_Type.GetModel(id);
            if (model == null)
            {
                model             = new Lebi_Pro_Type();
                model.IsIndexShow = 1;
                model.IsShow      = 1;
                model.Site_ids    = site.Sitesid();
            }
            else
            {
                pid = model.Parentid;
            }
            pmodel = B_Lebi_Pro_Type.GetModel(pid);
            if (pmodel == null)
            {
                pmodel = new Lebi_Pro_Type();
            }
        }
Пример #18
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pageindex = RequestTool.RequestInt("page", 1);
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Product'");
            int id = Rint_Para("0");

            product = EX_Product.GetProduct(id);
            if (product.id == 0)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int num = 0;
            int Count_Views_Show = 0;

            if (SYS.ClickFlag == "0")
            {
                int.TryParse(SYS.ClickNum1, out num);
                Count_Views_Show = num;
            }
            else
            {
                int.TryParse(SYS.ClickNum2, out num);
                Random r = new Random();
                int    c = r.Next(1, num);
                Count_Views_Show = c;
            }
            string sql = "update [Lebi_Product] set Count_Views=Count_Views+1,Count_Views_Show=Count_Views_Show+" + Count_Views_Show + " where id=" + id + "";

            Common.ExecuteSql(sql);
            if (product.Product_id > 0)
            {
                sql = "update [Lebi_Product] set Count_Views=Count_Views+1,Count_Views_Show=Count_Views_Show+" + Count_Views_Show + " where Product_id=" + product.Product_id + "";
                Common.ExecuteSql(sql);
            }
            int DT_id = ShopPage.GetDT();

            if (DT_id > 0)
            {
                sql = "update [Lebi_DT_Product] set Count_Views=Count_Views+1,Count_Views_Show=Count_Views_Show+" + Count_Views_Show + " where DT_id = " + DT_id + " and Product_id=" + id + "";
                Common.ExecuteSql(sql);
                if (product.Product_id > 0)
                {
                    Common.ExecuteSql("update [Lebi_DT_Product] set Count_Views=Count_Views+1,Count_Views_Show=Count_Views_Show+" + Count_Views_Show + " where DT_id = " + DT_id + " and Product_id=" + product.Product_id + "");
                }
            }
            Protype = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id);
            images  = EX_Product.ProductImages(product, CurrentTheme);
            //===============================================================
            //处理规格选项
            //ProductProperty = Get_guige(product);
            //处理规格选项结束
            //==================================================================


            //添加访问记录
            int Product_id = product.Product_id == 0 ? product.id : product.Product_id;

            EX_User.UserProduct_Edit(CurrentUser, Product_id, 1, 143, "", 0, "");
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (product.Type_id_ProductType == 321)
            {
                path += "<a href=\"" + URL("P_LimitBuy", "") + "\"><span>" + Tag("限时抢购") + "</span></a><em>&raquo;</em>";
            }
            else if (product.Type_id_ProductType == 322)
            {
                path += "<a href=\"" + URL("P_GroupPurchase", "") + "\"><span>" + Tag("团购") + "</span></a><em>&raquo;</em>";
            }
            else if (product.Type_id_ProductType == 323)
            {
                path += "<a href=\"" + URL("P_Exchange", "") + "\"><span>" + Tag("积分换购") + "</span></a><em>&raquo;</em>";
            }
            else
            {
                if (Protype != null)
                {
                    string[,] parr = Categorypath(Protype.id);
                    for (int i = 0; i <= parr.GetUpperBound(0); i++)
                    {
                        path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>&raquo;</em>";
                    }
                }
            }
            path += "<a href=\"" + URL("P_Product", id) + "\"><span>" + Lang(product.Name) + "</span></a>";


            GetProWords();
            ProductStar = Convert.ToInt32(product.Star_Comment);
            if (ProductStar > 5)
            {
                ProductStar = 5;
            }
            if (ProductStar < 0)
            {
                ProductStar = 0;
            }
        }
Пример #19
0
        /// <summary>
        /// 处理添加一个商品
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        private Lebi_Product DoOneProduct(Lebi_Product pro)
        {
            Lebi_Pro_Type t   = new Lebi_Pro_Type();
            string        ids = pro.taobaoid_type;

            if (ids != "")
            {
                ids = "'0" + ids.Replace(",", "','") + "0'";
                List <Lebi_Pro_Type> models = B_Lebi_Pro_Type.GetList("taobaoid in (lbsql{" + ids + "})", "");
                t = models.FirstOrDefault();
            }

            if (t == null)
            {
                t = new Lebi_Pro_Type();
            }
            string p131ids = pro.ProPerty131;
            string p132ids = pro.ProPerty132;

            if (p131ids != "")
            {
                p131ids = "'" + p131ids.Replace(",", "','") + "'";
                List <Lebi_ProPerty> p131s = B_Lebi_ProPerty.GetList("taobaoid in (" + p131ids + ")", "");
                p131ids = "";
                foreach (Lebi_ProPerty p in p131s)
                {
                    if (p131ids == "")
                    {
                        p131ids = p.id.ToString();
                    }
                    else
                    {
                        p131ids += "," + p.id.ToString();
                    }
                }
            }
            if (p132ids != "")
            {
                p132ids = "'" + p132ids.Replace(",", "','") + "'";
                List <Lebi_ProPerty> p132s = B_Lebi_ProPerty.GetList("taobaoid in (" + p132ids + ")", "");
                p132ids = "";
                foreach (Lebi_ProPerty p in p132s)
                {
                    if (p132ids == "")
                    {
                        p132ids = p.id.ToString();
                    }
                    else
                    {
                        p132ids += "," + p.id.ToString();
                    }
                }
            }
            pro.ProPerty131 = p131ids;
            pro.ProPerty132 = p132ids;
            pro.Pro_Type_id = t.id;
            B_Lebi_Product.Add(pro);
            pro.id = B_Lebi_Product.GetMaxId();

            return(pro);
        }
Пример #20
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Pro_Type model)
 {
     D_Lebi_Pro_Type.Instance.Update(model);
 }
Пример #21
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Pro_Type model)
 {
     return(D_Lebi_Pro_Type.Instance.Add(model));
 }
Пример #22
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Pro_Type SafeBindForm(Lebi_Pro_Type model)
 {
     return(D_Lebi_Pro_Type.Instance.SafeBindForm(model));
 }
Пример #23
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = Rint_Para("0");    //商品分类
            pid       = Rint_Para("1");    //品牌
            cid       = Rstring_Para("2"); //属性
            list      = Rstring_Para("3"); //列表或网格
            sort      = Rstring_Para("4"); //排序
            tid       = Rint_Para("5");    //商品标签
            transport = Rint_Para("7");    //配送 0全部 1商城 2商家
            stock     = Rint_Para("8");    //是否有库存 1只显示有货
            pageindex = RequestTool.RequestInt("page", 1);
            pro_type  = B_Lebi_Pro_Type.GetModel(id);
            if (pro_type == null)
            {
                pro_type = new Lebi_Pro_Type();
            }
            if (Lang(pro_type.Url) != "")  //如果存在自定义URL 跳转至自定义URL by kingdge 2014-10-30
            {
                Response.Redirect(Lang(pro_type.Url));
                Response.End();
                return;
            }
            property = EX_Product.ProductType_ProPerty(pro_type);
            if (property == null)
            {
                property = new Lebi_Pro_Type(); property.ProPerty132 = "0";
            }
            if (property.ProPerty132 == "")
            {
                property.ProPerty132 = "0";
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em>";
            if (pro_type.id > 0)
            {
                CategoryPath = Categorypath(id);
                for (int i = 0; i <= CategoryPath.GetUpperBound(0); i++)
                {
                    path += "<a href=\"" + URL("P_ProductCategory", "" + CategoryPath[i, 0] + "", CategoryPath[i, 2]) + "\"><span>" + CategoryPath[i, 1] + "</span></a>";
                    if (i < CategoryPath.GetUpperBound(0))
                    {
                        path += "<em>&raquo;</em>";
                    }
                }
            }
            else if (tid == 0)
            {
                path += "<a href=\"" + URL("P_ProductCategory", "0") + "\"><span>" + Tag("商品列表") + "</span></a>";
            }
            if (tid > 0)
            {
                tag   = B_Lebi_Pro_Tag.GetModel(tid);
                path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + ",$,$,$,$," + tid + "") + "\"><span>" + Lang(tag.Name) + "</span></a>";
            }
            where = ProductWhere + " and Type_id_ProductType <> 323";
            if (pid > 0)
            {
                where += " and Brand_id=" + pid + "";
                brand  = B_Lebi_Brand.GetModel(pid);
                path  += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + ",$,$,$,$") + "\"><span>" + Lang(brand.Name) + "</span></a>";
            }
            if (cid != "")
            {
                where += " and " + Categorywhere(cid);
                string _cidlast = "";
                if (cid.IndexOf("$") > -1)
                {
                    string[] cidarr = cid.Split('$');
                    for (int i = 0; i < cidarr.Count(); i++)
                    {
                        if (cidarr[i].IndexOf("|") > -1)
                        {
                            string[] _cids = cidarr[i].Split('|');
                            _cidlast = _cids[1];
                            Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                            if (ProPerty != null)
                            {
                                path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>";
                            }
                        }
                    }
                }
                else
                {
                    if (cid.IndexOf("|") > -1)
                    {
                        string[] _cids = cid.Split('|');
                        _cidlast = _cids[1];
                        Lebi_ProPerty ProPerty = B_Lebi_ProPerty.GetModel(int.Parse(_cidlast));
                        if (ProPerty != null)
                        {
                            path += "<em>&raquo;</em><a href=\"" + URL("P_ProductCategory", "" + id + "," + pid + "," + ProPerty.parentid + "|" + ProPerty.id + ",$,$,$") + "\"><span>" + Lang(ProPerty.Name) + "</span></a>";
                        }
                    }
                }
            }
            if (id > 0)
            {
                where += " and " + CategoryWhere(id);
                //where += " and (Pro_Type_id in (" + Categorywhereforid(id) + ")";
                //if (DataBase.DBType == "sqlserver")
                //{
                //    where += " or Charindex('," + id + ",',','+Pro_Type_id_other+',')>0)";
                //}
                //if (DataBase.DBType == "access")
                //{
                //    where += " or Instr(','+Pro_Type_id_other+',','," + id + ",')>0)";
                //}
            }
            if (tid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + tid + ",',','+Pro_Tag_id+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Pro_Tag_id+',','," + tid + ",')>0";
                }
            }
            if (transport == 1)
            {
                where += " and IsSupplierTransport  = 0";
            }
            else if (transport == 2)
            {
                where += " and IsSupplierTransport  = 1";
            }
            if (stock == 1)
            {
                where += " and Count_Stock > 0";
            }
            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 if (sort == "6")
            {
                order = " Count_Stock desc"; ordertmp = "a";
            }
            else if (sort == "6a")
            {
                order = " Count_Stock asc"; ordertmp = "";
            }
            else
            {
                order = " Sort desc,id desc"; ordertmp = "";
            }
            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_ProductCategory", id + "," + pid + "," + cid + "," + list + "," + sort + "," + tid + ",{0}," + transport + "," + stock + "", Lang(pro_type.Url));

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
        }