/// <summary> /// 只统计购物车数量 /// </summary> /// <returns></returns> public static int GetQuantityCount() { string jsonStr = GetCookies(); //获取Cookies值 int count = 0; if (!string.IsNullOrEmpty(jsonStr)) { List <Model.cart_keys> ls = (List <Model.cart_keys>)JsonHelper.JSONToObject <List <Model.cart_keys> >(jsonStr); if (ls != null) { foreach (Model.cart_keys modelt in ls) { bool isExists = false; if (modelt.goods_id > 0) { isExists = new BLL.article_goods().Exists(modelt.article_id, modelt.goods_id); } else { isExists = new BLL.article().Exists(modelt.article_id); } if (isExists) { count += modelt.quantity; } } } } return(count); }
private bool DoEdit(int _id) { BLL.article_goods goods_bll = new BLL.article_goods(); //保存商品信息 string[] specGoodsIdArr = Request.Form.GetValues("hide_goods_id"); string[] specGoodsNoArr = Request.Form.GetValues("spec_goods_no"); string[] specMarketPriceArr = Request.Form.GetValues("spec_market_price"); string[] specSellPriceArr = Request.Form.GetValues("spec_sell_price"); string[] specSellDateArr = Request.Form.GetValues("hide_spec_sell_date"); string[] specStockQuantityArr = Request.Form.GetValues("spec_stock_quantity"); string[] specSpecIdsArr = Request.Form.GetValues("hide_spec_ids"); string[] specTextArr = Request.Form.GetValues("hide_spec_text"); string[] specGroupPriceArr = Request.Form.GetValues("hide_group_price"); if (specGoodsIdArr != null && specGoodsNoArr != null && specMarketPriceArr != null && specSellPriceArr != null && specSellDateArr != null && specStockQuantityArr != null && specSpecIdsArr != null && specTextArr != null && specGroupPriceArr != null && specGoodsIdArr.Length > 0 && specGoodsNoArr.Length > 0 && specMarketPriceArr.Length > 0 && specSellPriceArr.Length > 0 && specStockQuantityArr.Length > 0 && specSpecIdsArr.Length > 0 && specTextArr.Length > 0 && specGroupPriceArr.Length > 0) { List <Model.article_goods> goodsList = new List <Model.article_goods>(); for (int i = 0; i < specGoodsNoArr.Length; i++) { List <Model.user_group_price> groupList = new List <Model.user_group_price>(); if (!string.IsNullOrEmpty(specGroupPriceArr[i])) { groupList = (List <Model.user_group_price>)JsonHelper.JSONToObject <List <Model.user_group_price> >(specGroupPriceArr[i]); } goodsList.Add(new Model.article_goods { goods_no = specGoodsNoArr[i], spec_ids = specSpecIdsArr[i], spec_text = specTextArr[i], stock_quantity = Utils.StrToInt(specStockQuantityArr[i], 0), market_price = Utils.StrToDecimal(specMarketPriceArr[i], 0), sell_price = Utils.StrToDecimal(specSellPriceArr[i], 0), sell_date = Utils.StrToDateTime(specSellDateArr[i], DateTime.Now), group_prices = groupList }); } if (goods_bll.Update(goodsList, _id, PLRequest.GetQueryDateTime("date").ToString("yyyy-MM-dd"))) { AddAdminLog(PLEnums.ActionEnum.Edit.ToString(), "修改价格规格频道内容:" + article_model.title); //记录日志 return(true); } } return(false); }
private void get_article_goods_info(HttpContext context) { int article_id = DTRequest.GetInt("article_id", 0); string spec_ids = DTRequest.GetString("ids"); if (article_id == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,传输参数不正确!\"}"); return; } if (string.IsNullOrEmpty(spec_ids)) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,传输参数不正确!\"}"); return; } //查询商品信息 Model.article_goods goodsModel = new BLL.article_goods().GetModel(article_id, spec_ids); if (goodsModel == null) { context.Response.Write("{\"status\": 0, \"msg\": \"对不起,暂无查到商品信息!\"}"); return; } //查询是否登录,有则查询会员价格 Model.users userModel = new Web.UI.BasePage().GetUserInfo(); if (userModel != null) { //查询会员组价格 Model.user_group_price userPriceModel = new BLL.user_group_price().GetModel(goodsModel.id, userModel.group_id); if (userPriceModel != null) { goodsModel.sell_price = userPriceModel.price; } else { //查询会员组折扣 Model.user_groups groupModel = new BLL.user_groups().GetModel(userModel.group_id); if (groupModel != null) { goodsModel.sell_price = goodsModel.sell_price * groupModel.discount / 100; } } } //以JSON格式输出商品信息 context.Response.Write("{\"status\": \"1\", \"id\": \"" + goodsModel.id + "\", \"article_id\": \"" + goodsModel.article_id + "\", \"goods_id\": \"" + goodsModel.id + "\", \"goods_no\": \"" + goodsModel.goods_no + "\", \"spec_ids\": \"" + goodsModel.spec_ids + "\", \"spec_text\": \"" + goodsModel.spec_text + "\", \"stock_quantity\": \"" + goodsModel.stock_quantity + "\", \"market_price\": \"" + goodsModel.market_price + "\", \"sell_price\": \"" + goodsModel.sell_price + "\"}"); }