/// <summary> /// 某个商品分类的路径 /// </summary> /// <param name="id"></param> /// <returns></returns> public string Categorypath(int id) { Shop.Model.Lebi_Pro_Type pro_type = Shop.Bussiness.B_Lebi_Pro_Type.GetModel(id); if (pro_type == null) { pro_type = new Shop.Model.Lebi_Pro_Type(); } string str = EX_Product.TypePath(pro_type, id.ToString()); string[] arr = str.Split(','); string res = ""; for (int i = 0; i < arr.Length; i++) { Lebi_Pro_Type model = B_Lebi_Pro_Type.GetModel("id = " + int.Parse(arr[i]) + " and IsShow = 1"); if (model == null) { continue; } res += Lang(model.Name); if (i < arr.Length - 1) { res += " » "; } } return(res); }
public string CreateTree(int pid, int deep) { string str = ""; //的道所有的更节点 // List<Lebi_Pro_Type> types = B_Lebi_Pro_Type.GetList("Parentid=" + pid + "", "Sort desc"); List <Lebi_Pro_Type> types = EX_Product.Types(pid); //将根节点进行遍历 string style = ""; if (deep > 0) { style = "style=\"display:none;\""; } string showids = LB.Tools.CookieTool.GetCookieString("showTypeids").Replace("%2C", ","); string image = ""; foreach (Lebi_Pro_Type t in types) { image = AdminImage("plus.gif"); bool showson = false; if (showids.Contains("," + t.id + ",") || showids.Contains("," + t.Parentid + ",")) { style = ""; } if (showids.Contains("," + t.id + ",")) { image = AdminImage("minus.gif"); showson = true; } int count = B_Lebi_Pro_Type.Counts("Parentid=" + t.id + ""); //str += "<tr onclick='javascript:selectrow(\"check" + t.id + "\");' name=\"tr" + t.Parentid + "\" " + style + " id=\"tr" + t.id + "\">"; str += "<tr class=\"list\" name=\"tr" + t.Parentid + "\" " + style + " id=\"tr" + t.id + "\">"; str += "<td>" + deepstr(deep); if (count > 0) { str += "<img src=\"" + image + "\" name=\"img" + t.Parentid + "\" id=\"img" + t.id + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" onclick=\"ShowChild('" + findpath(t.id) + "'," + t.id + "," + (deep + 1) + ")\" title=\"" + Tag("展开") + "\" /> "; } else { str += "<img src=\"" + AdminImage("minus.gif") + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" /> "; } if (t.ImageSmall != "") { str += "<img src=\"" + t.ImageSmall + "\" height=\"16\" /> "; } str += Language.Content(t.Name, CurrentLanguage.Code) + " <a href=\"" + Shop.Bussiness.ThemeUrl.GetURL("P_ProductCategory", t.id.ToString(), "", CurrentLanguage.Code) + "\" target=\"_blank\"><img src=\"" + PageImage("icon/newWindow.png") + "\" style=\"vertical-align:absmiddle\" /></a></td>"; str += "<td>" + Shop.Bussiness.EX_Product.TypeProductCount(t.id) + "</td>"; str += "<td>" + Shop.Bussiness.EX_Product.LikeProductCount(t.id) + "</td>"; str += "<td>" + Shop.Bussiness.EX_Product.SalesProductCount(t.id) + "</td>"; str += "<td>" + Shop.Bussiness.EX_Product.ViewsProductCount(t.id) + "</td>"; str += "</tr>"; if (showson) { str += CreateTree(t.id, deep + 1); } //CreateSunNode(int.Parse(ds.Tables[0].Rows[i]["id"].ToString()), ",0", ss); } return(str); }
/// <summary> /// 检查购物车是否满足代金券使用条件 /// </summary> /// <param name="basket"></param> /// <param name="card"></param> /// <returns></returns> public static bool CheckCard(Basket basket, Lebi_Card card) { if (card.Time_Begin > System.DateTime.Now) { return(false); } if (card.Time_End <= System.DateTime.Now) { card.Type_id_CardStatus = 204; B_Lebi_Card.Update(card); return(false); } if ((basket.Money_Product - basket.Money_Cut) < card.Money_Buy) { return(false); } if (card.Pro_Type_ids == "") { return(true); } foreach (Lebi_User_Product p in basket.Products) { Lebi_Product pro = B_Lebi_Product.GetModel(p.Product_id); Lebi_Pro_Type type = EX_Product.TopProductType(pro); if (("," + card.Pro_Type_ids + ",").Contains("," + type.id + ",")) { return(true); } } return(false); }
/// <summary> /// 某个结点下的所有结点 /// </summary> /// <param name="pid"></param> /// <returns></returns> private string findpath(int pid) { string str = ""; List <Lebi_Pro_Type> types = EX_Product.Types(pid); if (types.Count == 0) { return(""); } foreach (Lebi_Pro_Type t in types) { if (str == "") { str = t.id.ToString(); } else { str += "," + t.id; } string f = findpath(t.id); //if (f != "") str += "," + f; } return(str); }
protected void Page_Load(object sender, EventArgs e) { tid = RequestTool.RequestInt("tid", 0); int pid = RequestTool.RequestInt("pid", 0); model = B_Lebi_Product.GetModel(pid); if (model == null) { model = new Lebi_Product(); } //Lebi_ProPerty_Type ptype = B_Lebi_ProPerty_Type.GetModel(tid); string property = EX_Product.ProductType_ProPertystr(tid, model.Supplier_id); if (property != "") { pros = B_Lebi_ProPerty.GetList("Type_id_ProPertyType in (132,133) and id in (" + property + ")", "Sort desc"); } if (pros == null) { pros = new List <Lebi_ProPerty>(); } ProPerty133 = Common.KeyValueToList(model.ProPerty133); if (tid == 0) { tid = model.Pro_Type_id; } }
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) { userlevelid = RequestTool.RequestInt("userlevelid"); userid = RequestTool.RequestInt("userid"); orderid = RequestTool.RequestInt("orderid"); typeid = RequestTool.RequestInt("typeid"); 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"; 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 + ")"; } }
protected void Page_Load(object sender, EventArgs e) { id = RequestTool.RequestInt("id", 0); if (id == 0) { if (!Power("supplier_product_add", "添加商品")) { PageReturnMsg = PageNoPowerMsg(); } addflag = true; } else { if (!Power("supplier_product_edit", "编辑商品")) { PageReturnMsg = PageNoPowerMsg(); } } action = RequestTool.RequestInt("action", 1); model = B_Lebi_Product.GetModel("(IsDel!=1 or IsDel is null) and Supplier_id = " + CurrentSupplier.id + " and id = " + id + ""); if (model == null) { model = new Lebi_Product(); Lebi_Product modellast = B_Lebi_Product.GetModel("(IsDel!=1 or IsDel is null) and Supplier_id = " + CurrentSupplier.id + " order by Time_Edit desc,id desc"); if (modellast != null) { model.Pro_Type_id = modellast.Pro_Type_id; } } if (model.Images != "") { if (model.Images.Substring(model.Images.Length - 1, 1) == "@") { model.Images = model.Images.Substring(0, model.Images.Length - 1); } if (model.Images.Substring(0, 1) != "@") { model.Images = "@" + model.Images; } } wap = Ishavewap(); StepPrices = EX_Product.StepPrice(model.StepPrice); if (StepPrices == null) { StepPrices = new List <ProductStepPrice>(); } UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice); if (UserLevelPrices == null) { UserLevelPrices = new List <ProductUserLevelPrice>(); } UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount); if (UserLevelCounts == null) { UserLevelCounts = new List <ProductUserLevelCount>(); } userlevels = B_Lebi_UserLevel.GetList("", "Grade asc"); }
/// <summary> /// 商品价格 /// </summary> public void ProducePrice() { int id = RequestTool.RequestInt("id"); int count = RequestTool.RequestInt("count", 1); Lebi_Product product = GetProduct(id); decimal price = EX_Product.ProductPrice(product, CurrentUserLevel, CurrentUser, count); Response.Write(FormatMoney(price)); }
protected void Page_Load(object sender, EventArgs e) { Random Random = new Random(); randnum = RequestTool.RequestInt("randnum", 0); id = RequestTool.RequestInt("id", 0); if (id == 0 || (id > 0 && randnum > 0)) { if (!EX_Admin.Power("product_add", "添加商品")) { PageNoPower(); } } else { if (!EX_Admin.Power("product_edit", "编辑商品")) { PageNoPower(); } } action = RequestTool.RequestInt("action", 1); model = B_Lebi_Product.GetModel(id); if (model == null) { model = new Lebi_Product(); model.Type_id_ProductType = 320; } wap = Ishavewap(); StepPrices = EX_Product.StepPrice(model.StepPrice); if (StepPrices == null) { StepPrices = new List <ProductStepPrice>(); } UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice); if (UserLevelPrices == null) { UserLevelPrices = new List <ProductUserLevelPrice>(); } UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount); if (UserLevelCounts == null) { UserLevelCounts = new List <ProductUserLevelCount>(); } userlevels = B_Lebi_UserLevel.GetList("", "Grade asc"); if (model.IsCombo == 1) { comboProducts = B_Lebi_Product_Combo.GetList("Product_id=" + model.id + "", ""); } else { comboProducts = new List <Lebi_Product_Combo>(); } }
/// <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> /// 返回子分类 /// </summary> /// <param name="id"></param> /// <returns></returns> public List <Lebi_Pro_Type> Cateporys(int id) { List <Lebi_Pro_Type> models = EX_Product.ShowTypes(id, CurrentSite.id); if (models.Count == 0) { Lebi_Pro_Type m = B_Lebi_Pro_Type.GetModel(id); if (m.Parentid > 0) { return(Cateporys(m.Parentid)); } } return(models); }
protected void Page_Load(object sender, EventArgs e) { Random Random = new Random(); randnum = RequestTool.RequestInt("randnum", 0); id = RequestTool.RequestInt("id", 0); if (id == 0 || (id > 0 && randnum > 0)) { if (!Power("supplier_product_add", "添加商品")) { PageNoPower(); } } else { if (!Power("supplier_product_edit", "编辑商品")) { PageNoPower(); } } action = RequestTool.RequestInt("action", 1); model = B_Lebi_Product.GetModel("Supplier_id = " + CurrentSupplier.id + " and (IsDel!=1 or IsDel is null) and id = " + id); if (model == null) { model = new Lebi_Product(); model.Type_id_ProductType = 320; } wap = Ishavewap(); StepPrices = EX_Product.StepPrice(model.StepPrice); if (StepPrices == null) { StepPrices = new List <ProductStepPrice>(); } UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice); if (UserLevelPrices == null) { UserLevelPrices = new List <ProductUserLevelPrice>(); } UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount); if (UserLevelCounts == null) { UserLevelCounts = new List <ProductUserLevelCount>(); } userlevels = B_Lebi_UserLevel.GetList("", "Grade asc"); }
public void LoadPage() { CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_Product'"); int id = Rint("id"); product = EX_Product.GetProduct(id); if (product.id == 0) { Response.End(); } Protype = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id); GetProWords(); supplier = B_Lebi_Supplier.GetModel(product.Supplier_id); if (supplier == null) { supplier = new Lebi_Supplier(); } product.IsSupplierTransport = supplier.IsSupplierTransport; }
/// <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(); } int Parentid = 0; string Types = ""; Thread thread = new Thread(() => { Types = ThreadGetSupplierProductTypeList(ids, id, supplierid, Parentid); }); thread.IsBackground = true; thread.Start(); thread.Join(); Response.Write(Types); }
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> /// <param name="pid"></param> /// <param name="deep"></param> /// <returns></returns> public string CreateTree(int pid, int deep, string lang) { string str = ""; if (deep == 0) { str += "<tr class=\"list\">"; str += "<td><a href=\"javascript:searchproduct(0)\"> + " + Language.Tag("全部分类", lang) + " </a></td></tr>"; } List <Lebi_Pro_Type> types = EX_Product.Types(pid); //将根节点进行遍历 string style = ""; string WebPath = RequestTool.GetConfigKey("WebPath").Trim().TrimEnd('/'); WebPath = WebPath + "/theme/system/systempage/admin/images/"; string showids = Shop.Tools.CookieTool.GetCookieString("showTypeids").Replace("%2C", ","); if (deep > 0) { style = "style=\"display:none;\""; } string image = ""; foreach (Lebi_Pro_Type t in types) { image = WebPath + "plus.gif"; if (showids.Contains("," + t.id + ",") || showids.Contains("," + t.Parentid + ",")) { style = ""; image = WebPath + "minus.gif"; } str += "<tr class=\"list\" name=\"tr" + t.Parentid + "\" " + style + " id=\"tr" + t.id + "\">"; //str += "<td style=\"text-align:center\"><input type='checkbox' id=\"check" + t.id + "\" value='" + t.id + "' name='id' del=\"del\" onclick=\"searchproduct();\" /></td>"; str += "<td>" + deepstr(deep) + "<img src=\"" + image + "\" name=\"img" + t.Parentid + "\" id=\"img" + t.id + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" onclick=\"ShowTree('" + findpath(t.id) + "'," + t.id + ")\" title=\"" + Shop.Bussiness.Language.Tag("展开", lang) + "\" />"; str += "<a href=\"javascript:searchproduct(" + t.id + ")\">" + Language.Content(t.Name, lang) + " </a></td></tr>"; str += CreateTree(t.id, deep + 1, lang); } return(str); }
public string StepPriceShow(Lebi_Product pro) { string str = ""; List <ProductStepPrice> StepPrices = EX_Product.StepPrice(pro.StepPrice); if (StepPrices == null) { StepPrices = new List <ProductStepPrice>(); } if (StepPrices.Count > 0) { foreach (var v in StepPrices) { if (v.Count > 1) { str += ">" + v.Count + ":" + FormatMoney(v.Price) + ";"; } } } str = str.Trim(';'); return(str); }
/// <summary> /// 生成分类列表 /// </summary> /// <param name="pid"></param> /// <param name="deep"></param> /// <returns></returns> public void CreateTree() { int pid = RequestTool.RequestInt("pid"); int deep = RequestTool.RequestInt("deep"); string str = ""; //的道所有的更节点 // List<Lebi_Pro_Type> types = B_Lebi_Pro_Type.GetList("Parentid=" + pid + "", "Sort desc"); List <Lebi_Pro_Type> types = EX_Product.Types(pid); //将根节点进行遍历 string style = ""; foreach (Lebi_Pro_Type t in types) { int count = B_Lebi_Pro_Type.Counts("Parentid=" + t.id + ""); str += "<tr class=\"list\" name=\"tr" + t.Parentid + "\" " + style + " id=\"tr" + t.id + "\">"; str += "<td>" + deepstr(deep); if (count > 0) { str += "<img src=\"" + AdminImage("plus.gif") + "\" name=\"img" + t.Parentid + "\" id=\"img" + t.id + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" onclick=\"ShowChild('" + findpath(t.id) + "'," + t.id + "," + (deep + 1) + ")\" title=\"" + Tag("展开") + "\" /> "; } else { str += "<img src=\"" + AdminImage("minus.gif") + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" /> "; } if (t.ImageSmall != "") { str += "<img src=\"" + t.ImageSmall + "\" height=\"16\" /> "; } str += Language.Content(t.Name, CurrentLanguage.Code) + " <a href=\"" + Shop.Bussiness.ThemeUrl.GetURL("P_ProductCategory", t.id.ToString(), "", CurrentLanguage.Code) + "\" target=\"_blank\"><img src=\"" + PageImage("icon/newWindow.png") + "\" style=\"vertical-align:absmiddle\" /></a></td>"; str += "<td>" + Shop.Bussiness.EX_Product.TypeProductCount(t.id) + "</td>"; str += "<td>" + Shop.Bussiness.EX_Product.LikeProductCount(t.id) + "</td>"; str += "<td>" + Shop.Bussiness.EX_Product.SalesProductCount(t.id) + "</td>"; str += "<td>" + Shop.Bussiness.EX_Product.ViewsProductCount(t.id) + "</td>"; str += "</tr>"; } Response.Write(str); }
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, ""); }
public string CreateList(string key) { string str = ""; List <Lebi_Pro_Type> types = B_Lebi_Pro_Type.GetList("Name like lbsql{'%" + key + "%'}", "Sort desc"); //将根节点进行遍历 foreach (Lebi_Pro_Type t in types) { string caozuo = "<a href=\"javascript:Edit(" + t.id + ",0)\">" + Tag("添加子类") + "</a> | <a href=\"javascript:Edit(0," + t.id + ")\">" + Tag("编辑") + "</a> | <a href=\"javascript:Del(" + t.id + ")\">" + Tag("删除") + "</a>"; str += "<tr class=\"list\" name=\"tr" + t.Parentid + "\" id=\"tr" + t.id + "\">"; str += "<td style=\"text-align:center\"><input type='checkbox' id=\"check" + t.id + "\" value='" + t.id + "' name='id' del=\"del\" /></td>"; str += "<td>" + t.id + "</td>"; str += "<td>"; if (t.ImageSmall != "") { str += "<img src=\"" + t.ImageSmall + "\" height=\"16\" /> "; } str += Language.Content(t.Name, CurrentLanguage.Code) + " <a href=\"" + Shop.Bussiness.ThemeUrl.GetURL("P_ProductCategory", t.id.ToString(), "", CurrentLanguage.Code) + "\" target=\"_blank\"><img src=\"" + PageImage("icon/newWindow.png") + "\" /></a></td>"; str += "<td>" + Shop.Tools.Utils.GetUnicodeSubString(ProPertystring(t.ProPerty132), 100, "...") + "</td>"; str += "<td>" + Shop.Tools.Utils.GetUnicodeSubString(ProPertystring(t.ProPerty131), 100, "...") + "</td>"; str += "<td><a href=\"default.aspx?Pro_Type_id=" + t.id + "&Type_id_ProductType=320,321,322,323\">" + EX_Product.TypeProductCount(t.id) + "</a></td>"; str += "<td>" + t.Sort + "</td>"; str += "<td>" + (t.IsShow == 1 ? "" + Tag("是") + "" : "" + Tag("否") + "") + "</td>"; str += "<td>" + (t.IsIndexShow == 1 ? "" + Tag("是") + "" : "" + Tag("否") + "") + "</td>"; str += "<td>" + caozuo + "</td></tr>"; //CreateSunNode(int.Parse(ds.Tables[0].Rows[i]["id"].ToString()), ",0", ss); } return(str); }
protected void Page_Load(object sender, EventArgs e) { Random Random = new Random(); t = RequestTool.RequestString("t"); id = RequestTool.RequestInt("id", 0); model = B_Lebi_Product.GetModel(id); int Type_id_ProductType = RequestTool.RequestInt("Type_id_ProductType", 320); if (id == 0 || (id > 0 && t == "copy")) { if (!EX_Admin.Power("product_add", "添加商品")) { PageReturnMsg = PageNoPowerMsg(); } ////如果添加商品时随机数小于9位数 重定向生成随机数 防止破坏已有数据 //if (randnum.ToString().Length < 9) //{ // Response.Redirect(site.AdminPath + "/product/product_edit.aspx?id=" + id + "&t=" + t + "&randnum=" + Random.Next(100000000, 999999999)); // Response.End(); // return; //} } else { if (!EX_Admin.Power("product_edit", "编辑商品")) { PageReturnMsg = PageNoPowerMsg(); } if (site.SiteCount > 1 && CurrentAdmin.Site_ids != "" && model.Site_ids != "") { string[] psids = model.Site_ids.Split(','); bool flag = false; foreach (string pdis in psids) { if (("," + CurrentAdmin.Site_ids + ",").Contains("," + pdis + ",")) { flag = true; } } if (!flag) { PageReturnMsg = PageErrorMsg(); } } } action = RequestTool.RequestInt("action", 1); if (model == null) { model = new Lebi_Product(); model.Site_ids = site.Sitesid(); model.Type_id_ProductType = Type_id_ProductType; Lebi_Product modellast = B_Lebi_Product.GetModel("Type_id_ProductType = " + Type_id_ProductType + " and Supplier_id = 0 order by Time_Edit desc,id desc"); if (modellast != null) { model.Pro_Type_id = modellast.Pro_Type_id; } } else { if (t == "copy") { model.id = 0; } } if (model.Images != "") { if (model.Images.Substring(model.Images.Length - 1, 1) == "@") { model.Images = model.Images.Substring(0, model.Images.Length - 1); } if (model.Images.Substring(0, 1) != "@") { model.Images = "@" + model.Images; } } StepPrices = EX_Product.StepPrice(model.StepPrice); if (StepPrices == null) { StepPrices = new List <ProductStepPrice>(); } UserLevelPrices = EX_Product.UserLevelPrice(model.UserLevelPrice); if (UserLevelPrices == null) { UserLevelPrices = new List <ProductUserLevelPrice>(); } UserLevelCounts = EX_Product.UserLevelCount(model.UserLevelCount); if (UserLevelCounts == null) { UserLevelCounts = new List <ProductUserLevelCount>(); } userlevels = B_Lebi_UserLevel.GetList("", "Grade asc"); wap = Ishavewap(); if (model.IsCombo == 1) { comboProducts = B_Lebi_Product_Combo.GetList("Product_id=" + model.id + "", ""); } else { comboProducts = new List <Lebi_Product_Combo>(); } }
/// <summary> /// 订单发货通知-不更新库存 /// </summary> public void mSndGoods() { //OrderID 订单编号 //OrderNO 原始订单编号 //CustomerID 客户网名 //SndStyle 发货方式 //BillID 货运单号 //SndDate 发货时间 string OrderID = RequestTool.RequestString("OrderID"); string OrderNO = RequestTool.RequestString("OrderNO"); string CustomerID = RequestTool.RequestString("CustomerID"); string SndStyle = RequestTool.RequestString("SndStyle"); string BillID = RequestTool.RequestString("BillID"); string SndDate = RequestTool.RequestString("SndDate"); Lebi_Order model = B_Lebi_Order.GetModel("Code=lbsql{'" + OrderNO + "'}"); Lebi_Language_Code lang = Language.DefaultLanguage(); string res = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; if (model == null) { res += "<rsp><result>0</result><cause>无此单号</cause></rsp>"; Response.Write(res); return; } Lebi_Transport tran = B_Lebi_Transport.GetModel("[Name]=lbsql{'" + SndStyle + "'}"); if (tran == null) { tran = new Lebi_Transport(); } Lebi_Transport_Order torder = new Lebi_Transport_Order(); torder.Code = BillID; torder.Order_id = model.id; torder.T_Address = model.T_Address; torder.T_Email = model.T_Email; torder.T_MobilePhone = model.T_MobilePhone; torder.T_Name = model.T_Name; torder.T_Phone = model.T_Phone; torder.Transport_Code = tran == null ? model.Transport_Code : tran.Code; torder.Transport_id = tran == null ? model.Transport_id : tran.id; torder.Transport_Name = tran == null ? model.Transport_Name : tran.Name; torder.User_id = model.User_id; List <TransportProduct> tps = new List <TransportProduct>(); TransportProduct tp; List <Lebi_Order_Product> pros = B_Lebi_Order_Product.GetList("Order_id=" + model.id + "", ""); bool isfahuo_all = true; foreach (Lebi_Order_Product pro in pros) { tp = new TransportProduct(); tp.Count = pro.Count; tp.ImageBig = pro.ImageBig; tp.ImageMedium = pro.ImageMedium; tp.ImageOriginal = pro.ImageOriginal; tp.ImageSmall = pro.ImageSmall; tp.Product_Number = pro.Product_Number; tp.Product_id = pro.Product_id; tp.Product_Name = pro.Product_Name; tps.Add(tp); pro.Count_Shipped = pro.Count; B_Lebi_Order_Product.Update(pro); //更新库存 Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id); EX_Product.ProductStock_Change(product, (0 - pro.Count), 302, model); } JavaScriptSerializer jss = new JavaScriptSerializer(); torder.Product = jss.Serialize(tps); torder.Type_id_TransportOrderStatus = 220;//默认状态:在途 B_Lebi_Transport_Order.Add(torder); model.IsShipped = 1; model.IsShipped_All = isfahuo_all ? 1 : 0; model.Time_Shipped = System.DateTime.Now;; B_Lebi_Order.Update(model); Log.Add("订单发货-网站管家", "Order", model.id.ToString()); //发送邮件 if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdanfahuo")) { Lebi_User user = B_Lebi_User.GetModel(model.User_id); Email.SendEmail_ordershipping(user, model, torder); } res += "<rsp><result>1</result></rsp>"; Response.Write(res); Log.Add("订单编号:" + OrderNO + "--" + res, "网店管家同步发货", ""); }
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, ""); }
/// <summary> /// 发表商品评价 /// </summary> public void Comment_Write() { int id = RequestTool.RequestInt("id", 0); //int Product_id = 0; if (!Comment.CheckSafeWord(RequestTool.RequestSafeString("Content"))) { Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}"); return; } Lebi_Order_Product Order_Product = B_Lebi_Order_Product.GetModel("User_id=" + CurrentUser.id + " and id = " + id); if (Order_Product == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } else { Lebi_Order order = B_Lebi_Order.GetModel(Order_Product.Order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("无效订单") + "\"}"); return; } else { if (order.IsReceived == 0) { Response.Write("{\"msg\":\"" + Tag("已购买商品在已收货之后才可以发表评价") + "\"}"); return; } } Order_Product.IsCommented = 1; B_Lebi_Order_Product.Update(Order_Product); } Lebi_Product checkproduct = B_Lebi_Product.GetModel(Order_Product.Product_id); if (checkproduct == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); model.TableName = "Product"; model.Keyid = Order_Product.Product_id; model.Admin_UserName = "******"; model.Admin_id = 0; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.NickName; model.Content = RequestTool.RequestSafeString("Content"); model.Star = RequestTool.RequestInt("Star", 5); model.Parentid = 0; model.Status = 280; model.Time_Add = System.DateTime.Now; model.Language_Code = CurrentLanguage.Code; model.Images = RequestTool.RequestSafeString("Images"); model.ImagesSmall = RequestTool.RequestSafeString("ImagesSmall"); model.Product_id = Order_Product.Product_id; model.IsRead = 1; model.Supplier_id = checkproduct.Supplier_id; B_Lebi_Comment.Add(model); //List<Lebi_Order_Product> modelproducts = B_Lebi_Order_Product.GetList("User_id=" + CurrentUser.id + " and id = " + id + "", ""); //foreach (Lebi_Order_Product modelproduct in modelproducts) //{ // modelproduct.IsCommented = 1; // B_Lebi_Order_Product.Update(modelproduct); //} Lebi_Product product = B_Lebi_Product.GetModel(Order_Product.Product_id); if (product != null) { EX_Product.UpdateStar(product); } model.id = B_Lebi_Comment.GetMaxId(); //处理图片 ImageHelper.LebiImagesUsed(model.Images, "comment", model.id); //发送邮件 Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Email.SendEmail_comment(user, model); //发送短信 SMS.SendSMS_comment(user, model); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 添加或修改 /// 收藏141或 /// 购物车142 /// 浏览历史143 /// </summary> public void UserProduct_Edit() { int t = RequestTool.RequestInt("type", 141); //默认收藏 int num = RequestTool.RequestInt("num", 1); //默认数量1 int pid = RequestTool.RequestInt("pid", 0); if (t != 142) { num = 1; } if (num <= 0) { num = 1; } string property = RequestTool.RequestSafeString("property"); string propertypriceids = RequestTool.RequestSafeString("propertypriceids"); int warndays = RequestTool.RequestInt("warndays", 0); string mes = ""; if (t != 141 && t != 142 && t != 143 && t != 144) { Response.Write("{\"msg\":\"OK\"}"); return; } if ((t == 141 || t == 144) && CurrentUser.id == 0) { Response.Write("{\"msg\":\"" + Tag("请先登陆") + "\",\"url\":\"" + URL("P_Login", "") + "\"}"); return; } //<-{ 判断是否上架状态 by lebi.kingdge 2015-02-10 Lebi_Product pro = B_Lebi_Product.GetModel("id = " + pid + ""); if (pro == null) { return; } if (t == 142) { int levelcount = ProductLevelCount(pro); if (num < levelcount) { num = levelcount; Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("起订量") + " " + levelcount + "\"}"); return; } } if (pro.Type_id_ProductStatus != 101) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经下架") + "\"}"); return; } if (ProductStock(pro) < 1 && pro.Type_id_ProductType != 324 && SYS.IsNullStockSale != "1") { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经售罄") + "\"}"); return; } if ((pro.Type_id_ProductType == 321 || pro.Type_id_ProductType == 322) & (System.DateTime.Now < pro.Time_Start)) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("尚未开始") + "\"}"); return; } if ((pro.Type_id_ProductType == 321 || pro.Type_id_ProductType == 322) & (System.DateTime.Now > pro.Time_Expired)) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("已结束") + "\"}"); return; } if (CurrentUserLevel.BuyRight == 0 && t == 142) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("无权购买") + "\"}"); return; } if (EX_Product.ProductPrice(pro, CurrentUserLevel, CurrentUser) < 0 && t == 142) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("无权购买") + "\"}"); return; } //用户的商品权限 if (Shop.LebiAPI.Service.Instanse.Check("plugin_productlimit") && t == 142) { if (SYS.ProductLimitType == "1")//选择表允许 { int lc = B_Lebi_Product_Limit.Counts("(Product_id=" + pro.id + " or Product_id=" + pro.Product_id + ") and User_id=" + CurrentUser.id + " and IsShow=1 and IsPriceShow=1 and IsBuy=1"); if (lc == 0) { lc = B_Lebi_Product_Limit.Counts("(Product_id=" + pro.id + " or Product_id=" + pro.Product_id + ") and UserLevel_id=" + CurrentUserLevel.id + " and IsShow=1 and IsPriceShow=1 and IsBuy=1"); if (lc > 0) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("无权购买") + "\"}"); return; } } } else { int lc = B_Lebi_Product_Limit.Counts("(Product_id=" + pro.id + " or Product_id=" + pro.Product_id + ") and User_id=" + CurrentUser.id + " and IsShow=1 and IsPriceShow=1 and IsBuy=1"); if (lc == 0) { lc = B_Lebi_Product_Limit.Counts("(Product_id=" + pro.id + " or Product_id=" + pro.Product_id + ") and UserLevel_id=" + CurrentUserLevel.id + " and IsShow=1 and IsPriceShow=1 and IsBuy=1"); if (lc > 0) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("无权购买") + "\"}"); return; } } else { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("无权购买") + "\"}"); return; } } } //if (!("," + pro.UserLevel_ids_buy + ",").Contains("," + CurrentUserLevel.id + ",") && pro.UserLevel_ids_buy != "" && t == 142) //{ // Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("无权购买") + "\"}"); // return; //} //}-> EX_User.UserProduct_Edit(CurrentUser, pid, num, t, property, warndays, propertypriceids); if (t == 141) { mes = Tag("商品已加入收藏夹"); } else if (t == 144) { mes = Tag("商品已加入常购清单"); } else { Basket basket = new Basket(0); mes = Tag("商品已加入购物车") + "<div>" + Tag("数量") + " <span>" + basket.Count + "</span> " + Tag("件") + " <span>" + FormatMoney(basket.Money_Product) + "</span></div><div><a href='" + URL("P_Basket", "") + "' class='btn btn-7'><s></s>" + Tag("查看购物车") + "</a> <a href='javascript:void(0)' onclick='cloesedialog();' class='btn btn-11'><s></s>" + Tag("关闭") + "</a></div>"; } Response.Write("{\"msg\":\"OK\",\"count\":\"" + Basket_Product_Count() + "\",\"amount\":\"" + FormatMoney(Basket_Product_Price()) + "\",\"mes\":\"" + mes + "\",\"url\":\"" + URL("P_AddToBasket", "") + "\"}"); }
public decimal Money_Tax = 0; //税金 /// <summary> /// sid=0,取得全部供应商的商品 /// </summary> /// <param name="type"></param> public Basket(int sid) { Products = Basket.UserProduct(CurrentUser, 142); PromotionTypes = new List <Lebi_Promotion_Type>(); FreeProducts = new List <Lebi_User_Product>(); Shops = new List <BasketShop>(); List <BasketShop> tempShops = new List <BasketShop>(); List <string> brandstring = new List <string>(); foreach (Lebi_User_Product pro in Products) { try { Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id); if (product == null) { continue; } bool ishavebrand = false; for (int i = 0; i < brandstring.Count(); i++) { if (brandstring[i].Contains(product.Brand_id.ToString() + ":")) { brandstring[i] += "," + pro.Product_id; ishavebrand = true; break; } } if (!ishavebrand) { brandstring.Add(product.Brand_id.ToString() + ":" + pro.Product_id); } if (product.Type_id_ProductType == 324) //预定商品 { pro.Product_Price = product.Price_reserve; //预定金额 } else { pro.Product_Price = EX_Product.ProductPrice(product, CurrentUserLevel, CurrentUser, pro.count);//单价 } //<-{计算品牌不含税商品总额 by lebi.kingdge 2015-08-22 Lebi_Brand brand = B_Lebi_Brand.GetModel(product.Brand_id); if (brand != null) { if (brand.IsVAT == 0) { Money_Product_NOVAT += pro.Product_Price * pro.count; } } //}-> Lebi_Supplier shop = B_Lebi_Supplier.GetModel(product.Supplier_id); if (shop == null) { product.Supplier_id = 0; //容错,商品供应商删除时,商城发货 shop = new Lebi_Supplier(); //自营商品 } else { if (shop.IsSupplierTransport == 0)//商城代发货的情况 { product.Supplier_id = 0; shop = new Lebi_Supplier();//自营商品 } } BasketShop bshop = (from m in tempShops where m.Shop.id == product.Supplier_id select m).ToList().FirstOrDefault(); if (bshop == null) { if (product.Supplier_id == 0) { //shop = new Lebi_Supplier();//自营商品 bshop = new BasketShop(); bshop.Shop = shop; bshop.Products = new List <Lebi_User_Product>(); tempShops.Add(bshop); } else { bshop = new BasketShop(); bshop.Shop = shop; bshop.Products = new List <Lebi_User_Product>(); tempShops.Add(bshop); } } (from m in tempShops where m.Shop.id == product.Supplier_id select m).ToList().FirstOrDefault().Products.Add(pro); } catch (System.NullReferenceException) { } } tempShops = tempShops.OrderBy(a => a.Shop.id).ToList(); if (SYS.IsSupplierCash == "1") { if (sid == 0) { sid = RequestTool.RequestInt("sid"); } if (sid == 0) { string tempid = CookieTool.GetCookieString("supplier"); int.TryParse(tempid, out sid); } cashsupplierid = sid; bool flag = false; foreach (BasketShop shop in tempShops) { if (shop.Shop.IsCash == 1) { IsMutiCash = true; } if (shop.Shop.id == cashsupplierid) { flag = true; } } if (!flag) { try { cashsupplierid = tempShops.FirstOrDefault().Shop.id; } catch { cashsupplierid = 0; } } if (sid > 0) { //只保留当前结算供应商的数据 List <int> ids = new List <int>(); for (int i = 0; i < tempShops.Count; i++) { if (tempShops[i].Shop.id == cashsupplierid) { Shops.Add(tempShops[i]); } } } else { Shops = tempShops; } } else { Shops = tempShops; } Products = new List <Lebi_User_Product>(); for (int i = 0; i < Shops.Count; i++) { Shops[i] = SetMoneyAndPoint(CurrentUser, CurrentUserLevel, Shops[i]); Weight += Shops[i].Weight; Volume += Shops[i].Volume; Money_Product += Shops[i].Money_Product; Money_Product_begin += Shops[i].Money_Product_begin; Money_Property += Shops[i].Money_Property; Money_Cut += Shops[i].Money_Cut; Money_Give += Shops[i].Money_Give; Money_Market += Shops[i].Money_Market; Count += Shops[i].Count; Point += Shops[i].Point; Point_Buy += Shops[i].Point_Buy; Point_Product += Shops[i].Point_Product; Point_Free += Shops[i].Point_Free; FreeProducts.AddRange(Shops[i].FreeProducts); PromotionTypes.AddRange(Shops[i].PromotionTypes); Products.AddRange(Shops[i].Products); } //<-{退税计算 by lebi.kingdge 2015-08-22 decimal Refund_MinMoney = 0; decimal Refund_VAT = 0; decimal.TryParse(SYS.Refund_MinMoney, out Refund_MinMoney); decimal.TryParse(SYS.Refund_VAT, out Refund_VAT); if (Refund_MinMoney > 0) { if ((Money_Product - Money_Product_NOVAT) > Refund_MinMoney) { Money_Refund_VAT = (Money_Product - Money_Product_NOVAT) * Refund_VAT / 100; Money_Refund_Fee = Refund_Fee(SYS.Refund_StepR, Money_Refund_VAT, Money_Product - Money_Product_NOVAT); Money_Refund = Money_Refund_VAT - Money_Refund_Fee; } else { Money_Refund = 0; Money_Refund_VAT = 0; Money_Refund_Fee = 0; } //循环品牌计算各品牌退税 if (Refund_VAT > 0) { foreach (string bran in brandstring) { string[] arr = bran.Split(':'); Lebi_Brand brand = B_Lebi_Brand.GetModel("id=" + arr[0] + " and IsVAT = 1"); if (brand != null) { decimal Brand_Money_Product = 0; decimal OtherSite_Money_Refund_VAT = 0; decimal OtherSite_Money_Refund_Fee = 0; List <Lebi_User_Product> user_products = (from m in Products where ("," + arr[1] + ",").Contains("," + m.Product_id + ",") select m).ToList(); foreach (Lebi_User_Product user_product in user_products) { Brand_Money_Product += user_product.Product_Price * user_product.count; } if (Brand_Money_Product >= Refund_MinMoney) { OtherSite_Money_Refund_VAT = Brand_Money_Product * Refund_VAT / 100; OtherSite_Money_Refund_Fee = Refund_Fee(SYS.Refund_StepR, OtherSite_Money_Refund_VAT, Brand_Money_Product); OtherSite_Money_Refund += OtherSite_Money_Refund_VAT - OtherSite_Money_Refund_Fee; } } } } } //}-> //<-{税金计算 by lebi.kingdge 2017-02-17 decimal TaxRate = 0; decimal.TryParse(SYS.TaxRate, out TaxRate); if (TaxRate > 0) { Money_Tax = Money_Product * TaxRate / 100; } //}-> }
/// <summary> /// 计算促销活动 /// </summary> /// <param name="Products">商品信息</param> /// <param name="CurrentUser">购买者</param> /// <param name="shop">供应商,为空表示自营商品</param> /// <param name="basketshop"></param> public static BasketShop SetMoneyAndPoint(Lebi_User CurrentUser, Lebi_UserLevel CurrentUserLevel, BasketShop basketshop) { string pids = "0"; decimal Money_Product_begin = 0; int Count = 0; decimal Weight = 0; //订单总重量 decimal Volume = 0; //订单总体积 int Money_Transport_One = 0; bool IsTransportPriceOne = false; decimal Money_Market = 0; decimal Money_Cut = 0; decimal Money_Give = 0; decimal Point_Free = 0; //赠送积分 decimal Point_Product = 0; //商品获得的积分 decimal Point = 0; //获得的积分总数 decimal Point_Buy = 0; //积分换购所需积分 decimal Money_Product = 0; decimal Money_Property = 0; List <Lebi_User_Product> FreeProducts = new List <Lebi_User_Product>(); List <Lebi_Promotion_Type> PromotionTypes = new List <Lebi_Promotion_Type>(); if (CurrentUserLevel == null) { CurrentUserLevel = B_Lebi_UserLevel.GetModel(CurrentUser.UserLevel_id); } List <Lebi_User_Product> Products = basketshop.Products; Lebi_Supplier shop = basketshop.Shop; foreach (Lebi_User_Product pro in Products) { Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id); if (product == null) { continue; } pro.Discount = 100; pro.Pointagain = 1; //pro.Product_Price = EX_Product.ProductPrice(product, CurrentUserLevel,pro.count);//单价 if (CurrentUserLevel.MoneyToPoint > 0) { pro.Product_Point = pro.Product_Price * CurrentUserLevel.MoneyToPoint + pro.Product_Point;//单个产品可得的积分 } pids += "," + pro.Product_id; Money_Product_begin = Math.Round(Money_Product_begin + pro.Product_Price * pro.count, 2); Count = Count + pro.count; Money_Market = Money_Market + EX_Product.ProductMarketPrice(product) * pro.count; //兼容分销 2018.3.8 by lebi.kingdge Money_Property = Money_Property + pro.ProPerty_Price * pro.count; Money_Product = Money_Product + pro.Product_Price * pro.count; Weight = Weight + product.Weight * pro.count; Volume = Volume + product.VolumeH * product.VolumeL * product.VolumeW * pro.count; Point_Product = Point_Product + Math.Round(pro.Product_Point * pro.count, 2); Point = Point_Product + Point_Free; //320一般商品321限时抢购322团购323积分换购 if (product.Type_id_ProductType == 323 && product.Time_Expired > System.DateTime.Now) { Point_Buy = Point_Buy + product.Price_Sale * pro.count; } } List <Lebi_Promotion_Type> cps = Promotion.CurrentPromotionType(); if (shop == null) { shop = new Lebi_Supplier(); } foreach (Lebi_Promotion_Type cp in cps) { //检查是否商铺单独促销 if (cp.Type_id_PromotionType == 421) { if (shop.id > 0) { continue; } } if (cp.Type_id_PromotionType == 422) { if (shop.id != cp.Supplier_id) { continue; } } //检查会员组别 if (!("," + cp.UserLevel_ids + ",").Contains("," + CurrentUserLevel.id + ",")) { continue; } bool flag = true; string where = "1=1"; List <Lebi_User_Product> sps = null; foreach (Lebi_Promotion p in Promotion.GetPromotion(cp.id))//只匹配一个条件 { flag = true; if (p.Case804 == "") { p.Case804 = "0"; } if (p.Case805 == "") { p.Case805 = "0"; } //验证订单金额:801 if (p.IsCase801 == 1) { if (Money_Product_begin < p.Case801) { flag = false; continue; } } //验证订单商品数量:802 if (p.IsCase802 == 1) { if (Count < p.Case802) { flag = false; continue; } } //验证商品分类:804 if (p.IsCase804 == 1) { where += " and Pro_Type_id in (" + p.Case804 + ")"; if (B_Lebi_Product.Counts("id in (" + pids + ") and Pro_Type_id in (" + p.Case804 + ")") == 0) { flag = false; continue; } } //验证限制商品:805 if (p.IsCase805 == 1) { where += "and id in (" + p.Case805 + ")"; if (B_Lebi_Product.Counts("id in (" + pids + ") and id in (" + p.Case805 + ")") == 0) { flag = false; continue; } } //验证单品数量:803 if (p.IsCase803 == 1) { string tids = "0"; //取出购物车中,数量大于水平线的商品 foreach (Lebi_User_Product up in Products) { if (up.count >= p.Case803) { tids += "," + up.Product_id; } } if (tids == "0") { flag = false; continue; } where += " and id in (" + tids + ")"; if (B_Lebi_Product.Counts(where) == 0) { flag = false; continue; } } //验证订单内指定商品数量:806 if (p.IsCase806 == 1) { if (p.Case804 == "" && p.Case805 == "")//未设置限制条件的话,直接失败 { flag = false; continue; } int count = 0; //计算购物车中包含商品的总数 foreach (Lebi_User_Product up in Products) { if (("," + p.Case804 + ",").Contains("," + up.Pro_Type_id + ",") || ("," + p.Case805 + ",").Contains("," + up.Product_id + ",")) { count = count + up.count; } } if (count < p.Case806) { flag = false; continue; } } //条件检查结束 if (flag) { //取出验证成功的指定商品 sps = B_Lebi_User_Product.GetList("User_id=" + CurrentUser.id + " and type_id_UserProductType=142 and Product_id in (select id from [Lebi_Product] where " + where + ")", ""); //计算定额运费901 if (p.IsRule901 == 1) { Money_Transport_One = p.Rule901; IsTransportPriceOne = true; } //计算折扣902 if (p.IsRule902 == 1) { foreach (Lebi_User_Product pro in Products) { pro.Discount = pro.Discount * p.Rule902 / 100; } } //计算指定商品折扣903 if (p.IsRule903 == 1) { if (sps != null) { foreach (Lebi_User_Product pro in Products) { foreach (Lebi_User_Product sp in sps) { if (pro.id == sp.id) { pro.Discount = pro.Discount * p.Rule903 / 100; } } } } } //计算减免金额904 if (p.IsRule904 == 1) { Money_Cut = p.Rule904; } //计算返还金额905 if (p.IsRule905 == 1) { Money_Give = p.Rule905; } //计算赠送积分906 if (p.IsRule906 == 1) { Point_Free = p.Rule906; } //计算翻倍积分907 if (p.IsRule907 == 1) { foreach (Lebi_User_Product pro in Products) { pro.Pointagain = pro.Pointagain + p.Rule907; } } //计算指定商品折扣翻倍积分908 if (p.IsRule908 == 1) { if (sps != null) { foreach (Lebi_User_Product pro in Products) { foreach (Lebi_User_Product sp in sps) { if (pro.id == sp.id) { pro.Pointagain = pro.Pointagain + p.Rule908; } } } } } //赠送商品909 if (p.IsRule909 == 1) { //暂时不做 } //赠送指定商品910 if (p.IsRule910 == 1) { if (sps != null) { foreach (Lebi_User_Product sp in sps) { sp.count = p.Rule910; sp.Product_Price = 0; sp.Product_Point = 0; sp.Pointagain = 0; sp.Discount = 0; FreeProducts.Add(sp); } } } //第N个指定商品打折 if (p.IsRule912 == 1 && p.IsCase803 == 1 && p.Case803 > 0) { foreach (Lebi_User_Product pro in Products) { foreach (Lebi_User_Product sp in sps) { if (pro.id == sp.id) { if (pro.count > p.Case803) { int n = sp.count / p.Case803; Money_Cut = Money_Cut + pro.Product_Price * (100 - p.Rule912) / 100 * n; } } } } } //重新计算价格积分, Money_Product = 0; Point_Product = 0; Point = 0; foreach (Lebi_User_Product pro in Products) { Money_Product += Math.Round(pro.Product_Price * pro.count * pro.Discount / 100, 2); Point_Product += Math.Round(pro.Product_Point * pro.count * pro.Pointagain); Point = Point_Product + Point_Free; } break;//验证成功不再验证 } } if (flag) { PromotionTypes.Add(cp); } } basketshop = new BasketShop(); basketshop.FreeProducts = FreeProducts; basketshop.Money_Cut = Money_Cut; basketshop.Money_Give = Money_Give; basketshop.Money_Market = Money_Market; basketshop.Money_Product = Money_Product; basketshop.Money_Product_begin = Money_Product_begin; basketshop.Money_Transport = 0; basketshop.Point = Point; basketshop.Point_Free = Point_Free; basketshop.Point_Buy = Point_Buy; basketshop.Point_Product = Point_Product; basketshop.Products = Products; basketshop.PromotionTypes = PromotionTypes; basketshop.Shop = shop; basketshop.Volume = Volume; basketshop.Weight = Weight; basketshop.IsTransportPriceOne = IsTransportPriceOne; basketshop.Money_Transport_One = Money_Transport_One; basketshop.Count = Count; basketshop.Money_Property = Money_Property; return(basketshop); }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); id = Rint_Para("0"); //商品分类 pid = Rint_Para("1"); //品牌 cid = Rstring_Para("2"); //属性 list = Rstring_Para("3"); //列表或网格 sort = Rstring_Para("4"); //排序 tid = Rint_Para("5"); //商品标签 transport = Rint_Para("7"); //配送 0全部 1商城 2商家 stock = Rint_Para("8"); //是否有库存 1只显示有货 pageindex = RequestTool.RequestInt("page", 1); pro_type = B_Lebi_Pro_Type.GetModel(id); if (pro_type == null) { pro_type = new Lebi_Pro_Type(); } if (Lang(pro_type.Url) != "") //如果存在自定义URL 跳转至自定义URL by kingdge 2014-10-30 { Response.Redirect(Lang(pro_type.Url)); Response.End(); return; } property = EX_Product.ProductType_ProPerty(pro_type); if (property == null) { property = new Lebi_Pro_Type(); property.ProPerty132 = "0"; } if (property.ProPerty132 == "") { property.ProPerty132 = "0"; } path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</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); 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 (DataBase.DBType == "sqlserver") { where += " and Charindex('," + tid + ",',','+Pro_Tag_id+',')>0"; } if (DataBase.DBType == "access") { where += " and Instr(','+Pro_Tag_id+',','," + tid + ",')>0"; } } if (transport == 1) { where += " and IsSupplierTransport = 0"; } else if (transport == 2) { where += " and IsSupplierTransport = 1"; } if (stock == 1) { where += " and Count_Stock > 0"; } if (sort == "1") { order = " Count_Sales_Show desc"; ordertmp = "a"; } else if (sort == "1a") { order = " Count_Sales_Show asc"; ordertmp = ""; } else if (sort == "2") { order = " Price desc"; ordertmp = "a"; } else if (sort == "2a") { order = " Price asc"; ordertmp = ""; } else if (sort == "3") { order = " Count_Comment desc"; ordertmp = "a"; } else if (sort == "3a") { order = " Count_Comment asc"; ordertmp = ""; } else if (sort == "4") { order = " Time_Add desc"; ordertmp = "a"; } else if (sort == "4a") { order = " Time_Add asc"; ordertmp = ""; } else if (sort == "5") { order = " Count_Views_Show desc"; ordertmp = "a"; } else if (sort == "5a") { order = " Count_Views_Show asc"; ordertmp = ""; } else if (sort == "6") { order = " Count_Stock desc"; ordertmp = "a"; } else if (sort == "6a") { order = " Count_Stock asc"; ordertmp = ""; } else { order = " Sort desc,id desc"; ordertmp = ""; } products = B_Lebi_Product.GetList(where, order, PageSize, pageindex); recordCount = B_Lebi_Product.Counts(where); //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6} string url = URL("P_ProductCategory", id + "," + pid + "," + cid + "," + list + "," + sort + "," + tid + ",{0}," + transport + "," + stock + "", Lang(pro_type.Url)); HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage); FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage); }
public string CreateTree(int pid, int deep) { string str = ""; //的道所有的更节点 // List<Lebi_Pro_Type> types = B_Lebi_Pro_Type.GetList("Parentid=" + pid + "", "Sort desc"); List <Lebi_Pro_Type> types = EX_Product.Types(pid); //将根节点进行遍历 string style = ""; if (deep > 0) { style = "style=\"display:none;\""; } string showids = Shop.Tools.CookieTool.GetCookieString("showTypeids").Replace("%2C", ","); string image = ""; foreach (Lebi_Pro_Type t in types) { image = AdminImage("plus.gif"); bool showson = false; if (showids.Contains("," + t.id + ",") || showids.Contains("," + t.Parentid + ",")) { style = ""; } if (showids.Contains("," + t.id + ",")) { image = AdminImage("minus.gif"); showson = true; } int count = B_Lebi_Pro_Type.Counts("Parentid=" + t.id + ""); //隐藏规则 //name = "<input type=\"hidden\" value=\"" + 1 + "\" /><input type=\"hidden\" value=\"" + ds.Tables[0].Rows[i]["pid"] + "\" /> <input type=\"hidden\" value=\"" + ds.Tables[0].Rows[i]["id"] + "\" /><input type=\"hidden\" value=\"," + ds.Tables[0].Rows[i]["pid"] + ",\" />"; //操作 string caozuo = "<a href=\"javascript:Edit(" + t.id + ",0)\">" + Tag("添加子类") + "</a> | <a href=\"javascript:Edit(0," + t.id + ")\">" + Tag("编辑") + "</a> | <a href=\"javascript:Del(" + t.id + ")\">" + Tag("删除") + "</a>"; //str += "<tr onclick='javascript:selectrow(\"check" + t.id + "\");' name=\"tr" + t.Parentid + "\" " + style + " id=\"tr" + t.id + "\">"; str += "<tr class=\"list\" ondblclick=\"Edit(0," + t.id + ")\" name=\"tr" + t.Parentid + "\" " + style + " id=\"tr" + t.id + "\">"; str += "<td style=\"text-align:center\"><input type='checkbox' id=\"check" + t.id + "\" value='" + t.id + "' name='id' del=\"del\" /></td>"; str += "<td>" + t.id + "</td>"; str += "<td>" + deepstr(deep); if (count > 0) { str += "<img src=\"" + image + "\" name=\"img" + t.Parentid + "\" id=\"img" + t.id + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" onclick=\"ShowProductTypeChild('" + findpath(t.id) + "'," + t.id + "," + (deep + 1) + ")\" title=\"" + Tag("展开") + "\" /> "; } else { str += "<img src=\"" + AdminImage("minus.gif") + "\" style=\"cursor: pointer; text-align: center; vertical-align:absmiddle\" /> "; } if (t.ImageSmall != "") { str += "<img src=\"" + t.ImageSmall + "\" height=\"16\" /> "; } str += Language.Content(t.Name, CurrentLanguage.Code) + " <a href=\"" + Shop.Bussiness.ThemeUrl.GetURL("P_ProductCategory", t.id.ToString(), "", CurrentLanguage.Code) + "\" target=\"_blank\"><img src=\"" + PageImage("icon/newWindow.png") + "\" style=\"vertical-align:absmiddle\" /></a></td>"; str += "<td>" + Shop.Tools.Utils.GetUnicodeSubString(shuxinglianjie(ProPertystring(t.ProPerty132), ProPertystring(t.ProPerty133)), 100, "...") + "</td>"; str += "<td>" + Shop.Tools.Utils.GetUnicodeSubString(ProPertystring(t.ProPerty131), 100, "...") + "</td>"; str += "<td><a href=\"default.aspx?Pro_Type_id=" + t.id + "&Type_id_ProductType=320,321,322,323\">" + EX_Product.TypeProductCount(t.id) + "</a></td>"; str += "<td>" + t.Sort + "</td>"; str += "<td>" + (t.IsShow == 1 ? "" + Tag("是") + "" : "" + Tag("否") + "") + "</td>"; str += "<td>" + (t.IsIndexShow == 1 ? "" + Tag("是") + "" : "" + Tag("否") + "") + "</td>"; str += "<td>" + caozuo + "</td></tr>"; if (showson) { str += CreateTree(t.id, deep + 1); } //CreateSunNode(int.Parse(ds.Tables[0].Rows[i]["id"].ToString()), ",0", ss); } return(str); }