Beispiel #1
0
        private string CreateSupplierProductTypeSelect(int supplierid, int id)
        {
            string str = "<select id=\"Supplier_ProductType_ids" + id + "\" name=\"Supplier_ProductType_ids" + id + "\" shop=\"true\" onchange=\"SelectSupplierProductType(" + supplierid + ",'Supplier_ProductType_ids" + id + "');\">";
            Lebi_Supplier_ProductType area = B_Lebi_Supplier_ProductType.GetModel(id);

            if (area == null)
            {
                return("");
            }
            List <Lebi_Supplier_ProductType> models = B_Lebi_Supplier_ProductType.GetList("Parentid=" + area.parentid + " and Supplier_id=" + supplierid + "", "Sort desc");

            if (models.Count == 0)
            {
                return("");
            }
            foreach (Lebi_Supplier_ProductType 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  = CreateSupplierProductTypeSelect(supplierid, area.parentid) + str;
            return(str);
        }
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_ProductType model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_ProductType](");
                strSql.Append("Name,ImageUrl,Sort,parentid,Url,Supplier_id)");
                strSql.Append(" values (");
                strSql.Append("@Name,@ImageUrl,@Sort,@parentid,@Url,@Supplier_id)");
                strSql.Append(";select @@IDENTITY");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@Name",        model.Name),
                    new SqlParameter("@ImageUrl",    model.ImageUrl),
                    new SqlParameter("@Sort",        model.Sort),
                    new SqlParameter("@parentid",    model.parentid),
                    new SqlParameter("@Url",         model.Url),
                    new SqlParameter("@Supplier_id", model.Supplier_id)
                };

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

                if (obj == null)
                {
                    return(1);
                }
                else
                {
                    return(Convert.ToInt32(obj));
                }
            }
            /// <summary>
            /// 对象实体绑定数据
            /// </summary>
            public Lebi_Supplier_ProductType ReaderBind(IDataReader dataReader)
            {
                Lebi_Supplier_ProductType model = new Lebi_Supplier_ProductType();
                object ojb;

                ojb = dataReader["id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.id = (int)ojb;
                }
                model.Name     = dataReader["Name"].ToString();
                model.ImageUrl = dataReader["ImageUrl"].ToString();
                ojb            = dataReader["Sort"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Sort = (int)ojb;
                }
                ojb = dataReader["parentid"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.parentid = (int)ojb;
                }
                model.Url = dataReader["Url"].ToString();
                ojb       = dataReader["Supplier_id"];
                if (ojb != null && ojb != DBNull.Value)
                {
                    model.Supplier_id = (int)ojb;
                }
                return(model);
            }
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_ProductType model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_ProductType] set ");
                strSql.Append("Name= @Name,");
                strSql.Append("ImageUrl= @ImageUrl,");
                strSql.Append("Sort= @Sort,");
                strSql.Append("parentid= @parentid,");
                strSql.Append("Url= @Url,");
                strSql.Append("Supplier_id= @Supplier_id");
                strSql.Append(" where id=@id");
                SqlParameter[] parameters =
                {
                    new SqlParameter("@id",          SqlDbType.Int,         4),
                    new SqlParameter("@Name",        SqlDbType.NVarChar, 1000),
                    new SqlParameter("@ImageUrl",    SqlDbType.NVarChar,   50),
                    new SqlParameter("@Sort",        SqlDbType.Int,         4),
                    new SqlParameter("@parentid",    SqlDbType.Int,         4),
                    new SqlParameter("@Url",         SqlDbType.NVarChar, 2000),
                    new SqlParameter("@Supplier_id", SqlDbType.Int, 4)
                };
                parameters[0].Value = model.id;
                parameters[1].Value = model.Name;
                parameters[2].Value = model.ImageUrl;
                parameters[3].Value = model.Sort;
                parameters[4].Value = model.parentid;
                parameters[5].Value = model.Url;
                parameters[6].Value = model.Supplier_id;

                SqlUtils.SqlUtilsInstance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
 /// <summary>
 /// 安全方式绑定对象表单
 /// </summary>
 public Lebi_Supplier_ProductType SafeBindForm(Lebi_Supplier_ProductType model)
 {
     if (HttpContext.Current.Request["Name"] != null)
     {
         model.Name = Shop.Tools.RequestTool.RequestSafeString("Name");
     }
     if (HttpContext.Current.Request["ImageUrl"] != null)
     {
         model.ImageUrl = Shop.Tools.RequestTool.RequestSafeString("ImageUrl");
     }
     if (HttpContext.Current.Request["Sort"] != null)
     {
         model.Sort = Shop.Tools.RequestTool.RequestInt("Sort", 0);
     }
     if (HttpContext.Current.Request["parentid"] != null)
     {
         model.parentid = Shop.Tools.RequestTool.RequestInt("parentid", 0);
     }
     if (HttpContext.Current.Request["Url"] != null)
     {
         model.Url = Shop.Tools.RequestTool.RequestSafeString("Url");
     }
     if (HttpContext.Current.Request["Supplier_id"] != null)
     {
         model.Supplier_id = Shop.Tools.RequestTool.RequestInt("Supplier_id", 0);
     }
     return(model);
 }
Beispiel #6
0
        /// <summary>
        /// 生成供应商商品分类选择框
        /// </summary>
        public void GetSupplierProductTypeList()
        {
            string ids        = RequestTool.RequestString("id");
            int    id         = EX_Product.SuplierTypeid(ids);
            int    supplierid = RequestTool.RequestInt("supplierid", 0);

            if (supplierid == 0)
            {
                Response.Write("");
                Response.End();
                return;
            }
            int Parentid = 0;
            List <Lebi_Supplier_ProductType> models = B_Lebi_Supplier_ProductType.GetList("parentid=" + id + " and Supplier_id=" + supplierid + "", "Sort desc");
            Lebi_Supplier_ProductType        area   = B_Lebi_Supplier_ProductType.GetModel(id);

            if (models.Count == 0)
            {
                if (area == null)
                {
                    Parentid = 0;
                }
                else
                {
                    Parentid = area.parentid;
                }
                models = B_Lebi_Supplier_ProductType.GetList("parentid=" + Parentid + " and Supplier_id=" + supplierid + "", "Sort desc");
            }
            else
            {
                Parentid = id;
            }
            string str = "<select id=\"Supplier_ProductType_ids\" name=\"Supplier_ProductType_ids\" shop=\"true\" onchange=\"SelectSupplierProductType(" + supplierid + ",'Supplier_ProductType_ids');\">";

            str += "<option value=\"0\" selected>" + Tag(" 请选择 ") + "</option>";
            foreach (Lebi_Supplier_ProductType 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  = CreateSupplierProductTypeSelect(supplierid, Parentid) + str;
            Response.Write(str);
        }
            /// <summary>
            /// 得到一个对象实体 by id
            /// </summary>
            public Lebi_Supplier_ProductType GetModel(int id)
            {
                StringBuilder strSql = new StringBuilder();

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

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

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name     = ds.Tables[0].Rows[0]["Name"].ToString();
                    model.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                    }
                    model.Url = ds.Tables[0].Rows[0]["Url"].ToString();
                    if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "")
                    {
                        model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
            /// <summary>
            /// 得到一个对象实体 by where条件
            /// </summary>
            public Lebi_Supplier_ProductType GetModel(string strWhere)
            {
                if (strWhere.IndexOf("lbsql{") > 0)
                {
                    SQLPara para = new SQLPara(strWhere, "", "");
                    return(GetModel(para));
                }
                StringBuilder strSql = new StringBuilder();

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

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                    {
                        model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                    }
                    model.Name     = ds.Tables[0].Rows[0]["Name"].ToString();
                    model.ImageUrl = ds.Tables[0].Rows[0]["ImageUrl"].ToString();
                    if (ds.Tables[0].Rows[0]["Sort"].ToString() != "")
                    {
                        model.Sort = int.Parse(ds.Tables[0].Rows[0]["Sort"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["parentid"].ToString() != "")
                    {
                        model.parentid = int.Parse(ds.Tables[0].Rows[0]["parentid"].ToString());
                    }
                    model.Url = ds.Tables[0].Rows[0]["Url"].ToString();
                    if (ds.Tables[0].Rows[0]["Supplier_id"].ToString() != "")
                    {
                        model.Supplier_id = int.Parse(ds.Tables[0].Rows[0]["Supplier_id"].ToString());
                    }
                    return(model);
                }
                else
                {
                    return(null);
                }
            }
            /// <summary>
            /// 增加一条数据
            /// </summary>
            public int Add(Lebi_Supplier_ProductType model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("insert into [Lebi_Supplier_ProductType](");
                strSql.Append("[Name],[ImageUrl],[Sort],[parentid],[Url],[Supplier_id])");
                strSql.Append(" values (");
                strSql.Append("@Name,@ImageUrl,@Sort,@parentid,@Url,@Supplier_id)");
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",        model.Name),
                    new OleDbParameter("@ImageUrl",    model.ImageUrl),
                    new OleDbParameter("@Sort",        model.Sort),
                    new OleDbParameter("@parentid",    model.parentid),
                    new OleDbParameter("@Url",         model.Url),
                    new OleDbParameter("@Supplier_id", model.Supplier_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
                return(1);
            }
Beispiel #10
0
        public string ThreadGetSupplierProductTypeList(string ids, int id, int supplierid, int Parentid)
        {
            List <Lebi_Supplier_ProductType> models = B_Lebi_Supplier_ProductType.GetList("parentid=" + id + " and Supplier_id=" + supplierid + "", "Sort desc");
            Lebi_Supplier_ProductType        area   = B_Lebi_Supplier_ProductType.GetModel(id);

            if (models.Count == 0)
            {
                if (area == null)
                {
                    Parentid = 0;
                }
                else
                {
                    Parentid = area.parentid;
                }
                models = B_Lebi_Supplier_ProductType.GetList("parentid=" + Parentid + " and Supplier_id=" + supplierid + "", "Sort desc");
            }
            else
            {
                Parentid = id;
            }
            string str = "<select id=\"Supplier_ProductType_ids\" name=\"Supplier_ProductType_ids\" shop=\"true\" onchange=\"SelectSupplierProductType(" + supplierid + ",'Supplier_ProductType_ids');\" class=\"form-control\">";

            str += "<option value=\"0\" selected>" + Tag(" 请选择 ") + "</option>";
            foreach (Lebi_Supplier_ProductType 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  = CreateSupplierProductTypeSelect(supplierid, Parentid) + str;
            return(str);
        }
            /// <summary>
            /// 更新一条数据
            /// </summary>
            public void Update(Lebi_Supplier_ProductType model)
            {
                StringBuilder strSql = new StringBuilder();

                strSql.Append("update [Lebi_Supplier_ProductType] set ");
                strSql.Append("[Name]=@Name,");
                strSql.Append("[ImageUrl]=@ImageUrl,");
                strSql.Append("[Sort]=@Sort,");
                strSql.Append("[parentid]=@parentid,");
                strSql.Append("[Url]=@Url,");
                strSql.Append("[Supplier_id]=@Supplier_id");
                strSql.Append(" where id=" + model.id);
                OleDbParameter[] parameters =
                {
                    new OleDbParameter("@Name",        model.Name),
                    new OleDbParameter("@ImageUrl",    model.ImageUrl),
                    new OleDbParameter("@Sort",        model.Sort),
                    new OleDbParameter("@parentid",    model.parentid),
                    new OleDbParameter("@Url",         model.Url),
                    new OleDbParameter("@Supplier_id", model.Supplier_id)
                };

                AccessUtils.Instance.TextExecuteNonQuery(strSql.ToString(), parameters);
            }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Power("supplier_pro_type", "商品分类"))
            {
                PageNoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int pid = RequestTool.RequestInt("pid", 0);

            model = B_Lebi_Supplier_ProductType.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + id);
            if (model == null)
            {
                model = new Lebi_Supplier_ProductType();
            }
            else
            {
                pid = model.parentid;
            }
            pmodel = B_Lebi_Supplier_ProductType.GetModel(pid);
            if (pmodel == null)
            {
                pmodel = new Lebi_Supplier_ProductType();
            }
        }
Beispiel #13
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopProductCategory";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = RequestTool.RequestInt("id", 0);          //商家ID
            cid       = RequestTool.RequestInt("cid", 0);         //商品分类
            list      = RequestTool.RequestString("list");        //列表或网格
            sort      = RequestTool.RequestString("sort");        //排序
            keyword   = 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><em>&raquo;</em><a href=\"" + URL("P_ShopProductCategory", "" + id + "," + cid + "," + list + "," + sort + ",1," + keyword + "") + "\"><span>" + Tag("商品列表") + "</span></a>";

            where = ProductWhere + " and Type_id_ProductType = 320 and Supplier_id = " + id + "";
            if (cid > 0)
            {
                where += " and " + ShopCategoryWhere(cid);
            }
            if (keyword != "")
            {
                //增加空格划词搜索 by kingdge 2013-09-18
                string wherekeyword = "";
                if (keyword.IndexOf(" ") > -1)
                {
                    string[] keywordsArr;
                    keywordsArr = keyword.Split(new char[1] {
                        ' '
                    });
                    foreach (string keywords in keywordsArr)
                    {
                        if (keywords != "")
                        {
                            if (wherekeyword == "")
                            {
                                wherekeyword = "Name like lbsql{'%" + keywords + "%'}";
                            }
                            else
                            {
                                wherekeyword += " and Name like lbsql{'%" + keywords + "%'}";
                            }
                        }
                    }
                }
                else
                {
                    wherekeyword = "Name like lbsql{'%" + keyword + "%'}";
                }
                where += " and ((" + wherekeyword + ") or Number like lbsql{'%" + keyword + "%'} or Code like lbsql{'%" + keyword + "%'})";
                path  += "<em>&raquo;</em><a class=\"text\"><span>“" + keyword + "”</span></a>";
            }
            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_ShopProductCategory", id + "," + cid + "," + list + "," + sort + ",{0}," + keyword + "");

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

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
            //跳转至设置的皮肤页面
            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") && filename.Contains("default.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 + "&keyword=" + keyword;
                    tourl = ThemeUrl.CheckPath(tourl);
                    Response.Redirect(tourl);
                    //Response.Write(tourl);
                }
            }
        }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Supplier_ProductType model)
 {
     return(D_Lebi_Supplier_ProductType.Instance.Add(model));
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Supplier_ProductType model)
 {
     D_Lebi_Supplier_ProductType.Instance.Update(model);
 }
Beispiel #16
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopProductCategory";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = Rint_Para("0");    //商家ID
            cid       = Rint_Para("1");    //商品分类
            list      = Rstring_Para("2"); //列表或网格
            sort      = Rstring_Para("3"); //排序
            key       = Rstring_Para("5"); //关键词
            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>";
            if (key != "")
            {
                path += " > " + key;
            }

            where = "Type_id_ProductStatus = 101 and Product_id=0 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_ShopProductCategory", 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);
            string supplierservicepannelcon = supplier.ServicePanel;

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
        }
Beispiel #17
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);
                    }
                }
            }
        }
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Supplier_ProductType SafeBindForm(Lebi_Supplier_ProductType model)
 {
     return(D_Lebi_Supplier_ProductType.Instance.SafeBindForm(model));
 }