/// <summary> /// 得到一个对象实体 /// </summary> public WeiXinPF.Model.wx_shop_product GetModel(int id, int wid) { Model.wx_shop_product product = new Model.wx_shop_product(); StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,wid,categoryId,brandId,sku,productName,shortDesc,unit,weight,description,seo_title,seo_keywords,seo_description,focusImgUrl,thumbnailsUrll,recommended,latest,hotsale,specialOffer,costPrice,marketPrice,salePrice,upselling,stock,addDate,vistiCounts,sort_id,productionDate,ExpiryEndDate,updateDate,catalogId from wx_shop_product "); strSql.Append(" where id=@id and wid=@wid"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4), new SqlParameter("@wid", SqlDbType.Int, 4) }; parameters[0].Value = id; parameters[1].Value = wid; WeiXinPF.Model.wx_shop_product model = new WeiXinPF.Model.wx_shop_product(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { product = DataRowToModel(ds.Tables[0].Rows[0]); } return(product); }
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; } } }
/// <summary> /// 分页获取数据列表 /// </summary> //public DataSet GetList(int PageSize,int PageIndex,string strWhere) //{ //return dal.GetList(PageSize,PageIndex,strWhere); //} #endregion BasicMethod #region ExtensionMethod /// <summary> /// 得到一个对象实体 /// </summary> public WeiXinPF.Model.wx_shop_product GetModel(int id) { Model.wx_shop_product product = new Model.wx_shop_product(); product = dal.GetModel(id); product.albums = new wx_shop_albums().GetModelList("productId=" + id); product.attrs = new DAL.wx_shop_productAttr_value().GetAttrModelList(id); product.skulist = new DAL.wx_shop_sku().GetpSkuModelList(id); return(product); }
/// <summary> /// 绑定商品信息 /// </summary> /// <param name="id"></param> private void BindProductInfo(int id) { hidid.Value = id.ToString(); Model.wx_shop_product product = spBll.GetModel(id); ddlCategoryId.SelectedValue = product.categoryId.Value.ToString(); ddlCatalog.SelectedValue = product.catalogId.ToString(); hidCatalogId.Value = product.catalogId.ToString(); txtproductName.Text = product.productName; txtsku.Text = product.sku; if (product.upselling) { radType.Items[0].Selected = true; } else { radType.Items[1].Selected = true; } if (product.latest) { cblActionType.Items[0].Selected = true; } if (product.hotsale) { cblActionType.Items[1].Selected = true; } if (product.recommended) { cblActionType.Items[2].Selected = true; } if (product.specialOffer) { cblActionType.Items[3].Selected = true; } txtcostPrice.Text = product.costPrice.ToString(); txtmarketPrice.Text = product.marketPrice.ToString(); txtsalePrice.Text = product.salePrice.ToString(); txtstock.Text = product.stock.ToString(); txtsort_id.Text = product.sort_id == null ? "99" : product.sort_id.ToString(); txtshortDesc.Text = product.shortDesc; txtdescription.InnerText = product.description; rptAlbumList.DataSource = product.albums; rptAlbumList.DataBind(); //绑定属性html BindAttrHtml(product.catalogId); }
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); } }
/// <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"); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Model.wx_shop_product model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into wx_shop_product("); strSql.Append("wid,categoryId,brandId,sku,productName,shortDesc,unit,weight,description,seo_title,seo_keywords,seo_description,focusImgUrl,thumbnailsUrll,recommended,latest,hotsale,specialOffer,costPrice,marketPrice,salePrice,upselling,stock,addDate,vistiCounts,sort_id,productionDate,ExpiryEndDate,updateDate,catalogId)"); strSql.Append(" values ("); strSql.Append("@wid,@categoryId,@brandId,@sku,@productName,@shortDesc,@unit,@weight,@description,@seo_title,@seo_keywords,@seo_description,@focusImgUrl,@thumbnailsUrll,@recommended,@latest,@hotsale,@specialOffer,@costPrice,@marketPrice,@salePrice,@upselling,@stock,@addDate,@vistiCounts,@sort_id,@productionDate,@ExpiryEndDate,@updateDate,@catalogId)"); strSql.Append(";set @ReturnValue= @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@wid", SqlDbType.Int, 4), new SqlParameter("@categoryId", SqlDbType.Int, 4), new SqlParameter("@brandId", SqlDbType.Int, 4), new SqlParameter("@sku", SqlDbType.VarChar, 20), new SqlParameter("@productName", SqlDbType.VarChar, 500), new SqlParameter("@shortDesc", SqlDbType.VarChar, 500), new SqlParameter("@unit", SqlDbType.VarChar, 10), new SqlParameter("@weight", SqlDbType.Float, 8), new SqlParameter("@description", SqlDbType.VarChar, 2000), new SqlParameter("@seo_title", SqlDbType.VarChar, 200), new SqlParameter("@seo_keywords", SqlDbType.VarChar, 300), new SqlParameter("@seo_description", SqlDbType.VarChar, 500), new SqlParameter("@focusImgUrl", SqlDbType.VarChar, 800), new SqlParameter("@thumbnailsUrll", SqlDbType.VarChar, 800), new SqlParameter("@recommended", SqlDbType.Bit, 1), new SqlParameter("@latest", SqlDbType.Bit, 1), new SqlParameter("@hotsale", SqlDbType.Bit, 1), new SqlParameter("@specialOffer", SqlDbType.Bit, 1), new SqlParameter("@costPrice", SqlDbType.Float, 8), new SqlParameter("@marketPrice", SqlDbType.Float, 8), new SqlParameter("@salePrice", SqlDbType.Float, 8), new SqlParameter("@upselling", SqlDbType.Bit, 1), new SqlParameter("@stock", SqlDbType.Int, 4), new SqlParameter("@addDate", SqlDbType.DateTime), new SqlParameter("@vistiCounts", SqlDbType.Int, 4), new SqlParameter("@sort_id", SqlDbType.Int, 4), new SqlParameter("@productionDate", SqlDbType.DateTime), new SqlParameter("@ExpiryEndDate", SqlDbType.DateTime), new SqlParameter("@updateDate", SqlDbType.DateTime), new SqlParameter("@catalogId", SqlDbType.Int, 4), new SqlParameter("@ReturnValue", SqlDbType.Int) }; parameters[0].Value = model.wid; parameters[1].Value = model.categoryId; parameters[2].Value = model.brandId; parameters[3].Value = model.sku; parameters[4].Value = model.productName; parameters[5].Value = model.shortDesc; parameters[6].Value = model.unit; parameters[7].Value = model.weight; parameters[8].Value = model.description; parameters[9].Value = model.seo_title; parameters[10].Value = model.seo_keywords; parameters[11].Value = model.seo_description; parameters[12].Value = model.focusImgUrl; parameters[13].Value = model.thumbnailsUrll; parameters[14].Value = model.recommended; parameters[15].Value = model.latest; parameters[16].Value = model.hotsale; parameters[17].Value = model.specialOffer; parameters[18].Value = model.costPrice; parameters[19].Value = model.marketPrice; parameters[20].Value = model.salePrice; parameters[21].Value = model.upselling; parameters[22].Value = model.stock; parameters[23].Value = model.addDate; parameters[24].Value = model.vistiCounts; parameters[25].Value = model.sort_id; parameters[26].Value = model.productionDate; parameters[27].Value = model.ExpiryEndDate; parameters[28].Value = model.updateDate; parameters[29].Value = model.catalogId; parameters[30].Direction = ParameterDirection.Output; List <CommandInfo> sqllist = new List <CommandInfo>(); CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters); sqllist.Add(cmd); #region //图片相册 if (model.albums != null) { StringBuilder strSql2; foreach (Model.wx_shop_albums modelt in model.albums) { strSql2 = new StringBuilder(); strSql2.Append("insert into wx_shop_albums("); strSql2.Append("productId,thumb_path,original_path,remark)"); strSql2.Append(" values ("); strSql2.Append("@productId,@thumb_path,@original_path,@remark)"); SqlParameter[] parameters2 = { new SqlParameter("@productId", SqlDbType.Int, 4), new SqlParameter("@thumb_path", SqlDbType.NVarChar, 255), new SqlParameter("@original_path", SqlDbType.NVarChar, 255), new SqlParameter("@remark", SqlDbType.NVarChar, 500) }; parameters2[0].Direction = ParameterDirection.InputOutput; parameters2[1].Value = modelt.thumb_path; parameters2[2].Value = modelt.original_path; parameters2[3].Value = modelt.remark; cmd = new CommandInfo(strSql2.ToString(), parameters2); sqllist.Add(cmd); } } #endregion #region //商品属性 if (model.attrs != null) { StringBuilder strSql3; foreach (Model.wx_shop_productAttr_value modelt in model.attrs) { strSql3 = new StringBuilder(); strSql3.Append("insert into wx_shop_productAttr_value("); strSql3.Append("productId,attributeId,paValue)"); strSql3.Append(" values ("); strSql3.Append("@productId,@attributeId,@paValue)"); SqlParameter[] parameters3 = { new SqlParameter("@productId", SqlDbType.Int, 4), new SqlParameter("@attributeId", SqlDbType.Int, 4), new SqlParameter("@paValue", SqlDbType.NVarChar, 300) }; parameters3[0].Direction = ParameterDirection.InputOutput; parameters3[1].Value = modelt.attributeId; parameters3[2].Value = modelt.paValue; cmd = new CommandInfo(strSql3.ToString(), parameters3); sqllist.Add(cmd); } } #endregion #region //商品配件sku|规格 if (model.skulist != null) { StringBuilder strSql4; foreach (Model.wx_shop_sku modelt in model.skulist) { strSql4 = new StringBuilder(); strSql4.Append("insert into wx_shop_sku("); strSql4.Append("productId,attributeId,attributeValue,price)"); strSql4.Append(" values ("); strSql4.Append("@productId,@attributeId,@attributeValue,@price)"); SqlParameter[] parameters4 = { new SqlParameter("@productId", SqlDbType.Int, 4), new SqlParameter("@attributeId", SqlDbType.Int, 4), new SqlParameter("@attributeValue", SqlDbType.NVarChar, 300), new SqlParameter("@price", SqlDbType.Float, 10), }; parameters4[0].Direction = ParameterDirection.InputOutput; parameters4[1].Value = modelt.attributeId; parameters4[2].Value = modelt.attributeValue; parameters4[3].Value = modelt.price; cmd = new CommandInfo(strSql4.ToString(), parameters4); sqllist.Add(cmd); } } #endregion DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist); return((int)parameters[30].Value); }
/// <summary> /// 得到一个对象实体 /// </summary> public MxWeiXinPF.Model.wx_shop_product GetModel(int id) { Model.wx_shop_product product = new Model.wx_shop_product(); product= dal.GetModel(id); product.albums = new wx_shop_albums().GetModelList("productId="+id); product.attrs = new DAL.wx_shop_productAttr_value().GetAttrModelList(id); product.skulist = new DAL.wx_shop_sku().GetpSkuModelList(id); return product; }
/// <summary> /// 得到一个对象实体列表 /// </summary> public IList <Model.wx_orders> GetModelList(string sqlWhere) { IList <Model.wx_orders> retlist = new List <Model.wx_orders>(); StringBuilder strSql = new StringBuilder(); strSql.Append("select id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time,wid,openid "); strSql.Append(" from " + databaseprefix + "orders "); if (sqlWhere.Trim() != "") { strSql.Append(" where " + sqlWhere); } Model.wx_orders model = new Model.wx_orders(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); DataSet ds2 = new DataSet(); List <Model.wx_shop_product> models = new List <Model.wx_shop_product>(); if (ds.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { model = new Model.wx_orders(); dr = ds.Tables[0].Rows[i]; #region 父表信息 if (dr["id"].ToString() != "") { model.id = int.Parse(dr["id"].ToString()); } model.order_no = dr["order_no"].ToString(); model.trade_no = dr["trade_no"].ToString(); if (dr["user_id"].ToString() != "") { model.user_id = int.Parse(dr["user_id"].ToString()); } model.user_name = dr["user_name"].ToString(); if (dr["payment_id"].ToString() != "") { model.payment_id = int.Parse(dr["payment_id"].ToString()); } if (dr["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(dr["payment_fee"].ToString()); } if (dr["payment_status"].ToString() != "") { model.payment_status = int.Parse(dr["payment_status"].ToString()); } if (dr["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(dr["payment_time"].ToString()); } if (dr["express_id"].ToString() != "") { model.express_id = int.Parse(dr["express_id"].ToString()); } model.express_no = dr["express_no"].ToString(); if (dr["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(dr["express_fee"].ToString()); } if (dr["express_status"].ToString() != "") { model.express_status = int.Parse(dr["express_status"].ToString()); } if (dr["express_time"].ToString() != "") { model.express_time = DateTime.Parse(dr["express_time"].ToString()); } model.accept_name = dr["accept_name"].ToString(); model.post_code = dr["post_code"].ToString(); model.telphone = dr["telphone"].ToString(); model.mobile = dr["mobile"].ToString(); model.area = dr["area"].ToString(); model.address = dr["address"].ToString(); model.message = dr["message"].ToString(); model.remark = dr["remark"].ToString(); if (dr["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(dr["payable_amount"].ToString()); } if (dr["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(dr["real_amount"].ToString()); } if (dr["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(dr["order_amount"].ToString()); } if (dr["point"].ToString() != "") { model.point = int.Parse(dr["point"].ToString()); } if (ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(dr["status"].ToString()); } if (dr["add_time"].ToString() != "") { model.add_time = DateTime.Parse(dr["add_time"].ToString()); } if (dr["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(dr["confirm_time"].ToString()); } if (dr["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(dr["complete_time"].ToString()); } if (dr["wid"] != null && dr["wid"].ToString() != "") { model.wid = int.Parse(dr["wid"].ToString()); } if (dr["openid"] != null) { model.openid = dr["openid"].ToString(); } #endregion #region 子表信息 StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select (select top 1 original_path from wx_shop_albums where productId=p.id) as productpic,p.*,og.quantity,og.real_price from wx_shop_product p right join dt_order_goods og on p.id=og.goods_id where og.order_id=@id"); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters2[0].Value = model.id; ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { int count = ds2.Tables[0].Rows.Count; models = new List <Model.wx_shop_product>(); Model.wx_shop_product modelt; for (int n = 0; n < count; n++) { modelt = new Model.wx_shop_product(); #region 子表,for循环 if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.stock = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["wid"] != null && ds2.Tables[0].Rows[n]["wid"].ToString() != "") { modelt.wid = int.Parse(ds2.Tables[0].Rows[n]["wid"].ToString()); } if (ds2.Tables[0].Rows[n]["categoryId"] != null && ds2.Tables[0].Rows[n]["categoryId"].ToString() != "") { modelt.categoryId = int.Parse(ds2.Tables[0].Rows[n]["categoryId"].ToString()); } if (ds2.Tables[0].Rows[n]["brandId"] != null && ds2.Tables[0].Rows[n]["brandId"].ToString() != "") { modelt.brandId = int.Parse(ds2.Tables[0].Rows[n]["brandId"].ToString()); } if (ds2.Tables[0].Rows[n]["sku"] != null) { modelt.sku = ds2.Tables[0].Rows[n]["sku"].ToString(); } if (ds2.Tables[0].Rows[n]["productName"] != null) { modelt.productName = ds2.Tables[0].Rows[n]["productName"].ToString(); } if (ds2.Tables[0].Rows[n]["shortDesc"] != null) { modelt.shortDesc = ds2.Tables[0].Rows[n]["shortDesc"].ToString(); } if (ds2.Tables[0].Rows[n]["unit"] != null) { modelt.unit = ds2.Tables[0].Rows[n]["unit"].ToString(); } if (ds2.Tables[0].Rows[n]["weight"] != null && ds2.Tables[0].Rows[n]["weight"].ToString() != "") { modelt.weight = decimal.Parse(ds2.Tables[0].Rows[n]["weight"].ToString()); } if (ds2.Tables[0].Rows[n]["description"] != null) { modelt.description = ds2.Tables[0].Rows[n]["description"].ToString(); } if (ds2.Tables[0].Rows[n]["seo_title"] != null) { modelt.seo_title = ds2.Tables[0].Rows[n]["seo_title"].ToString(); } if (ds2.Tables[0].Rows[n]["seo_keywords"] != null) { modelt.seo_keywords = ds2.Tables[0].Rows[n]["seo_keywords"].ToString(); } if (ds2.Tables[0].Rows[n]["seo_description"] != null) { modelt.seo_description = ds2.Tables[0].Rows[n]["seo_description"].ToString(); } if (ds2.Tables[0].Rows[n]["focusImgUrl"] != null) { modelt.focusImgUrl = ds2.Tables[0].Rows[n]["productpic"].ToString(); } if (ds2.Tables[0].Rows[n]["thumbnailsUrll"] != null) { modelt.thumbnailsUrll = ds2.Tables[0].Rows[n]["thumbnailsUrll"].ToString(); } if (ds2.Tables[0].Rows[n]["recommended"] != null && ds2.Tables[0].Rows[n]["recommended"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["recommended"].ToString() == "1") || (ds2.Tables[0].Rows[n]["recommended"].ToString().ToLower() == "true")) { modelt.recommended = true; } else { modelt.recommended = false; } } if (ds2.Tables[0].Rows[n]["latest"] != null && ds2.Tables[0].Rows[n]["latest"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["latest"].ToString() == "1") || (ds2.Tables[0].Rows[n]["latest"].ToString().ToLower() == "true")) { modelt.latest = true; } else { modelt.latest = false; } } if (ds2.Tables[0].Rows[n]["hotsale"] != null && ds2.Tables[0].Rows[n]["hotsale"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["hotsale"].ToString() == "1") || (ds2.Tables[0].Rows[n]["hotsale"].ToString().ToLower() == "true")) { modelt.hotsale = true; } else { modelt.hotsale = false; } } if (ds2.Tables[0].Rows[n]["specialOffer"] != null && ds2.Tables[0].Rows[n]["specialOffer"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["specialOffer"].ToString() == "1") || (ds2.Tables[0].Rows[n]["specialOffer"].ToString().ToLower() == "true")) { modelt.specialOffer = true; } else { modelt.specialOffer = false; } } if (ds2.Tables[0].Rows[n]["costPrice"] != null && ds2.Tables[0].Rows[n]["costPrice"].ToString() != "") { modelt.costPrice = decimal.Parse(ds2.Tables[0].Rows[n]["costPrice"].ToString()); } if (ds2.Tables[0].Rows[n]["marketPrice"] != null && ds2.Tables[0].Rows[n]["marketPrice"].ToString() != "") { modelt.marketPrice = decimal.Parse(ds2.Tables[0].Rows[n]["marketPrice"].ToString()); } if (ds2.Tables[0].Rows[n]["salePrice"] != null && ds2.Tables[0].Rows[n]["salePrice"].ToString() != "") { modelt.salePrice = decimal.Parse(ds2.Tables[0].Rows[n]["salePrice"].ToString()); } if (ds2.Tables[0].Rows[n]["upselling"] != null && ds2.Tables[0].Rows[n]["upselling"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["upselling"].ToString() == "1") || (ds2.Tables[0].Rows[n]["upselling"].ToString().ToLower() == "true")) { modelt.upselling = true; } else { modelt.upselling = false; } } if (ds2.Tables[0].Rows[n]["addDate"] != null && ds2.Tables[0].Rows[n]["addDate"].ToString() != "") { modelt.addDate = DateTime.Parse(ds2.Tables[0].Rows[n]["addDate"].ToString()); } if (ds2.Tables[0].Rows[n]["vistiCounts"] != null && ds2.Tables[0].Rows[n]["vistiCounts"].ToString() != "") { modelt.vistiCounts = int.Parse(ds2.Tables[0].Rows[n]["vistiCounts"].ToString()); } if (ds2.Tables[0].Rows[n]["sort_id"] != null && ds2.Tables[0].Rows[n]["sort_id"].ToString() != "") { modelt.sort_id = int.Parse(ds2.Tables[0].Rows[n]["sort_id"].ToString()); } if (ds2.Tables[0].Rows[n]["productionDate"] != null && ds2.Tables[0].Rows[n]["productionDate"].ToString() != "") { modelt.productionDate = DateTime.Parse(ds2.Tables[0].Rows[n]["productionDate"].ToString()); } if (ds2.Tables[0].Rows[n]["ExpiryEndDate"] != null && ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString() != "") { modelt.ExpiryEndDate = DateTime.Parse(ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString()); } if (ds2.Tables[0].Rows[n]["updateDate"] != null && ds2.Tables[0].Rows[n]["updateDate"].ToString() != "") { modelt.updateDate = DateTime.Parse(ds2.Tables[0].Rows[n]["updateDate"].ToString()); } if (ds2.Tables[0].Rows[n]["catalogId"] != null && ds2.Tables[0].Rows[n]["catalogId"].ToString() != "") { modelt.catalogId = int.Parse(ds2.Tables[0].Rows[n]["catalogId"].ToString()); } #endregion models.Add(modelt); } model.order_goods = models; } #endregion retlist.Add(model); } return(retlist); } else { return(null); } }
/// <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); } }
/// <summary> /// 得到一个对象实体 /// </summary> public WechatBuilder.Model.wx_shop_product GetModel(int id) { Model.wx_shop_product product = new Model.wx_shop_product(); StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,wid,categoryId,brandId,sku,productName,shortDesc,unit,weight,description,seo_title,seo_keywords,seo_description,focusImgUrl,thumbnailsUrll,recommended,latest,hotsale,specialOffer,costPrice,marketPrice,salePrice,upselling,stock,addDate,vistiCounts,sort_id,productionDate,ExpiryEndDate,updateDate,catalogId from wx_shop_product "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; WechatBuilder.Model.wx_shop_product model = new WechatBuilder.Model.wx_shop_product(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { product= DataRowToModel(ds.Tables[0].Rows[0]); } return product; }
/// <summary> /// �õ�һ������ʵ���б� /// </summary> public IList<Model.orders> GetModelList(string sqlWhere) { IList<Model.orders> retlist = new List<Model.orders>(); StringBuilder strSql = new StringBuilder(); strSql.Append("select id,order_no,trade_no,user_id,user_name,payment_id,payment_fee,payment_status,payment_time,express_id,express_no,express_fee,express_status,express_time,accept_name,post_code,telphone,mobile,area,address,message,remark,payable_amount,real_amount,order_amount,point,status,add_time,confirm_time,complete_time,wid,openid,modelName,modelCode,modelActionName,modelActionId,orderSubject,city,district,notify_id,pay_info,isSubscribe,fahuoCode,fahuoMsg "); strSql.Append(" from " + databaseprefix + "orders "); if (sqlWhere.Trim() != "") { strSql.Append(" where "+sqlWhere); } Model.orders model = new Model.orders(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); DataSet ds2 = new DataSet(); List<Model.wx_shop_product> models = new List<Model.wx_shop_product>(); if (ds.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { model = new Model.orders(); dr = ds.Tables[0].Rows[i]; #region ������Ϣ if (dr["id"].ToString() != "") { model.id = int.Parse(dr["id"].ToString()); } model.order_no = dr["order_no"].ToString(); model.trade_no = dr["trade_no"].ToString(); if (dr["user_id"].ToString() != "") { model.user_id = int.Parse(dr["user_id"].ToString()); } model.user_name = dr["user_name"].ToString(); if (dr["payment_id"].ToString() != "") { model.payment_id = int.Parse(dr["payment_id"].ToString()); } if (dr["payment_fee"].ToString() != "") { model.payment_fee = decimal.Parse(dr["payment_fee"].ToString()); } if (dr["payment_status"].ToString() != "") { model.payment_status = int.Parse(dr["payment_status"].ToString()); } if (dr["payment_time"].ToString() != "") { model.payment_time = DateTime.Parse(dr["payment_time"].ToString()); } if (dr["express_id"].ToString() != "") { model.express_id = int.Parse(dr["express_id"].ToString()); } model.express_no = dr["express_no"].ToString(); if (dr["express_fee"].ToString() != "") { model.express_fee = decimal.Parse(dr["express_fee"].ToString()); } if (dr["express_status"].ToString() != "") { model.express_status = int.Parse(dr["express_status"].ToString()); } if (dr["express_time"].ToString() != "") { model.express_time = DateTime.Parse(dr["express_time"].ToString()); } model.accept_name = dr["accept_name"].ToString(); model.post_code = dr["post_code"].ToString(); model.telphone = dr["telphone"].ToString(); model.mobile = dr["mobile"].ToString(); model.area = dr["area"].ToString(); model.address = dr["address"].ToString(); model.message = dr["message"].ToString(); model.remark = dr["remark"].ToString(); if (dr["payable_amount"].ToString() != "") { model.payable_amount = decimal.Parse(dr["payable_amount"].ToString()); } if (dr["real_amount"].ToString() != "") { model.real_amount = decimal.Parse(dr["real_amount"].ToString()); } if (dr["order_amount"].ToString() != "") { model.order_amount = decimal.Parse(dr["order_amount"].ToString()); } if (dr["point"].ToString() != "") { model.point = int.Parse(dr["point"].ToString()); } if (ds.Tables[0].Rows[0]["status"].ToString() != "") { model.status = int.Parse(dr["status"].ToString()); } if (dr["add_time"].ToString() != "") { model.add_time = DateTime.Parse(dr["add_time"].ToString()); } if (dr["confirm_time"].ToString() != "") { model.confirm_time = DateTime.Parse(dr["confirm_time"].ToString()); } if (dr["complete_time"].ToString() != "") { model.complete_time = DateTime.Parse(dr["complete_time"].ToString()); } if (dr["wid"] != null && dr["wid"].ToString() != "") { model.wid = int.Parse(dr["wid"].ToString()); } if (dr["openid"] != null) { model.openid = dr["openid"].ToString(); } if (ds.Tables[0].Rows[0]["modelName"] != null) { model.modelName = ds.Tables[0].Rows[0]["modelName"].ToString(); } if (ds.Tables[0].Rows[0]["modelCode"] != null) { model.modelCode = ds.Tables[0].Rows[0]["modelCode"].ToString(); } if (ds.Tables[0].Rows[0]["modelActionName"] != null) { model.modelActionName = ds.Tables[0].Rows[0]["modelActionName"].ToString(); } if (ds.Tables[0].Rows[0]["modelActionId"] != null && ds.Tables[0].Rows[0]["modelActionId"].ToString() != "") { model.modelActionId = int.Parse(ds.Tables[0].Rows[0]["modelActionId"].ToString()); } if (ds.Tables[0].Rows[0]["orderSubject"] != null) { model.orderSubject = ds.Tables[0].Rows[0]["orderSubject"].ToString(); } if (ds.Tables[0].Rows[0]["city"] != null) { model.city = ds.Tables[0].Rows[0]["city"].ToString(); } if (ds.Tables[0].Rows[0]["district"] != null) { model.district = ds.Tables[0].Rows[0]["district"].ToString(); } if (ds.Tables[0].Rows[0]["notify_id"] != null) { model.notify_id = ds.Tables[0].Rows[0]["notify_id"].ToString(); } if (ds.Tables[0].Rows[0]["pay_info"] != null) { model.pay_info = ds.Tables[0].Rows[0]["pay_info"].ToString(); } if (ds.Tables[0].Rows[0]["isSubscribe"] != null && ds.Tables[0].Rows[0]["isSubscribe"].ToString() != "") { if ((ds.Tables[0].Rows[0]["isSubscribe"].ToString() == "1") || (ds.Tables[0].Rows[0]["isSubscribe"].ToString().ToLower() == "true")) { model.isSubscribe = true; } else { model.isSubscribe = false; } } if (ds.Tables[0].Rows[0]["fahuoCode"] != null) { model.fahuoCode = ds.Tables[0].Rows[0]["fahuoCode"].ToString(); } if (ds.Tables[0].Rows[0]["fahuoMsg"] != null) { model.fahuoMsg = ds.Tables[0].Rows[0]["fahuoMsg"].ToString(); } #endregion #region �ӱ���Ϣ StringBuilder strSql2 = new StringBuilder(); strSql2.Append("select (select top 1 original_path from wx_shop_albums where productId=p.id) as productpic,p.*,og.quantity,og.real_price from wx_shop_product p right join dt_order_goods og on p.id=og.goods_id where og.order_id=@id"); SqlParameter[] parameters2 = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters2[0].Value = model.id; ds2 = DbHelperSQL.Query(strSql2.ToString(), parameters2); if (ds2.Tables[0].Rows.Count > 0) { int count = ds2.Tables[0].Rows.Count; models = new List<Model.wx_shop_product>(); Model.wx_shop_product modelt; for (int n = 0; n < count; n++) { modelt = new Model.wx_shop_product(); #region �ӱ��forѭ�� if (ds2.Tables[0].Rows[n]["id"] != null && ds2.Tables[0].Rows[n]["id"].ToString() != "") { modelt.id = int.Parse(ds2.Tables[0].Rows[n]["id"].ToString()); } if (ds2.Tables[0].Rows[n]["quantity"] != null && ds2.Tables[0].Rows[n]["quantity"].ToString() != "") { modelt.stock = int.Parse(ds2.Tables[0].Rows[n]["quantity"].ToString()); } if (ds2.Tables[0].Rows[n]["wid"] != null && ds2.Tables[0].Rows[n]["wid"].ToString() != "") { modelt.wid = int.Parse(ds2.Tables[0].Rows[n]["wid"].ToString()); } if (ds2.Tables[0].Rows[n]["categoryId"] != null && ds2.Tables[0].Rows[n]["categoryId"].ToString() != "") { modelt.categoryId = int.Parse(ds2.Tables[0].Rows[n]["categoryId"].ToString()); } if (ds2.Tables[0].Rows[n]["brandId"] != null && ds2.Tables[0].Rows[n]["brandId"].ToString() != "") { modelt.brandId = int.Parse(ds2.Tables[0].Rows[n]["brandId"].ToString()); } if (ds2.Tables[0].Rows[n]["sku"] != null) { modelt.sku = ds2.Tables[0].Rows[n]["sku"].ToString(); } if (ds2.Tables[0].Rows[n]["productName"] != null) { modelt.productName = ds2.Tables[0].Rows[n]["productName"].ToString(); } if (ds2.Tables[0].Rows[n]["shortDesc"] != null) { modelt.shortDesc = ds2.Tables[0].Rows[n]["shortDesc"].ToString(); } if (ds2.Tables[0].Rows[n]["unit"] != null) { modelt.unit = ds2.Tables[0].Rows[n]["unit"].ToString(); } if (ds2.Tables[0].Rows[n]["weight"] != null && ds2.Tables[0].Rows[n]["weight"].ToString() != "") { modelt.weight = decimal.Parse(ds2.Tables[0].Rows[n]["weight"].ToString()); } if (ds2.Tables[0].Rows[n]["description"] != null) { modelt.description = ds2.Tables[0].Rows[n]["description"].ToString(); } if (ds2.Tables[0].Rows[n]["seo_title"] != null) { modelt.seo_title = ds2.Tables[0].Rows[n]["seo_title"].ToString(); } if (ds2.Tables[0].Rows[n]["seo_keywords"] != null) { modelt.seo_keywords = ds2.Tables[0].Rows[n]["seo_keywords"].ToString(); } if (ds2.Tables[0].Rows[n]["seo_description"] != null) { modelt.seo_description = ds2.Tables[0].Rows[n]["seo_description"].ToString(); } if (ds2.Tables[0].Rows[n]["focusImgUrl"] != null) { modelt.focusImgUrl = ds2.Tables[0].Rows[n]["productpic"].ToString(); } if (ds2.Tables[0].Rows[n]["thumbnailsUrll"] != null) { modelt.thumbnailsUrll = ds2.Tables[0].Rows[n]["thumbnailsUrll"].ToString(); } if (ds2.Tables[0].Rows[n]["recommended"] != null && ds2.Tables[0].Rows[n]["recommended"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["recommended"].ToString() == "1") || (ds2.Tables[0].Rows[n]["recommended"].ToString().ToLower() == "true")) { modelt.recommended = true; } else { modelt.recommended = false; } } if (ds2.Tables[0].Rows[n]["latest"] != null && ds2.Tables[0].Rows[n]["latest"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["latest"].ToString() == "1") || (ds2.Tables[0].Rows[n]["latest"].ToString().ToLower() == "true")) { modelt.latest = true; } else { modelt.latest = false; } } if (ds2.Tables[0].Rows[n]["hotsale"] != null && ds2.Tables[0].Rows[n]["hotsale"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["hotsale"].ToString() == "1") || (ds2.Tables[0].Rows[n]["hotsale"].ToString().ToLower() == "true")) { modelt.hotsale = true; } else { modelt.hotsale = false; } } if (ds2.Tables[0].Rows[n]["specialOffer"] != null && ds2.Tables[0].Rows[n]["specialOffer"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["specialOffer"].ToString() == "1") || (ds2.Tables[0].Rows[n]["specialOffer"].ToString().ToLower() == "true")) { modelt.specialOffer = true; } else { modelt.specialOffer = false; } } if (ds2.Tables[0].Rows[n]["costPrice"] != null && ds2.Tables[0].Rows[n]["costPrice"].ToString() != "") { modelt.costPrice = decimal.Parse(ds2.Tables[0].Rows[n]["costPrice"].ToString()); } if (ds2.Tables[0].Rows[n]["marketPrice"] != null && ds2.Tables[0].Rows[n]["marketPrice"].ToString() != "") { modelt.marketPrice = decimal.Parse(ds2.Tables[0].Rows[n]["marketPrice"].ToString()); } if (ds2.Tables[0].Rows[n]["salePrice"] != null && ds2.Tables[0].Rows[n]["salePrice"].ToString() != "") { modelt.salePrice = decimal.Parse(ds2.Tables[0].Rows[n]["salePrice"].ToString()); } if (ds2.Tables[0].Rows[n]["upselling"] != null && ds2.Tables[0].Rows[n]["upselling"].ToString() != "") { if ((ds2.Tables[0].Rows[n]["upselling"].ToString() == "1") || (ds2.Tables[0].Rows[n]["upselling"].ToString().ToLower() == "true")) { modelt.upselling = true; } else { modelt.upselling = false; } } if (ds2.Tables[0].Rows[n]["addDate"] != null && ds2.Tables[0].Rows[n]["addDate"].ToString() != "") { modelt.addDate = DateTime.Parse(ds2.Tables[0].Rows[n]["addDate"].ToString()); } if (ds2.Tables[0].Rows[n]["vistiCounts"] != null && ds2.Tables[0].Rows[n]["vistiCounts"].ToString() != "") { modelt.vistiCounts = int.Parse(ds2.Tables[0].Rows[n]["vistiCounts"].ToString()); } if (ds2.Tables[0].Rows[n]["sort_id"] != null && ds2.Tables[0].Rows[n]["sort_id"].ToString() != "") { modelt.sort_id = int.Parse(ds2.Tables[0].Rows[n]["sort_id"].ToString()); } if (ds2.Tables[0].Rows[n]["productionDate"] != null && ds2.Tables[0].Rows[n]["productionDate"].ToString() != "") { modelt.productionDate = DateTime.Parse(ds2.Tables[0].Rows[n]["productionDate"].ToString()); } if (ds2.Tables[0].Rows[n]["ExpiryEndDate"] != null && ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString() != "") { modelt.ExpiryEndDate = DateTime.Parse(ds2.Tables[0].Rows[n]["ExpiryEndDate"].ToString()); } if (ds2.Tables[0].Rows[n]["updateDate"] != null && ds2.Tables[0].Rows[n]["updateDate"].ToString() != "") { modelt.updateDate = DateTime.Parse(ds2.Tables[0].Rows[n]["updateDate"].ToString()); } if (ds2.Tables[0].Rows[n]["catalogId"] != null && ds2.Tables[0].Rows[n]["catalogId"].ToString() != "") { modelt.catalogId = int.Parse(ds2.Tables[0].Rows[n]["catalogId"].ToString()); } #endregion models.Add(modelt); } model.order_product = models; } #endregion retlist.Add(model); } return retlist; } else { return null; } }
/// <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); } }