一个不知道怎么问的,问题??
有如下代码:如果OrderList.count中的长度有n长,也就是说OrderList里面有n个数,而哪个循环把每个数都会过一遍那subtotal.Text
和Total.Text 里面应该显示哪个数据的价格。
void updateshopchart()
{
ArrayList OrderList;
ArrayList qtyList;
int productId;
DataRow product;
double subt;
double tal;
double de = 0.9;
OrderList = (ArrayList)Session["orderList"];
qtyList = (ArrayList)Session["qtyList"];
subt = 0;
for (int i = 0; i <= OrderList.Count - 1; i++)
{
productId = (int)OrderList[i];
product = GetProduct(productId);
subt += double.Parse(product["price"].ToString()) * double.Parse(qtyList[i].ToString());
}
tal = subt * de;
subtotal.Text = string.Format("{0:C}", subt);
dec.Text = de.ToString();
Total.Text = string.Format("{0:C}", tal);
}