private void load_products() { productid.Clear(); quantity.Clear(); price.Clear(); HttpCookie myCookies = Request.Cookies["myCookieId"]; string user_id = myCookies["userid"]; string[] products = myservice.product_list(user_id, "", ""); string[] qty = myservice.quantity(user_id, "", ""); for (int x = 0; x < products.Length; x++) { productid.AddLast(products[x]); quantity.AddLast(Convert.ToInt32(qty[x])); string display = "Products: " + products[x] + " Quantity: " + qty[x]; ListBox1.Items.Add(display); } for (int x = 0; x < productid.Count; x++) { string[] data = myservice.book_details(productid.ElementAt(x), "", ""); price.AddLast(Convert.ToDouble(data[5])); } double total_price = 0; for (int x = 0; x < productid.Count; x++) { total_price += (quantity.ElementAt(x) * price.ElementAt(x)); } Label3.Text = Convert.ToString(total_price); }
private void load_products() { productid.Clear(); quantity.Clear(); price.Clear(); HttpCookie myCookies = Request.Cookies["myCookieId"]; string user_id = myCookies["userid"]; string[] products = myservice.product_list(user_id, "", ""); string[] qty = myservice.quantity(user_id, "", ""); for (int x = 0; x < products.Length; x++) { productid.AddLast(products[x]); quantity.AddLast(Convert.ToInt32(qty[x])); } for (int x = 0; x < productid.Count; x++) { string[] data = myservice.book_details(productid.ElementAt(x), "", ""); price.AddLast(Convert.ToDouble(data[5])); } for (int x = 0; x < productid.Count; x++) { TextBox1.Text += "Products: " + productid.ElementAt(x) + " Quantity: " + quantity.ElementAt(x) + " Price: " + price.ElementAt(x) + "\n"; } }