protected void Page_Load(object sender, EventArgs e) { 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); }
protected void Page_Load(object sender, EventArgs e) { id = RequestTool.RequestInt("id", 0); randnum = RequestTool.RequestInt("randnum", 0); if (id == 0) { if (!EX_Admin.Power("product_add", "添加商品")) { WindowNoPower(); } } else { if (!EX_Admin.Power("product_edit", "编辑商品")) { WindowNoPower(); } } ids = RequestTool.RequestString("ids"); model = B_Lebi_Product.GetModel(id); if (ids != "") { List <Lebi_Product> models = B_Lebi_Product.GetList("id in (lbsql{" + ids + "})", ""); //if (models.Count == 1) model = models.FirstOrDefault(); } if (model == null) { model = new Lebi_Product(); //Response.Write("参数错误"); //Response.End(); } }
private void Reset_Count_Sales() { List <Lebi_Product> parents = B_Lebi_Product.GetList("Product_id = 0 and Type_id_ProductStatus = 101", ""); foreach (Lebi_Product parent in parents) { int total_count = 0; List <Lebi_Product> pros = B_Lebi_Product.GetList("Product_id = " + parent.id + " and Type_id_ProductStatus = 101", ""); if (pros.Count > 0) { foreach (Lebi_Product pro in pros) { string count_ = Common.GetValue("select sum(Count_Shipped) from Lebi_Order_Product where Product_id = " + pro.id + " 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)"); int count = 0; int.TryParse(count_, out count); pro.Count_Sales = count; B_Lebi_Product.Update(pro); total_count += count; parent.Count_Sales = total_count; } } else { string count_ = Common.GetValue("select sum(Count_Shipped) from Lebi_Order_Product where Product_id = " + parent.id + " 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)"); int count = 0; int.TryParse(count_, out count); parent.Count_Sales = count; } B_Lebi_Product.Update(parent); } }
/// <summary> /// 添加代理商品 /// </summary> public void Product_Add() { SearchProduct sp = new SearchProduct(CurrentAdmin, CurrentLanguage.Code); List <Lebi_Product> models = B_Lebi_Product.GetList("Product_id=0 " + sp.SQL, ""); if (models.Count == 0) { Response.Write("{\"msg\":\"" + Tag("没有商品") + "\"}"); return; } Lebi_Agent_Product pro; string ids = ""; foreach (Lebi_Product model in models) { pro = B_Lebi_Agent_Product.GetModel("Product_id=" + model.id + ""); if (pro == null) { pro = new Lebi_Agent_Product(); pro.Product_id = model.id; B_Lebi_Agent_Product.Add(pro); ids += pro.id + ","; } } Log.Add("添加代理区商品", "Agent_Product", ids, CurrentAdmin, ""); Response.Write("{\"msg\":\"OK\"}"); }
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("Supplier_id = " + CurrentSupplier.id + " and id = " + orderid); orderproduct = B_Lebi_Order_Product.GetModel("Supplier_id = " + CurrentSupplier.id + " and id = " + 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 = new List <Lebi_Product>(); models.Add(product); } }
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_LimitBuy'"); 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\">»</em><a class=\"text\"><span>" + Tag("限时抢购") + "</span></a>"; where = ProductWhere + " and Type_id_ProductType = 321"; 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 + ""; }
/// <summary> /// 商品页面 /// </summary> /// <param name="lang"></param> /// <param name="model"></param> /// <param name="theme"></param> /// <param name="urlpath"></param> private void P_Product(List <Lebi_Language> langs, Lebi_Theme_Page page, string urlpath) { string url; string ids = RequestTool.RequestString("Pro_Type_id"); DateTime time1 = RequestTool.RequestTime("time1"); DateTime time2 = RequestTool.RequestTime("time2"); string file = ""; int pageindex = RequestTool.RequestInt("pageindex", 0); int pagesize = RequestTool.RequestInt("pagesize", 0); string where = "Time_Add>='" + time1 + "' and Time_Add<='" + time2 + "'"; if (ids != "") { where += " and Pro_Type_id in (lbsql{" + ids + "})"; } List <Lebi_Product> models = B_Lebi_Product.GetList(where, "", pagesize, pageindex); int count = B_Lebi_Product.Counts(where); int pagecount = Pager.GetPageCount(pagesize, count); int per = 100; if (pagecount > 0) { per = Convert.ToInt32(pageindex * 100 / pagecount); } List <Lebi_Site> sites = GetSites(); Lebi_Site site; foreach (Lebi_Product model in models) { foreach (Lebi_Language lang in langs) { site = GetSite(sites, lang.Site_id); file = site.Path + "/" + lang.Path + "/" + page.StaticPath + "/" + page.StaticPageName; file = file.Replace("{0}", model.id.ToString()); file = RegexTool.ReplaceRegValue(file, @"{.*?}", ""); file = ThemeUrl.CheckPath(file); url = page.PageName + "?" + page.PageParameter; url = url.Replace("{0}", model.id.ToString()); url = urlpath + "/" + site.Path + "/" + lang.Path + "/" + url; url = RegexTool.ReplaceRegValue(url, @"{.*?}", ""); url = ThemeUrl.CheckURL(url); try { HtmlEngine.Instance.CreatHtml(url, file); } catch (System.Net.WebException) { //Log.Add(url + "---------" + file); continue; } } } Response.Write("{\"msg\":\"OK\",\"per\":\"" + per + "\"}"); }
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, ""); }
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, ""); }
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); }
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); } } }
/// <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); }
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, ""); }
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); }
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\">»</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); } } } }
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); }
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"); string where = "Product_id=0 and 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 (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 + "&" + sp.URL, page, PageSize, recordCount); //Response.Write(where); }
protected void Page_Load(object sender, EventArgs e) { if (!Power("supplier_product_list", "商品列表")) { PageReturnMsg = PageNoPowerMsg(); } sp = new SearchProduct(CurrentSupplier, CurrentLanguage.Code); 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"); //if (lang == "") // lang = "CN"; string where = "(IsDel!=1 or IsDel is null) and Product_id=0 and Supplier_id = " + CurrentSupplier.id + ""; //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 + "%'})"; } //if (dateFrom != "" && dateTo != "") // where += " and (datediff(d,Time_Add,'" + dateFrom + "')<=0 and datediff(d,Time_Add,'" + dateTo + "')>=0)"; where += sp.SQL; 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 { orderstr = " id desc"; } models = B_Lebi_Product.GetList(where, orderstr, PageSize, page); int recordCount = B_Lebi_Product.Counts(where); PageString = Shop.Bussiness.Pager.GetPaginationString("?page={0}&key=" + key + "&" + sp.URL, page, PageSize, recordCount); }
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\">»</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a><em>»</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>»</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 void taobao_product_out() { if (!Power("supplier_product_datainout", "导入导出")) { AjaxNoPower(); return; } string lang = RequestTool.RequestString("lang"); SearchProduct sp = new SearchProduct(CurrentSupplier, CurrentLanguage.Code); string where = "Supplier_id =" + CurrentSupplier.id + " and Product_id=0 " + sp.SQL; List <Lebi_Product> ps = B_Lebi_Product.GetList(where, ""); string titles = "title,cid,seller_cids,stuff_status,location_state,location_city,item_type,price,auction_increment,num,valid_thru,freight_payer,post_fee,ems_fee,express_fee,has_invoice,has_warranty,approve_status,has_showcase,list_time,description,cateProps,postage_id,has_discount,modified,upload_fail_msg,picture_status,auction_point,picture,video,skuProps,inputPids,inputValues,outer_id,propAlias,auto_fill,num_id,local_cid,navigation_type,user_name,syncStatus,is_lighting_consigment,is_xinpin,foodparame,features,buyareatype,global_stock_type,global_stock_country,sub_stock_type,item_size,item_weight,sell_promise,custom_design_flag,wireless_desc,VolumeL,VolumeW,VolumeH,PackageRate"; string[] arr = titles.Split(','); DataTable dt = new DataTable(); foreach (string col in arr) { dt.Columns.Add(col); } DataRow r = dt.NewRow(); dt.Rows.Add(r); StringBuilder sb = new StringBuilder(); sb.Append("version 1.00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n"); sb.Append(titles + "\r\n"); sb.Append("宝贝名称,宝贝类目,店铺类目,新旧程度,省,城市,出售方式,宝贝价格,加价幅度,宝贝数量,有效期,运费承担,平邮,EMS,快递,发票,保修,放入仓库,橱窗推荐,开始时间,宝贝描述,宝贝属性,邮费模版ID,会员打折,修改时间,上传状态,图片状态,返点比例,新图片,视频,销售属性组合,用户输入ID串,用户输入名-值对,商家编码,销售属性别名,代充类型,数字ID,本地ID,宝贝分类,用户名称,宝贝状态,闪电发货,新品,食品专项,尺码库,采购地,库存类型,国家地区,库存计数,物流体积,物流重量,退换货承诺,定制工具,无线详情,包装尺寸L,包装尺寸W,包装尺寸H,包装率\r\n"); //sb.Append("title,stuff_status,price,num,description,modified,item_weight,picture,wireless_desc \r\n"); //sb.Append("宝贝名称,新旧程度,宝贝价格,宝贝数量,宝贝描述,修改时间,物流重量,新图片,无线详情 \r\n"); string domain = "http://" + RequestTool.GetRequestDomainPort(); string images = ""; string[] temparr; string temp; int i = 0; string name = ""; string filename = System.DateTime.Now.ToString("yyyyMMddhhmmss"); string serverpath = HttpContext.Current.Server.MapPath(@"~/" + WebPath); string savepath = serverpath + "/download/taobaoproduct" + filename + "/taobao"; if (Directory.Exists(savepath)) { Directory.Delete(savepath); } Directory.CreateDirectory(savepath); foreach (Lebi_Product pro in ps) { dt.Rows[0]["title"] = Lang(pro.Name, lang); dt.Rows[0]["stuff_status"] = "1"; dt.Rows[0]["price"] = pro.Price; dt.Rows[0]["num"] = pro.Count_Stock; dt.Rows[0]["description"] = taobao_product_out_langtxt(pro.Description, lang); dt.Rows[0]["modified"] = pro.Time_Edit; dt.Rows[0]["item_weight"] = pro.Weight; dt.Rows[0]["outer_id"] = pro.Number; dt.Rows[0]["wireless_desc"] = taobao_product_out_langtxt(pro.MobileDescription, lang); dt.Rows[0]["VolumeL"] = pro.VolumeL; dt.Rows[0]["VolumeW"] = pro.VolumeW; dt.Rows[0]["VolumeH"] = pro.VolumeH; dt.Rows[0]["PackageRate"] = pro.PackageRate; //处理图片 images = pro.ImageOriginal + pro.Images; temparr = images.Split('@'); images = ""; i = 0; foreach (string img in temparr) { if (img != "") { name = MD5(img); FileTool.CopyFile(serverpath + img, savepath + "/" + name + ".tbi", true); temp = domain + img; //temp = name + ":0:" + i + ":|;"; temp = name + ":1:" + i + ":|" + temp + ";"; images += temp; i++; } } dt.Rows[0]["picture"] = images; i = 0; foreach (DataColumn col in dt.Columns) { if (i == 0) { sb.Append(dt.Rows[0][col.ToString()]); } else { sb.Append("," + dt.Rows[0][col.ToString()]); } i++; } sb.Append("\r\n"); } HtmlEngine.Instance.WriteFile(serverpath + "/download/taobaoproduct" + filename + "/taobao.csv", sb.ToString()); //ZipUtil.RAR(serverpath + "/download/taobaoproduct" + filename, serverpath + "/download", "taobaoproduct" + filename + ".rar"); string err = ""; ZipUtil.ZipFile(serverpath + "/download/taobaoproduct" + filename + "/taobao", serverpath + "/download/taobaoproduct" + filename + "/taobao.zip", out err); ZipUtil.ZipFile(serverpath + "/download/taobaoproduct" + filename, serverpath + "/download/taobaoproduct" + filename + ".zip", out err); Response.Write("{\"msg\":\"OK\",\"url\":\"" + WebPath + "/download/taobaoproduct" + filename + ".zip\"}"); }
/// <summary> /// 编辑保存促销 /// </summary> public void Promotion_Edit() { int id = RequestTool.RequestInt("id", 0); int tid = RequestTool.RequestInt("tid", 0); Lebi_Promotion model = B_Lebi_Promotion.GetModel(id); Lebi_Promotion_Type pt; bool addflag = false; if (model == null) { if (!EX_Admin.Power("promotion_add", "添加促销活动")) { AjaxNoPower(); return; } pt = B_Lebi_Promotion_Type.GetModel(tid); model = new Lebi_Promotion(); addflag = true; } else { if (!EX_Admin.Power("promotion_edit", "编辑促销活动")) { AjaxNoPower(); return; } pt = B_Lebi_Promotion_Type.GetModel(model.Promotion_Type_id); } if (pt == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } B_Lebi_Promotion.BindForm(model); model.IsCase801 = RequestTool.RequestInt("IsCase801", 0); model.IsCase802 = RequestTool.RequestInt("IsCase802", 0); model.IsCase803 = RequestTool.RequestInt("IsCase803", 0); model.IsCase804 = RequestTool.RequestInt("IsCase804", 0); model.IsCase805 = RequestTool.RequestInt("IsCase805", 0); model.IsCase806 = RequestTool.RequestInt("IsCase806", 0); model.IsRule901 = RequestTool.RequestInt("IsRule901", 0); model.IsRule902 = RequestTool.RequestInt("IsRule902", 0); model.IsRule903 = RequestTool.RequestInt("IsRule903", 0); model.IsRule904 = RequestTool.RequestInt("IsRule904", 0); model.IsRule905 = RequestTool.RequestInt("IsRule905", 0); model.IsRule906 = RequestTool.RequestInt("IsRule906", 0); model.IsRule907 = RequestTool.RequestInt("IsRule907", 0); model.IsRule908 = RequestTool.RequestInt("IsRule908", 0); model.IsRule909 = RequestTool.RequestInt("IsRule909", 0); model.IsRule910 = RequestTool.RequestInt("IsRule910", 0); model.IsRule911 = RequestTool.RequestInt("IsRule911", 0); model.IsRule912 = RequestTool.RequestInt("IsRule912", 0); model.Case804 = RequestTool.RequestString("Case804");; //处理包含商品 string Case805 = RequestTool.RequestString("Case805"); Case805 = Case805.Replace(",", "','"); Case805 = "'" + Case805 + "'"; List <Lebi_Product> pros = B_Lebi_Product.GetList("Number in (" + Case805 + ")", ""); string ids = ""; foreach (Lebi_Product pro in pros) { if (ids == "") { ids = pro.id.ToString(); } else { ids = ids + "," + pro.id.ToString(); } } model.Case805 = ids; model.Admin_id = CurrentAdmin.id; model.Admin_UserName = CurrentAdmin.UserName; model.Time_Start = pt.Time_Start; model.Time_End = pt.Time_End; model.Type_id_PromotionStatus = pt.Type_id_PromotionStatus; model.Remark = RequestTool.RequestString("Remark"); model.Sort = RequestTool.RequestInt("Sort", 0); model.Promotion_Type_id = pt.id; if (model.IsCase801 > 0 || model.IsCase802 > 0 || model.IsCase803 > 0 || model.IsCase804 > 0 || model.IsCase805 > 0) { model.IsSetCase = 1; } else { model.IsSetCase = 0; } if (addflag) { B_Lebi_Promotion.Add(model); model.id = B_Lebi_Promotion.GetMaxId(); } else { B_Lebi_Promotion.Update(model); } Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}"); }
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); keyword = Rstring("keyword"); 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\">»</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>»</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); if (tag != null) { path += "<em>»</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>»</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>»</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>»</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 (LB.DataAccess.DB.BaseUtilsInstance.DBType == "sqlserver") { where += " and Charindex('," + tid + ",',','+Pro_Tag_id+',')>0"; } else if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "access") { where += " and Instr(','+Pro_Tag_id+',','," + tid + ",')>0"; } else if (LB.DataAccess.DB.BaseUtilsInstance.DBType == "mysql") { 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 (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 + "%'})"; } 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 + "," + keyword + "", Lang(pro_type.Url)); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage); NextPage = URL("P_ProductCategory", id + "," + pid + "," + cid + "," + list + "," + sort + "," + tid + "," + (pageindex + 1) + "," + transport + "," + stock + "," + keyword + "", Lang(pro_type.Url)); }
protected void Page_Load(object sender, EventArgs e) { int id = RequestTool.RequestInt("id", 0); int tid = RequestTool.RequestInt("tid", 0); if (id == 0) { if (!EX_Admin.Power("promotion_add", "添加促销活动")) { PageReturnMsg = PageNoPowerMsg(); } } else { if (!EX_Admin.Power("promotion_edit", "编辑促销活动")) { PageReturnMsg = PageNoPowerMsg(); } } model = B_Lebi_Promotion.GetModel(id); if (model == null) { model = new Lebi_Promotion(); model.Type_id_PromotionStatus = 240; } else { tid = model.Promotion_Type_id; if (model.Case805 != "") { string codes = ""; List <Lebi_Product> pros = B_Lebi_Product.GetList("id in (" + model.Case805 + ")", ""); foreach (Lebi_Product pro in pros) { if (codes == "") { codes = pro.Number; } else { if (codes.Contains(pro.Number)) { continue; } else { codes = codes + "," + pro.Number; } } } model.Case805 = codes; } } pt = B_Lebi_Promotion_Type.GetModel(tid); if (pt == null) { PageError(); return; } }
/// <summary> /// 生成规格选项 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Get_guige(Lebi_Product model) { string res = ""; if (model.ProPerty134 != "") { List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc"); string Msige = Language.DefaultCurrency().Msige; foreach (Lebi_ProPerty p in ps134) { res += "<dl class=\"clearfix\"><dt>" + Lang(p.Name) + ":</dt><dd>"; res += "<input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + "\" />"; List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc"); if (ps134list.Count > 0) { Lebi_ProPerty ps134listfirst = ps134list.FirstOrDefault(); res += "<select id=\"Property134_" + p.id + "\" selectname=\"Property134\">"; foreach (Lebi_ProPerty pl in ps134list) { if (pl.Price > 0) { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>"; } else { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>"; } } res += "</select>"; } else { res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />"; } res += "</dd></dl>"; } } //return "model.ProPerty134" + model.ProPerty134; List <ProductProperty> rmodels = new List <ProductProperty>(); if (model.Product_id == 0) { //无同款子商品 return(res); } List <Lebi_Product> pros = B_Lebi_Product.GetList("(IsDel!=1 or IsDel is null) and Product_id=" + model.Product_id + "", ""); if (pros.Count == 0) { return(res); } Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id); if (pmodel == null) { return(res); } string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131, model.Supplier_id); if (property == "") { return(res); } List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc"); List <Lebi_ProPerty> ps = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc"); //分析当前商品的规格 //将当前商品的规格与主父规格进行对应 List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当时商品的父规则值 string[] temps = model.ProPerty131.Split(','); foreach (string k in temps) { Lebi_ProPerty p = (from m in ps where m.id == Convert.ToInt32(k) select m).ToList().FirstOrDefault(); if (p != null) { Lebi_ProPerty kv = (from m in pps where m.id == p.parentid select m).ToList().FirstOrDefault(); kv.Sort = p.id;//临时征用排序字段,存放规格 Currentpps.Add(kv); } } foreach (Lebi_ProPerty pp in Currentpps) { List <Lebi_ProPerty> cps = (from m in ps where m.parentid == pp.id select m).ToList(); if (cps.Count == 0) { continue; } bool showimage = true; if (cps.FirstOrDefault().ImageUrl == "") { showimage = false; } if (pp.id == model.ProPertyMain) { //res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; if (!showimage) { res += "<dl class=\"choose-text clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; } else { res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; } foreach (Lebi_ProPerty p in cps) { //计算对应的商品 string propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ","); Lebi_Product pro = (from m in pros where ("," + m.ProPerty131 + ",") == propertystr select m).ToList().FirstOrDefault(); if (pro == null) { continue; } if (showimage) { if (pro.Type_id_ProductStatus == 100 || (EX_Product.ProductStock(pro) < 1 && SYS.IsNullStockSale != "1"))//下架 无库存 { if (pp.Sort == p.id) { res += "<div><a class=\"spva-imgonout\"><img src=\"" + Image(model.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } else { res += "<div><a class=\"spva-imgout\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + Image(pro.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } continue; } if (pp.Sort == p.id) { res += "<div><a class=\"spva-imgon\" href=\"" + URL("P_Product", model.id) + "\"><img src=\"" + Image(model.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } else { res += "<div><a class=\"spva-img\" href=\"" + URL("P_Product", pro.id) + "\"><img src=\"" + Image(pro.ImageOriginal) + "\" width=\"50\" title=\"" + Lang(p.Name) + "\" alt=\"" + Lang(p.Name) + "\"/><span></span></a></div>"; } } else { if (pro.Type_id_ProductStatus == 100 || (EX_Product.ProductStock(pro) < 1 && SYS.IsNullStockSale != "1"))//下架 无库存 { if (pp.Sort == p.id) { res += "<div><a class=\"spvaonout\">" + Lang(p.Name) + "<span></span></a></div>"; } else { res += "<div><a class=\"spvaout\" href=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "<span></span></a></div>"; } continue; } if (pp.Sort == p.id) { res += "<div><a class=\"spvaon\" href=\"" + URL("P_Product", model.id) + "\">" + Lang(p.Name) + "<span></span></a></div>"; } else { res += "<div><a class=\"spva\" href=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "<span></span></a></div>"; } } } } else { if (!showimage) { res += "<dl class=\"choose-text clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; } else { res += "<dl class=\"choose-image clearfix\"><dt>" + Lang(pp.Name) + ":</dt><dd>"; } foreach (Lebi_ProPerty p in cps) { //计算对应的商品 string propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ","); Lebi_Product pro = (from m in pros where ("," + m.ProPerty131 + ",") == propertystr select m).ToList().FirstOrDefault(); if (pro == null) { continue; } string tt = ""; string aclass = ""; if (p.ImageUrl == "") { tt = Lang(p.Name); } else { tt = "<img src=\"" + p.ImageUrl + "\" width=\"50\"\" />"; } if (pro.Type_id_ProductStatus == 100 || (EX_Product.ProductStock(pro) < 1 && SYS.IsNullStockSale != "1"))//下架 无库存 { if (pp.Sort == p.id) { if (cps.FirstOrDefault().ImageUrl == "") { aclass = "spvaonout"; } else { aclass = "spva-imgonout"; } res += "<div><a class=\"" + aclass + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } else { if (cps.FirstOrDefault().ImageUrl == "") { aclass = "spvaout"; } else { aclass = "spva-imgout"; } res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } continue; } if (pp.Sort == p.id) { if (!showimage) { aclass = "spvaon"; } else { aclass = "spva-imgon"; } res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", model.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } else { if (!showimage) { aclass = "spva"; } else { aclass = "spva-img"; } res += "<div><a class=\"" + aclass + "\" href=\"" + URL("P_Product", pro.id) + "\" title=\"" + Lang(p.Name) + "\">" + tt + "<span></span></a></div>"; } } } res += "</dd></dl>"; } return(res); }
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_Brand'"); id = Rint_Para("0"); cid = Rstring_Para("1"); list = Rstring_Para("2"); sort = Rstring_Para("3"); pageindex = RequestTool.RequestInt("page", 1); brand = B_Lebi_Brand.GetModel(id); if (brand == null) { Response.Redirect(URL("P_BrandList", "")); Response.End(); } path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em><a href=\"" + URL("P_BrandList", "") + "\"><span>" + Tag("品牌列表") + "</span></a><em>»</em><a class=\"text\"><span>" + Lang(brand.Name) + "</span></a>"; //where = "Type_id_ProductStatus = 101 and Product_id=0 and Type_id_ProductType <> 323"; where = ProductWhere + " and Type_id_ProductType <> 323"; if (id > 0) { where += " and Brand_id = " + id + ""; } if (cid != "") { where += " and " + Categorywhere(cid); } 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); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple("?page={0}&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + "", pageindex, PageSize, recordCount, CurrentLanguage); NextPage = "?page=" + (pageindex + 1) + "&id=" + id + "&cid=" + cid + "&sort=" + sort + "&list=" + list + ""; }
public string Get_guigeforwap(Lebi_Product model) { string res = ""; if (model.ProPerty134 != "") { List <Lebi_ProPerty> ps134 = B_Lebi_ProPerty.GetList("id in (" + model.ProPerty134 + ")", "Sort desc"); string Msige = Language.DefaultCurrency().Msige; if (ps134.Count > 0) { foreach (Lebi_ProPerty p in ps134) { res += "<dd class=\"clearfix\"><em>" + Lang(p.Name) + ":</em><em><input type=\"hidden\" name=\"Property134\" propertyid=\"" + p.id + "\" value=\"" + Lang(p.Name) + Msige + p.Price + ":\" />"; List <Lebi_ProPerty> ps134list = B_Lebi_ProPerty.GetList("parentid = " + p.id + "", "Sort desc"); if (ps134list.Count > 0) { res += "<select id=\"Property134_" + p.id + "\" >"; foreach (Lebi_ProPerty pl in ps134list) { if (pl.Price > 0) { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + Msige + pl.Price + "\">" + Lang(pl.Name) + " " + Msige + pl.Price + "</option>"; } else { res += "<option propertypriceid=\"" + pl.id + "\" value=\"" + Lang(pl.Name) + "\">" + Lang(pl.Name) + "</option>"; } } res += "</select>"; } else { res += "<input type=\"text\" id=\"Property134_" + p.id + "\" class=\"input\" value=\"\" />"; } res += "</em></dd>"; } } } List <ProductProperty> rmodels = new List <ProductProperty>(); if (model.Product_id == 0) { //无同款子商品 return(res); } List <Lebi_Product> pros = B_Lebi_Product.GetList("(IsDel!=1 or IsDel is null) and Product_id=" + model.Product_id + "", ""); if (pros.Count == 0) { return(res); } Lebi_Product pmodel = B_Lebi_Product.GetModel(model.Product_id); if (pmodel == null) { return(res); } string property = EX_Product.ProductType_ProPertystr(model.Pro_Type_id, 131); if (property == "") { return(res); } List <Lebi_ProPerty> pps = B_Lebi_ProPerty.GetList("id in (" + property + ")", "Sort desc"); List <Lebi_ProPerty> ps = B_Lebi_ProPerty.GetList("parentid in (" + property + ")", "Sort desc"); //分析当前商品的规格 //将当前商品的规格与主父规格进行对应 List <Lebi_ProPerty> Currentpps = new List <Lebi_ProPerty>();//保存当前商品的父规则值 string[] temps = model.ProPerty131.Split(','); foreach (string k in temps) { Lebi_ProPerty p = (from m in ps where m.id == Convert.ToInt32(k) select m).ToList().FirstOrDefault(); if (p != null) { Lebi_ProPerty kv = (from m in pps where m.id == p.parentid select m).ToList().FirstOrDefault(); kv.Sort = p.id;//临时征用排序字段,存放规格 Currentpps.Add(kv); } } foreach (Lebi_ProPerty pp in Currentpps) { List <Lebi_ProPerty> cps = (from m in ps where m.parentid == pp.id select m).ToList(); if (cps.Count == 0) { continue; } res += "<dd class=\"cartOption\"><em>" + Lang(pp.Name) + ":</em><em><select name=\"select_same_goods_\" onChange=\"window.location=$(this).val();\">"; foreach (Lebi_ProPerty p in cps) { //计算对应的商品 string propertystr = ("," + model.ProPerty131 + ",").Replace("," + pp.Sort + ",", "," + p.id + ","); Lebi_Product pro = (from m in pros where ("," + m.ProPerty131 + ",") == propertystr select m).ToList().FirstOrDefault(); if (pro == null) { continue; } if (pp.Sort == p.id) { res += " <option value=\"" + URL("P_Product", pro.id) + "\" selected>" + Lang(p.Name) + "</option>"; } else { res += " <option value=\"" + URL("P_Product", pro.id) + "\">" + Lang(p.Name) + "</option>"; } } res += "</select></em><em></em></dd>"; } return(res); }
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"); }
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\">»</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; }
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(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"); } if (tid == 0) { tid = modelp.Pro_Type_id; } string property = EX_Product.ProductType_ProPertystr(tid, CurrentSupplier.id); if (property != "") { try { ggs = B_Lebi_ProPerty.GetList("Type_id_ProPertyType=131 and id in (" + 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 = "Product_id!=0 and (IsDel!=1 or IsDel is null)"; if (pid == 0 || (pid > 0 && randnum > 0)) { where += " and Supplier_id = " + CurrentSupplier.id + " and Product_id=" + randnum + ""; } else { where += " and Supplier_id = " + CurrentSupplier.id + " and Product_id=" + pid + ""; } models = B_Lebi_Product.GetList(where, ""); }
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"; 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 (DataBase.DBType == "sqlserver") { where += " and Charindex('" + tag + "',Pro_Tag_id)>0"; } if (DataBase.DBType == "access") { 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 (datediff(d,Time_Add,'" + FormatDate(lbsql_dateFrom) + "')<=0 and datediff(d,Time_Add,'" + FormatDate(lbsql_dateTo) + "')>=0)"; } 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 + ")"; } 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"; } SQLDataAccess.SQLPara sp = new SQLDataAccess.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"); }