一个不知道怎么问的,问题??

adoxcy adoxcy 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
有如下代码:如果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);
}
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
adoxcy
.NET社区 62,272 成员 668,968 内容