protected void Page_Load(object sender, EventArgs e) { StringBuilder builder = new StringBuilder(); string str = ""; string str2 = ""; string str3 = "1"; if (base.Request.Params["serachName"] != null) { str = base.Request.Params["serachName"].Trim(); } if (base.Request.Params["serachSKU"] != null) { str2 = base.Request.Params["serachSKU"].Trim(); } if (base.Request.Params["page"] != null) { str3 = base.Request.Params["page"].Trim(); } ProductQuery query = new ProductQuery(); query.PageSize = 8; query.PageIndex = Convert.ToInt32(str3); query.Keywords = str; query.ProductCode = str2; int count = 0; builder.Append("{"); builder.Append("\"data\":["); DataTable puchaseProducts = SubSiteProducthelper.GetPuchaseProducts(query, out count); int num2 = puchaseProducts.Rows.Count; for (int i = 0; i < num2; i++) { DataRow row = puchaseProducts.Rows[i]; builder.Append("{"); builder.AppendFormat("\"skuId\":\"{0}\"", row["SkuId"]); builder.AppendFormat(",\"sku\":\"{0}\"", row["SKU"]); builder.AppendFormat(",\"productId\":\"{0}\"", row["ProductId"].ToString().Trim()); string str4 = row["ProductName"].ToString().Trim(); builder.AppendFormat(",\"Name\":\"{0}\"", str4); builder.AppendFormat(",\"Price\":\"{0}\"", row["PurchasePrice"]); builder.AppendFormat(",\"Stock\":\"{0}\"", row["Stock"]); if (i == (num2 - 1)) { builder.Append("}"); } else { builder.Append("},"); } } builder.AppendFormat("],\"recCount\":\"{0}\"", count); builder.Append("}"); base.Response.ContentType = "application/json"; string s = builder.ToString(); base.Response.Write(s); base.Response.End(); }
protected void Page_Load(object sender, System.EventArgs e) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); string keywords = ""; string productCode = ""; string value = "1"; if (base.Request.Params["serachName"] != null) { keywords = base.Request.Params["serachName"].Trim(); } if (base.Request.Params["serachSKU"] != null) { productCode = base.Request.Params["serachSKU"].Trim(); } if (base.Request.Params["page"] != null) { value = base.Request.Params["page"].Trim(); } ProductQuery productQuery = new ProductQuery(); productQuery.PageSize = 8; productQuery.PageIndex = System.Convert.ToInt32(value); productQuery.Keywords = keywords; productQuery.ProductCode = productCode; int num = 0; stringBuilder.Append("{"); stringBuilder.Append("\"data\":["); System.Data.DataTable puchaseProducts = SubSiteProducthelper.GetPuchaseProducts(productQuery, out num); int count = puchaseProducts.Rows.Count; for (int i = 0; i < count; i++) { System.Data.DataRow dataRow = puchaseProducts.Rows[i]; stringBuilder.Append("{"); stringBuilder.AppendFormat("\"skuId\":\"{0}\"", dataRow["SkuId"]); stringBuilder.AppendFormat(",\"sku\":\"{0}\"", dataRow["SKU"]); stringBuilder.AppendFormat(",\"productId\":\"{0}\"", dataRow["ProductId"].ToString().Trim()); string arg = dataRow["ProductName"].ToString().Trim(); stringBuilder.AppendFormat(",\"Name\":\"{0}\"", arg); stringBuilder.AppendFormat(",\"Price\":\"{0}\"", dataRow["PurchasePrice"]); stringBuilder.AppendFormat(",\"Stock\":\"{0}\"", dataRow["Stock"]); if (i == count - 1) { stringBuilder.Append("}"); } else { stringBuilder.Append("},"); } } stringBuilder.AppendFormat("],\"recCount\":\"{0}\"", num); stringBuilder.Append("}"); base.Response.ContentType = "application/json"; string s = stringBuilder.ToString(); base.Response.Write(s); base.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { StringBuilder builder = new StringBuilder(); string sarachName = ""; string searchSku = ""; string page = "1"; if (Request.Params["serachName"] != null) { sarachName = Request.Params["serachName"].Trim(); } if (Request.Params["serachSKU"] != null) { searchSku = Request.Params["serachSKU"].Trim(); } if (base.Request.Params["page"] != null) { page = Request.Params["page"].Trim(); } ProductQuery query = new ProductQuery(); query.PageSize = 8; query.PageIndex = Convert.ToInt32(page); query.Keywords = sarachName; query.ProductCode = searchSku; int count = 0; builder.Append("{data:["); DataTable puchaseProducts = SubSiteProducthelper.GetPuchaseProducts(query, out count); for (int i = 0; i < puchaseProducts.Rows.Count; i++) { builder.Append("{'skuId':'"); builder.Append(puchaseProducts.Rows[i]["SkuId"].ToString()); builder.Append("','sku':'"); builder.Append(puchaseProducts.Rows[i]["SKU"].ToString()); builder.Append("','productId':'"); builder.Append(puchaseProducts.Rows[i]["ProductId"].ToString().Trim()); builder.Append("','Name':'"); builder.Append(puchaseProducts.Rows[i]["ProductName"].ToString()); builder.Append("','Price':'"); builder.Append(puchaseProducts.Rows[i]["PurchasePrice"].ToString()); builder.Append("','Stock':'"); builder.Append(puchaseProducts.Rows[i]["Stock"].ToString()); builder.Append("'},"); } builder.Append("],recCount:'"); builder.Append(count); builder.Append("'}"); Response.ContentType = "text/plain"; Response.Write(builder.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (string.Compare(base.Request.RequestType, "post", true) != 0) { this.btnSubmit.Enabled = false; } else if (base.IsPostBack) { this.tbOrders = (IList <tbOrder>) this.Session["tbOrders"]; } else { XmlDocument document = new XmlDocument(); if (string.IsNullOrEmpty(base.Request.Form["data"])) { this.ShowMsg("数据丢失,请关闭此页重新操作", false); } else { document.LoadXml(base.Request.Form["data"]); this.tbOrders = new List <tbOrder>(); XmlNodeList list = document.FirstChild.SelectNodes("order"); string innerText = null; string str2 = null; for (int i = 0; i < list.Count; i++) { string str3; tbOrder order = new tbOrder(); XmlNode node = list.Item(i); if (innerText == null) { innerText = node.SelectSingleNode("ship_addr").InnerText; str2 = node.SelectSingleNode("ship_name").InnerText; } else { str3 = node.SelectSingleNode("ship_addr").InnerText; string str4 = node.SelectSingleNode("ship_name").InnerText; if ((innerText != str3) || (str2 != str4)) { this.ShowMsg("收货人地址/姓名不一致不能合并下单!", false); break; } str2 = str4; innerText = str3; } string[] strArray = innerText.Split(new char[] { ' ' }); this.txtShipTo.Text = str2; if (strArray.Length >= 4) { str3 = strArray[0] + "," + strArray[1] + "," + strArray[2]; this.rsddlRegion.SelectedRegions = str3; this.txtAddress.Text = strArray[3]; } this.txtZipcode.Text = node.SelectSingleNode("ship_zipcode").InnerText; this.txtTel.Text = node.SelectSingleNode("ship_tel").InnerText; this.txtMobile.Text = node.SelectSingleNode("ship_mobile").InnerText; this.radioShippingMode.DataBind(); if (this.radioShippingMode.Items.Count > 0) { this.radioShippingMode.Items[0].Selected = true; } order.orderId = node.SelectSingleNode("order_id").InnerText; order.buyer = node.SelectSingleNode("buyer").InnerText; order.createTime = node.SelectSingleNode("createtime").InnerText; order.orderMemo = node.SelectSingleNode("order_memo").InnerText; XmlNode node2 = node.SelectSingleNode("items"); double num2 = 0.0; for (int j = 0; j < node2.ChildNodes.Count; j++) { tbOrderItem item = new tbOrderItem(); item.id = string.Format("{0}_{1}", order.orderId, j); item.title = node2.ChildNodes[j].SelectSingleNode("title").InnerText; item.spec = node2.ChildNodes[j].SelectSingleNode("spec").InnerText; item.price = node2.ChildNodes[j].SelectSingleNode("price").InnerText; item.number = node2.ChildNodes[j].SelectSingleNode("number").InnerText; if (string.IsNullOrEmpty(item.number)) { item.number = "1"; } item.url = node2.ChildNodes[j].SelectSingleNode("url").InnerText; HttpRequest request = HttpContext.Current.Request; if (request.Cookies[Globals.UrlEncode(item.title + item.spec)] != null) { ProductQuery query = new ProductQuery(); query.PageSize = 1; query.PageIndex = 1; query.ProductCode = Globals.UrlDecode(request.Cookies[Globals.UrlEncode(item.title + item.spec)].Value); int count = 0; DataTable puchaseProducts = SubSiteProducthelper.GetPuchaseProducts(query, out count); if (puchaseProducts.Rows.Count > 0) { item.localSkuId = puchaseProducts.Rows[0]["SkuId"].ToString(); item.localSKU = puchaseProducts.Rows[0]["SKU"].ToString(); item.localProductId = puchaseProducts.Rows[0]["ProductId"].ToString().Trim(); item.localProductName = puchaseProducts.Rows[0]["ProductName"].ToString(); item.thumbnailUrl100 = puchaseProducts.Rows[0]["ThumbnailUrl100"].ToString(); item.localPrice = puchaseProducts.Rows[0]["PurchasePrice"].ToString(); item.localStock = puchaseProducts.Rows[0]["Stock"].ToString(); num2 += Convert.ToDouble(puchaseProducts.Rows[0]["PurchasePrice"]) * Convert.ToInt32(item.number); } } else { ProductQuery query2 = new ProductQuery(); query2.PageSize = 1; query2.PageIndex = 1; query2.Keywords = item.title; int num5 = 0; DataTable table2 = SubSiteProducthelper.GetPuchaseProducts(query2, out num5); if (num5 == 1) { item.localSkuId = table2.Rows[0]["SkuId"].ToString(); item.localSKU = table2.Rows[0]["SKU"].ToString(); item.localProductId = table2.Rows[0]["ProductId"].ToString().Trim(); item.localProductName = table2.Rows[0]["ProductName"].ToString(); item.thumbnailUrl100 = table2.Rows[0]["ThumbnailUrl100"].ToString(); item.localPrice = table2.Rows[0]["PurchasePrice"].ToString(); item.localStock = table2.Rows[0]["Stock"].ToString(); num2 += Convert.ToDouble(table2.Rows[0]["PurchasePrice"]) * Convert.ToInt32(item.number); } } order.items.Add(item); order.orderCost = num2; } this.tbOrders.Add(order); } this.Session["tbOrders"] = this.tbOrders; this.pageDataBind(); } } }