- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
for (int i = 0; i < gvOrderMain.RowCount - EditIndex; i++)
{
float tempQuantity = GetRow(i).Quantity;
int partyLen = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray().Length;
for (int j = 0; j < partyLen; j++)
{
if (DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity > 0)
{
float CurSQuantity = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity.Value;
if (tempQuantity > CurSQuantity)
{
Documents_Product dp = new Documents_Product();
dp.PrimePriceExcVAT = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].PrimePriceExcVAT;
dp.PrimePriceIncVAT = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].PrimePriceIncVAT;
dp.Quantity = -1 * DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity;
dp.OldQuantity = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity;
dp.PartyNumber = DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].PartyNumber;
DB.Documents_Products.InsertOnSubmit(dp);
DB.SubmitChanges();
Documents_ProductsOrder dro = new Documents_ProductsOrder();
dro.PriceSum = GetRow(i).RealPrice * DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity;
tempQuantity = tempQuantity - DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity.Value;
DB.PrInStOrderByPartyNum(GetRow(i).ProductId, curStockId).ToArray()[j].Quantity = 0;
DB.Documents_ProductsOrders.InsertOnSubmit(dro);
DB.SubmitChanges();
..........