public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; string action = MXRequest.GetQueryString("myact"); if (action == "upStock") { BLL.wx_shop_product spBll = new BLL.wx_shop_product(); BLL.orders oBll = new BLL.orders(); try { string orderno = MyCommFun.QueryString("order_no"); //根据订单号得到订单 Model.orders oModel = oBll.GetModelByNo(orderno); //得到所有订购商品 List <Model.order_goods> ogList = oModel.order_goods; //根据订购商品的数量修改库存 foreach (Model.order_goods item in ogList) { Model.wx_shop_product spModel = spBll.GetModel(item.goods_id); spModel.stock = spModel.stock - item.quantity; spBll.Update(spModel); } context.Response.Write("{\"status\": 1, \"msg\": \"库存操作成功!\"}"); return; } catch (Exception) { context.Response.Write("{\"status\": 0, \"msg\": \"库存操作失败!\"}"); return; } } }
public void ShopDetailPage() { BLL.wx_shop_product artDal = new BLL.wx_shop_product(); int pid = MyCommFun.RequestInt("pid"); Model.wx_shop_product product = artDal.GetModel(pid, wid); if (product != null) { string skuStr = "["; string availSkuStr = "{"; if (product.skulist != null && product.skulist.Count > 0) { // string skuStr = "[{ \"pList\": [\"H\", \"H/VVS/32分/14号\"], \"pName\": \"戒指手寸\" }]"; // string availSku = "{ \"戒指手寸:F-G/VVS/33分/12号\": { \"pid\": 12700, \"stockCount\": \"\", \"stockPrice\": \"1000\", \"maketPrice\": \"0\" }, }"; skuStr += "{ \"pList\": ["; //暂时只支持一种配件 for (int i = 0; i < product.skulist.Count; i++) { product.skulist[i].price += product.salePrice; product.skulist[i].price *= 100; if (i != (product.skulist.Count - 1)) { skuStr += "\"" + product.skulist[i].attributeValue + "\","; availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice + "\" }, "; } else { skuStr += "\"" + product.skulist[i].attributeValue + "\""; availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice + "\" }"; } } skuStr += "], \"pName\": \"" + product.skulist[0].attrName + "\" }"; //MxWeiXinPF.DAL.ShopSKUDal skuDal = new DAL.ShopSKUDal(); //IList<Model.ShopSKU> skulist = skuDal.SKUConvert(product.skulist); //this.Document.SetValue("skulist", skulist[0]); } skuStr += "]"; availSkuStr += "}"; if (availSkuStr == "{}") { availSkuStr = "{ \"\": { \"pid\": 0, \"stockCount\": \"\", \"stockPrice\": \"" + product.salePrice + "\", \"maketPrice\": \"" + product.marketPrice + "\" } }"; } this.Document.SetValue("skuStr", skuStr); this.Document.SetValue("availSkuStr", availSkuStr); this.Document.SetValue("model", product); } }
//保存排序 protected void btnXiJia_Click(object sender, EventArgs e) { //ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.wx_shop_product bll = new BLL.wx_shop_product(); Repeater rptList = this.rptList; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.UpdateField(id, "upselling=1"); } } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "上架出售中的商品"); //记录日志 JscriptMsg("商品上架成功啦!", Utils.CombUrlTxt("productInStock.aspx", "category_id={0}&keywords={1}", this.category_id.ToString(), this.keywords), "Success"); }
/// <summary> /// 设置操作 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.wx_shop_product bll = new BLL.wx_shop_product(); Model.wx_shop_product model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIslatest": //最新 if (model.latest) { bll.UpdateField(id, "latest=0"); } else { bll.UpdateField(id, "latest=1"); } break; case "lbtnIshotsale": if (model.hotsale) { bll.UpdateField(id, "hotsale=0"); } else { bll.UpdateField(id, "hotsale=1"); } break; case "lbtnIsspecialOffer": if (model.specialOffer) { bll.UpdateField(id, "specialOffer=0"); } else { bll.UpdateField(id, "specialOffer=1"); } break; } this.RptBind(this.category_id, CombSqlTxt(this.keywords), "sort_id asc,id desc"); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { //ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.wx_shop_product bll = new BLL.wx_shop_product(); Repeater rptList = this.rptList; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存出售中的商品内容排序"); //记录日志 JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("productInStock.aspx", "category_id={0}&keywords={1}", this.category_id.ToString(), this.keywords), "Success"); }
/// <summary> /// 【微支付】 订单付款成功,处理订单:1将订单的状态改成付款完成; /// 李朴 add /// </summary> /// <param name="beforeFunName"></param> /// <param name="out_trade_no">商户订单号</param> /// <param name="transaction_id">订单交易号</param> /// <param name="result_code">支付结果</param> /// <param name="total_fee">付款金额(单位为分)</param> /// <param name="otid">订单临时表id</param> /// <returns>有错误则返回错误信息,正确,则返回空字符串</returns> public string ProcessPaySuccess_wx(string beforeFunName, string out_trade_no, string transaction_id, string result_code, int total_fee, int otid, int wid) { string payTmpType = "【微支付】"; decimal total_fee_d = (decimal)total_fee / 100; BLL.orders orderBll = new BLL.orders(); string funName = payTmpType + beforeFunName + " ProcessPaySuccess_wx "; WXLogs.AddLog(wid, "微支付", funName, "开始执行ProcessPaySuccess_wx方法[otid:" + otid + "]"); try { #region 数据同步前 IList <Model.orders> orderlist = orderBll.GetModelList("id=" + otid + " and order_no='" + out_trade_no + "'"); if (orderlist == null || orderlist.Count <= 0) { WXLogs.AddLog(wid, payTmpType, funName, "订单号【" + out_trade_no + "】订单号不存在", 0); return("订单号不存在"); } //这个暂时不处理 if (WXLogs.ExistsFlg((out_trade_no + otid))) { //如果已经处理过,则不再处理 return(""); } WXLogs.AddFlg(wid, payTmpType, funName, (out_trade_no + otid));//加标志,防止重复提交 Model.orders orderEntity = orderlist[0]; if (orderEntity.order_amount > total_fee_d) { return("付款的金额(" + total_fee_d + ")小于订单的预付款金额(" + orderEntity.order_amount + ")信息,直接退款"); } orderEntity.notify_id = ""; orderEntity.trade_no = transaction_id; orderEntity.pay_info = result_code; orderEntity.order_amount = total_fee_d; orderEntity.payment_time = DateTime.Now; orderEntity.status = 2; orderEntity.payment_status = 2; //判断是否需要立即发货 if (orderEntity.express_status == 0) { //立即发货 orderEntity.express_status = 2; orderEntity.express_time = DateTime.Now; //FaHuoProc fahuo = new FaHuoProc(); //BLL.wx_payment_wxpay payBll = new BLL.wx_payment_wxpay(); //Model.wx_payment_wxpay paymentInfo = payBll.GetModelByWid(wid); //Dictionary<string, object> fahuoDict = fahuo.fahuomgr(paymentInfo, orderEntity); //string errcode = fahuoDict["errcode"].ToString(); //string errmsg = fahuoDict["errmsg"].ToString(); //orderEntity.fahuoCode = errcode; //orderEntity.fahuoMsg = errmsg; //if (errcode == "0") //{ // orderEntity.express_status = 2; // orderEntity.express_time = DateTime.Now; //} //else //{ // orderEntity.express_status =1; //} } bool ret = orderBll.Update(orderEntity); //把订单里的商品库存减少 #region 减少库存 BLL.wx_shop_product spBll = new BLL.wx_shop_product(); BLL.orders oBll = new BLL.orders(); //根据订单号得到订单 Model.orders oModel = oBll.GetModelByNo(orderEntity.order_no); //得到所有订购商品 List <Model.order_goods> ogList = oModel.order_goods; //根据订购商品的数量修改库存 foreach (Model.order_goods item in ogList) { Model.wx_shop_product spModel = spBll.GetModel(item.goods_id); spModel.stock = spModel.stock - item.quantity; spBll.Update(spModel); } #endregion if (!ret) { WXLogs.AddLog(wid, payTmpType, funName, "订单号【" + out_trade_no + "】支付成功后处理数据失败", 0); return("订单号【" + out_trade_no + "】支付成功后处理数据失败"); } WXLogs.AddLog(payTmpType, funName, "订单号【" + out_trade_no + "】支付成功后,处理数据成功", 1); return(""); #endregion } catch (Exception ex) { WXLogs.AddLog(wid, payTmpType, funName, "订单号【" + out_trade_no + "】支付成功后处理数据同步出现错误:" + ex.Message, 0); return(null); } }
public void ShopDetailPage() { BLL.wx_shop_product artDal = new BLL.wx_shop_product(); int pid = MyCommFun.RequestInt("pid"); Model.wx_shop_product product = artDal.GetModel(pid); if (product != null) { string skuStr = "["; string availSkuStr = "{"; if (product.skulist != null && product.skulist.Count>0) { // string skuStr = "[{ \"pList\": [\"H\", \"H/VVS/32分/14号\"], \"pName\": \"戒指手寸\" }]"; // string availSku = "{ \"戒指手寸:F-G/VVS/33分/12号\": { \"pid\": 12700, \"stockCount\": \"\", \"stockPrice\": \"1000\", \"maketPrice\": \"0\" }, }"; skuStr += "{ \"pList\": ["; //暂时只支持一种配件 for (int i = 0; i < product.skulist.Count; i++) { product.skulist[i].price += product.salePrice; product.skulist[i].price *= 100; if (i != (product.skulist.Count - 1)) { skuStr += "\"" + product.skulist[i].attributeValue + "\","; availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice* 100 + "\" }, "; } else { skuStr += "\"" + product.skulist[i].attributeValue + "\""; availSkuStr += "\"" + product.skulist[0].attrName + ":" + product.skulist[i].attributeValue + "\": { \"pid\": " + product.skulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + product.skulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" }"; } } skuStr += "], \"pName\": \"" + product.skulist[0].attrName + "\" }"; //MxWeiXinPF.DAL.ShopSKUDal skuDal = new DAL.ShopSKUDal(); //IList<Model.ShopSKU> skulist = skuDal.SKUConvert(product.skulist); //this.Document.SetValue("skulist", skulist[0]); } skuStr += "]"; availSkuStr += "}"; if (availSkuStr == "{}") { availSkuStr = "{ \"\": { \"pid\": 0, \"stockCount\": \"\", \"stockPrice\": \"" + product .salePrice+ "\", \"maketPrice\": \""+product.marketPrice * 100+"\" } }"; } this.Document.SetValue("skuStr", skuStr); this.Document.SetValue("availSkuStr", availSkuStr); this.Document.SetValue("model", product); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; BLL.wx_shop_cart cartBll = new BLL.wx_shop_cart(); string _action = MyCommFun.QueryString("myact"); string openid = MyCommFun.RequestOpenid(); //得到微信用户的openid Dictionary <string, string> jsonDict = new Dictionary <string, string>(); if (_action == "LoadProduct") { #region 择排序,改变商品列表 string sortColumn = MyCommFun.RequestParam("sortColumn"); int wid = MyCommFun.RequestInt("wid"); int id = MyCommFun.RequestInt("cid"); string name = MyCommFun.RequestParam("name"); string flog = MyCommFun.RequestParam("flog"); string gd = MyCommFun.RequestParam("gd"); DataSet ds = null; BLL.wx_shop_product proBll = new BLL.wx_shop_product(); StringBuilder jsonStr = new StringBuilder(); if (id != 0) { if (sortColumn == "priceDesc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " order by marketPrice desc "); } if (sortColumn == "priceDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and productName like " + "'%" + name + "%'" + "order by marketPrice desc "); } if (sortColumn == "priceAsc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " order by marketPrice asc "); } if (sortColumn == "priceAsc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and productName like " + "'%" + name + "%'" + "order by marketPrice asc "); } if (sortColumn == "newDesc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and latest=" + 1 + " order by latest desc "); } if (sortColumn == "newDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and latest=" + 1 + " and productName like " + "'%" + name + "%'" + "order by latest desc "); } if (sortColumn == "saleDesc") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and hotsale=" + 1 + " order by hotsale desc "); } if (sortColumn == "saleDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "categoryId=" + id + " and hotsale=" + 1 + " and productName like " + "'%" + name + "%'" + "order by hotsale desc "); } } else { if (sortColumn == "priceDesc") { ds = proBll.GetList(wid, 20, "1=1 order by marketPrice desc "); } if (sortColumn == "priceDesc" && flog == "true") { ds = proBll.GetList(wid, 20, " productName like " + "'%" + name + "%'" + "order by marketPrice desc "); } if (sortColumn == "priceAsc") { ds = proBll.GetList(wid, 20, " 1=1 order by marketPrice asc "); } if (sortColumn == "priceAsc" && flog == "true") { ds = proBll.GetList(wid, 27, " productName like " + "'%" + name + "%'" + "order by marketPrice asc "); } if (sortColumn == "newDesc") { ds = proBll.GetList(wid, 20, " latest=" + 1 + " order by latest desc "); } if (sortColumn == "newDesc" && flog == "true") { ds = proBll.GetList(wid, 20, " latest=" + 1 + "productName like " + "'%" + name + "%'" + "order by latest desc "); } if (sortColumn == "saleDesc") { ds = proBll.GetList(wid, 20, "hotsale=" + 1 + " order by hotsale desc "); } if (sortColumn == "saleDesc" && flog == "true") { ds = proBll.GetList(wid, 20, "hotsale=" + 1 + " and productName like " + "'%" + name + "%'" + "order by hotsale desc "); } } if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (id != 0) { if (gd == "") { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span></p> </div>"); } jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>"); } else { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">"); jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评"); jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>"); } } } else { if (gd == "") { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span></p> </div>"); } jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>"); } else { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">"); jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评"); jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>"); } } } } context.Response.Write(jsonStr); #endregion } else if (_action == "sousuo") { #region 择商品名称,改变商品列表 string name = MyCommFun.RequestParam("name"); int wid = MyCommFun.RequestInt("wid"); DataSet ds = null; BLL.wx_shop_product proBll = new BLL.wx_shop_product(); StringBuilder jsonStr = new StringBuilder(); ds = proBll.GetList(wid, 20, " productName like " + "'%" + name + "%'" + ""); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>"); jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span>1534人评价,96%好评</p> </div>"); } jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>"); } context.Response.Write(jsonStr); #endregion } else if (_action == "gengduo") { #region 查看更多 int wid = MyCommFun.RequestInt("wid"); int id = MyCommFun.RequestInt("cid"); DataSet ds = null; BLL.wx_shop_product proBll = new BLL.wx_shop_product(); StringBuilder jsonStr = new StringBuilder(); if (id != 0) { ds = proBll.GetList(wid, -1, "categoryId=" + id + " and p.hotsale=" + 1 + " order by p.hotsale desc "); } else { ds = proBll.GetList(wid, -1, "p.hotsale=" + 1 + " order by p.hotsale desc "); } if (ds != null && ds.Tables[0] != null) { foreach (DataRow d in ds.Tables[0].Rows) { jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">"); jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评"); jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>"); } } context.Response.Write(jsonStr); #endregion } else if (_action == "checkid") { #region 是否存在该商品 jsonDict = new Dictionary <string, string>(); int wid = MyCommFun.RequestInt("wid"); int id = MyCommFun.RequestInt("id"); BLL.wx_shop_product proBll = new BLL.wx_shop_product(); DataSet ds = null; ds = proBll.GetList("wid=" + wid + " and id=" + id + ""); BLL.wx_shop_sku skuBll = new BLL.wx_shop_sku(); Model.wx_shop_sku skuModel = skuBll.GetModel(id); if (ds != null && ds.Tables[0].Rows.Count > 0) { jsonDict.Add("data", ds.Tables[0].Rows[0]["stock"].ToString()); } context.Response.Write(MyCommFun.getJsonStr(jsonDict)); #endregion } }
/// <summary> /// 设置操作 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value); BLL.wx_shop_product bll = new BLL.wx_shop_product(); Model.wx_shop_product model = bll.GetModel(id); switch (e.CommandName) { case "lbtnIslatest"://最新 if (model.latest) bll.UpdateField(id, "latest=0"); else bll.UpdateField(id, "latest=1"); break; case "lbtnIshotsale": if (model.hotsale) bll.UpdateField(id, "hotsale=0"); else bll.UpdateField(id, "hotsale=1"); break; case "lbtnIsspecialOffer": if (model.specialOffer) bll.UpdateField(id, "specialOffer=0"); else bll.UpdateField(id, "specialOffer=1"); break; } this.RptBind(this.category_id, CombSqlTxt(this.keywords), "sort_id asc,id desc"); }
//保存排序 protected void btnXiJia_Click(object sender, EventArgs e) { //ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.wx_shop_product bll = new BLL.wx_shop_product(); Repeater rptList = this.rptList; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.UpdateField(id, "upselling=0"); } } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "下架出售中的商品"); //记录日志 JscriptMsg("商品下架成功啦!", Utils.CombUrlTxt("productOnSale.aspx", "category_id={0}&keywords={1}", this.category_id.ToString(), this.keywords), "Success"); }
/// <summary> /// /// </summary> public void ShopDetailPage() { BLL.wx_shop_product artDal = new BLL.wx_shop_product(); int pid = MyCommFun.RequestInt("pid"); Model.wx_shop_product product = artDal.GetModel(pid); if (product != null) { string skuStr = "{\"attr\":["; string availSkuStr = "{"; if (product.skulist != null && product.skulist.Count > 0) { //////////////////生成新的list对数据进行分类 List <int?> arrlist = new List <int?>(); for (int i = 0; i < product.skulist.Count; i++) { arrlist.Add(product.skulist[i].attributeId); } IList <int?> nlist = arrlist.Distinct().ToList();//去除重复值 ////////////////////// for (int j = 0; j < nlist.Count; j++) { ////////////////////////////////////// List <Model.wx_shop_sku> newskulist = new List <Model.wx_shop_sku>(); for (int i = 0; i < product.skulist.Count; i++) { if (product.skulist[i].attributeId == nlist[j].Value) { newskulist.Add(product.skulist[i]); } } ///////////////////////////////////// string dh = ""; if (j == (nlist.Count - 1)) { dh = ""; } else { dh = ","; } skuStr += "{\"attrname\":\"" + newskulist[j].attrName + "\",\"attrlist\": ["; string skuname = ""; for (int i = 0; i < newskulist.Count; i++) { string addprice = newskulist[i].price.ToString(); newskulist[i].price += product.salePrice; // newskulist[i].price *= 100; string dhi = "", dhk = ","; if (i != (newskulist.Count - 1)) { dhi = ","; } else { dhi = ""; //availSkuStr } if (j == (nlist.Count - 1) && i == (newskulist.Count - 1)) { dhk = ""; } skuStr += "{ \"pid\": " + newskulist[i].id + ", \"aname\": \"" + newskulist[i].attributeValue + "\", \"addprice\": \"" + addprice + "\", \"stockPrice\": \"" + newskulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice + "\" }" + dhi + " "; // skuStr += "{ \"attrname\": \"" + newskulist[i].attributeValue + "\", \"stockPrice\": \"" + newskulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" }" + dhi + ""; availSkuStr += "\"" + newskulist[i].attrName + ":" + newskulist[i].attributeValue + "\": { \"pid\": " + newskulist[i].id + ", \"stockCount\": \"\", \"stockPrice\": \"" + newskulist[i].price + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" }" + dhk + " "; skuname = newskulist[i].attrName; } skuStr += "]}" + dh; } skuStr += "]}"; availSkuStr += "}"; //XCWeiXin.DAL.ShopSKUDal skuDal = new DAL.ShopSKUDal(); //IList<Model.ShopSKU> skulist = skuDal.SKUConvert(product.skulist); //this.Document.SetValue("skulist", skulist[0]); } else { skuStr += "]}"; } if (availSkuStr == "{}") { availSkuStr = "{ \"\": { \"pid\": 0, \"stockCount\": \"\", \"stockPrice\": \"" + product.salePrice + "\", \"maketPrice\": \"" + product.marketPrice * 100 + "\" } }"; } this.Document.SetValue("skuStr", skuStr); this.Document.SetValue("availSkuStr", availSkuStr); this.Document.SetValue("model", product); //快递信息列表 BLL.express expressBll = new BLL.express(); DataSet dsExpress = expressBll.GetExpressList100(wid); this.Document.SetValue("express", dsExpress); //支付信息列表 BLL.payment pbll = new BLL.payment(); DataSet dsPay = pbll.GetList(0, " is_lock=0 and wid=" + wid, " sort_id asc"); this.Document.SetValue("payment", dsPay); } }