コード例 #1
0
        private void SaveInDb(string condition)
        {
            if (ViewState["stockOutListVS"] == null)
            {
                outputLabel.Text = "Please add some items.";
            }
            else
            {
                List <StockOut> stockOut = (List <StockOut>)ViewState["stockOutListVS"];

                foreach (StockOut aStockOut in stockOut)
                {
                    stockOutDB = new StockOutDB();

                    stockOutDB.CompanyId        = aStockOut.CompanyId;
                    stockOutDB.ItemId           = aStockOut.ItemId;
                    stockOutDB.ItemName         = aStockOut.ItemName;
                    stockOutDB.StockOutQuantity = aStockOut.StockOutQuantity;
                    stockOutDB.ItemType         = condition;
                    stockOutManager.GetAvailable(stockOutDB.ItemName, stockOutDB.CompanyId);


                    checkInS = checkInS + stockOutManager.Check(stockOutDB);
                }
                if (checkInS > 0)
                {
                    //outputLabel.Text = "Some items are insufficient";
                }
                else
                {
                    foreach (StockOut aStockOut in stockOut)
                    {
                        StockOutDB stockOutDB = new StockOutDB();

                        stockOutDB.CompanyId        = aStockOut.CompanyId;
                        stockOutDB.ItemId           = aStockOut.ItemId;
                        stockOutDB.ItemName         = aStockOut.ItemName;
                        stockOutDB.StockOutQuantity = aStockOut.StockOutQuantity;
                        stockOutDB.ItemType         = condition;
                        stockOutManager.GetAvailable(stockOutDB.ItemName, stockOutDB.CompanyId).ToString();

                        outputLabel.Text = stockOutManager.Save(stockOutDB);
                    }
                }
            }
        }