public Lebi_Product_Limit GetLimitInfo(int proid) { Lebi_Product_Limit model = null; if (user.id > 0) { model = B_Lebi_Product_Limit.GetModel("Product_id=" + proid + " and User_id=" + user.id + ""); if (model == null) { int c = B_Lebi_Product_Limit.Counts("User_id=" + user.id + ""); if (c == 0) { model = B_Lebi_Product_Limit.GetModel("Product_id=" + proid + " and UserLevel_id=" + user.UserLevel_id + ""); } } } else { model = B_Lebi_Product_Limit.GetModel("Product_id=" + proid + " and UserLevel_id=" + userlevel.id + ""); } if (model == null) { return(new Lebi_Product_Limit()); } return(model); }
protected void Page_Load(object sender, EventArgs e) { PageSize = RequestTool.getpageSize(25); proid = RequestTool.RequestInt("proid"); userlevelid = RequestTool.RequestInt("userlevelid"); string where = "User_id=0"; if (proid > 0) { where += " and Product_id=" + proid; } if (userlevelid > 0) { where += " and UserLevel_id=" + userlevelid; } models = B_Lebi_Product_Limit.GetList(where, "", PageSize, page); int recordCount = B_Lebi_Product_Limit.Counts(where); PageString = Pager.GetPaginationString("?page={0}&userlevelid=" + userlevelid + "&proid=" + proid, page, PageSize, recordCount); cuser = GetUserLevel(userlevelid); cproduct = GetPro(proid); if (cuser.id > 0) { ename = Lang(cuser.Name); } if (cproduct.id > 0) { ename = Lang(cproduct.Name); } }
public Lebi_Product_Limit GetLimitInfo(int userid) { Lebi_Product_Limit model = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and User_id=" + userid + ""); if (model == null) { return(new Lebi_Product_Limit()); } return(model); }
public Lebi_Product_Limit GetLimitInfo(Lebi_User user) { Lebi_Product_Limit model = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and User_id=" + user.id + ""); if (model != null) { return(model); } int c = B_Lebi_Product_Limit.Counts("User_id=" + userid + ""); if (c == 0) { model = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and UserLevel_id=" + user.UserLevel_id + ""); } if (model == null) { return(new Lebi_Product_Limit()); } return(model); }
protected void Page_Load(object sender, EventArgs e) { userlevelid = RequestTool.RequestInt("userlevelid"); userid = RequestTool.RequestInt("userid"); productid = RequestTool.RequestInt("productid"); key = RequestTool.RequestString("key"); userlevel = B_Lebi_UserLevel.GetModel(userlevelid); product = B_Lebi_Product.GetModel(productid); if (product == null) { product = new Lebi_Product(); } if (userlevel == null) { userlevel = new Lebi_UserLevel(); } string where = "IsAnonymous<>1"; if (key != "") { where += " and (UserName like '%" + key + "%' or RealName like '%" + key + "%' or NickName like '%" + key + "%')"; } if (userlevelid > 0) { where += " and UserLevel_id =" + userlevelid + ""; } PageSize = RequestTool.getpageSize(20); int recordCount = B_Lebi_User.Counts(where); PageString = Pager.GetPaginationStringForJS("reloadproducts({0},'" + key + "'," + userlevel.id + ");", page, PageSize, recordCount); users = B_Lebi_User.GetList(where, "", PageSize, page); userlevellimit = B_Lebi_Product_Limit.GetModel("Product_id=" + product.id + " and UserLevel_id=" + userlevelid + ""); if (userlevellimit == null) { userlevellimit = new Lebi_Product_Limit(); } }
/// <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", "") + "\"}"); }