//保存排序 protected void btnXiJia_Click(object sender, EventArgs e) { //ChkAdminLevel("channel_" + this.channel_name + "_list", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.wx_book_product bll = new BLL.wx_book_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> /// <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_book_product bll = new BLL.wx_book_product(); Model.wx_book_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_book_product bll = new BLL.wx_book_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("productOnSale.aspx", "category_id={0}&keywords={1}", this.category_id.ToString(), this.keywords), "Success"); }
public void bookDetailPage() { BLL.wx_book_product artDal = new BLL.wx_book_product(); int pid = MyCommFun.RequestInt("pid"); Model.wx_book_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 + "\" }"; //XCWeiXin.DAL.bookSKUDal skuDal = new DAL.bookSKUDal(); //IList<Model.bookSKU> 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); } /* * BLL.wx_book_product artDal = new BLL.wx_book_product(); * int pid = MyCommFun.RequestInt("pid"); * Model.wx_book_product product = artDal.GetModel(pid); * int catalogId = product.catalogId; * BLL.wx_book_catalog_attribute caBll = new BLL.wx_book_catalog_attribute(); * IList<Model.wx_book_catalog_attribute> attrlist = caBll.GetModelList("catalogId=" + catalogId + " order by sort_id asc"); * * Model.wx_book_catalog_attribute attr = new Model.wx_book_catalog_attribute(); * string skuStr = "{"; * string availSkuStr = "{"; * * for (int i = 0; i < attrlist.Count; i++) * { * attr = attrlist[i]; * * // attrStr.Append(" <dt>" + attr.aName + "</dt>"); * string[] attrvalueArr = Utils.SplitString(attr.aValue, "\r\n"); * * if (product != null) * { * * if (attrvalueArr != null && attrvalueArr.Length > 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 j = 0; j < attrvalueArr.Length; j++) * { * 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 + "\" }"; * * //XCWeiXin.DAL.bookSKUDal skuDal = new DAL.bookSKUDal(); * //IList<Model.bookSKU> 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); * * } * } */ }