private void ProcessProductDetails(System.Web.HttpContext context) { string str = "http://" + System.Web.HttpContext.Current.Request.Url.Host + ((System.Web.HttpContext.Current.Request.Url.Port == 80) ? "" : (":" + System.Web.HttpContext.Current.Request.Url.Port)); int distributorId = int.Parse(context.Request["distributorUserId"]); int productId = int.Parse(context.Request["productId"]); PublishToTaobaoProductInfo taobaoProduct = SubSiteProducthelper.GetTaobaoProduct(productId, distributorId); System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("{"); stringBuilder.AppendFormat("\"Cid\":\"{0}\",", taobaoProduct.Cid); stringBuilder.AppendFormat("\"StuffStatus\":\"{0}\",", taobaoProduct.StuffStatus); stringBuilder.AppendFormat("\"ProductId\":\"{0}\",", taobaoProduct.ProductId); stringBuilder.AppendFormat("\"ProTitle\":\"{0}\",", taobaoProduct.ProTitle); stringBuilder.AppendFormat("\"Num\":\"{0}\",", taobaoProduct.Num); stringBuilder.AppendFormat("\"LocationState\":\"{0}\",", taobaoProduct.LocationState); stringBuilder.AppendFormat("\"LocationCity\":\"{0}\",", taobaoProduct.LocationCity); stringBuilder.AppendFormat("\"FreightPayer\":\"{0}\",", taobaoProduct.FreightPayer); stringBuilder.AppendFormat("\"PostFee\":\"{0}\",", taobaoProduct.PostFee.ToString("F2")); stringBuilder.AppendFormat("\"ExpressFee\":\"{0}\",", taobaoProduct.ExpressFee.ToString("F2")); stringBuilder.AppendFormat("\"EMSFee\":\"{0}\",", taobaoProduct.EMSFee.ToString("F2")); stringBuilder.AppendFormat("\"HasInvoice\":\"{0}\",", taobaoProduct.HasInvoice); stringBuilder.AppendFormat("\"HasWarranty\":\"{0}\",", taobaoProduct.HasWarranty); stringBuilder.AppendFormat("\"HasDiscount\":\"{0}\",", taobaoProduct.HasDiscount); stringBuilder.AppendFormat("\"ValidThru\":\"{0}\",", taobaoProduct.ValidThru); stringBuilder.AppendFormat("\"ListTime\":\"{0}\",", taobaoProduct.ListTime); stringBuilder.AppendFormat("\"PropertyAlias\":\"{0}\",", taobaoProduct.PropertyAlias); stringBuilder.AppendFormat("\"InputPids\":\"{0}\",", taobaoProduct.InputPids); stringBuilder.AppendFormat("\"InputStr\":\"{0}\",", taobaoProduct.InputStr); stringBuilder.AppendFormat("\"SkuProperties\":\"{0}\",", taobaoProduct.SkuProperties); stringBuilder.AppendFormat("\"SkuQuantities\":\"{0}\",", taobaoProduct.SkuQuantities); stringBuilder.AppendFormat("\"SkuPrices\":\"{0}\",", taobaoProduct.SkuPrices); stringBuilder.AppendFormat("\"SkuOuterIds\":\"{0}\",", taobaoProduct.SkuOuterIds); stringBuilder.AppendFormat("\"FoodAttributes\":\"{0}\",", System.Web.HttpUtility.UrlEncode(taobaoProduct.FoodAttributes)); stringBuilder.AppendFormat("\"TaobaoProductId\":\"{0}\",", taobaoProduct.TaobaoProductId); stringBuilder.AppendFormat("\"ProductCode\":\"{0}\",", taobaoProduct.ProductCode); stringBuilder.AppendFormat("\"Description\":\"{0}\",", taobaoProduct.Description.Replace(string.Format("src=\"{0}/Storage/master/gallery", Globals.ApplicationPath), string.Format("src=\"{0}/Storage/master/gallery", str + Globals.ApplicationPath)).Replace('"', '“')); string text = str + Globals.ApplicationPath + taobaoProduct.ImageUrl1; if (System.IO.File.Exists(Globals.MapPath(Globals.ApplicationPath + taobaoProduct.ImageUrl1)) && (text.EndsWith(".jpg", System.StringComparison.CurrentCultureIgnoreCase) || text.EndsWith(".gif", System.StringComparison.CurrentCultureIgnoreCase) || text.EndsWith(".png", System.StringComparison.CurrentCultureIgnoreCase) || text.EndsWith(".jpeg", System.StringComparison.CurrentCultureIgnoreCase))) { stringBuilder.AppendFormat("\"ImageName\":\"{0}\",", text); } if (!string.IsNullOrEmpty(taobaoProduct.ImageUrl2)) { string text2 = str + Globals.ApplicationPath + taobaoProduct.ImageUrl2; if (System.IO.File.Exists(Globals.MapPath(Globals.ApplicationPath + taobaoProduct.ImageUrl2)) && (text2.EndsWith(".jpg", System.StringComparison.CurrentCultureIgnoreCase) || text2.EndsWith(".gif", System.StringComparison.CurrentCultureIgnoreCase) || text2.EndsWith(".png", System.StringComparison.CurrentCultureIgnoreCase) || text2.EndsWith(".jpeg", System.StringComparison.CurrentCultureIgnoreCase))) { stringBuilder.AppendFormat("\"ImageName2\":\"{0}\",", text2); } } if (!string.IsNullOrEmpty(taobaoProduct.ImageUrl3)) { string text3 = str + Globals.ApplicationPath + taobaoProduct.ImageUrl3; if (System.IO.File.Exists(Globals.MapPath(Globals.ApplicationPath + taobaoProduct.ImageUrl3)) && (text3.EndsWith(".jpg", System.StringComparison.CurrentCultureIgnoreCase) || text3.EndsWith(".gif", System.StringComparison.CurrentCultureIgnoreCase) || text3.EndsWith(".png", System.StringComparison.CurrentCultureIgnoreCase) || text3.EndsWith(".jpeg", System.StringComparison.CurrentCultureIgnoreCase))) { stringBuilder.AppendFormat("\"ImageName3\":\"{0}\",", text3); } } if (!string.IsNullOrEmpty(taobaoProduct.ImageUrl4)) { string text4 = str + Globals.ApplicationPath + taobaoProduct.ImageUrl4; if (System.IO.File.Exists(Globals.MapPath(Globals.ApplicationPath + taobaoProduct.ImageUrl4)) && (text4.EndsWith(".jpg", System.StringComparison.CurrentCultureIgnoreCase) || text4.EndsWith(".gif", System.StringComparison.CurrentCultureIgnoreCase) || text4.EndsWith(".png", System.StringComparison.CurrentCultureIgnoreCase) || text4.EndsWith(".jpeg", System.StringComparison.CurrentCultureIgnoreCase))) { stringBuilder.AppendFormat("\"ImageName4\":\"{0}\",", text4); } } if (!string.IsNullOrEmpty(taobaoProduct.ImageUrl5)) { string text5 = str + Globals.ApplicationPath + taobaoProduct.ImageUrl5; if (System.IO.File.Exists(Globals.MapPath(Globals.ApplicationPath + taobaoProduct.ImageUrl5)) && (text5.EndsWith(".jpg", System.StringComparison.CurrentCultureIgnoreCase) || text5.EndsWith(".gif", System.StringComparison.CurrentCultureIgnoreCase) || text5.EndsWith(".png", System.StringComparison.CurrentCultureIgnoreCase) || text5.EndsWith(".jpeg", System.StringComparison.CurrentCultureIgnoreCase))) { stringBuilder.AppendFormat("\"ImageName5\":\"{0}\",", text5); } } stringBuilder.AppendFormat("\"SalePrice\":\"{0}\"", taobaoProduct.SalePrice.ToString("F2")); stringBuilder.Append("}"); context.Response.Write(stringBuilder.ToString()); }