您好以下代码根据网格视图中的产品数量从库存中扣除产品数量,ID = gridagree
问题是我想要使用category = 1扣除产品数量并进行验证,检查所有产品数量是否在gridagree中是否大于库存数量,如果一个产品数量大于stoack中的数量代码不应该执行
Category Id =gridagree.Rows[index].Cells[7].Text
Product Id = gridagree.Rows[index].Cells[3].Text)
Product Quantity in the grid =gridagree.Rows[index].Cells[5].Text
StoreClass s = new StoreClass();
if(//suggested code)
{
lblmsg.Text="Product quantity is bigger than current balance please change product quantity and try again"// here also can i determine to the user which product has the issue product with id=?
}
else
{
for (int index = 0; index < this.gridagree.Rows.Count; index++)
{
if (gridagree.Rows[index].Cells[7].Text == "1")
{
string qun = s.getprodqun(Convert.ToInt32(gridagree.Rows[index].Cells[3].Text));
s.subtract(Convert.ToInt32(gridagree.Rows[index].Cells[3].Text), Convert.ToInt32(qun) - Convert.ToInt32(gridagree.Rows[index].Cells[5].Text));
}
}
}
答案 0 :(得分:0)
我正在转发对代码的评论,并且只会向您提供我相信您所问的内容。如何在样本中编写代码,您需要另一个循环...
{{1}}