Esempio n. 1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            StockIn stockIn = new StockIn();

            stockIn.CompanyId         = Convert.ToInt32(companyDropDownList.SelectedValue);
            stockIn.ItemId            = Convert.ToInt32(itemDropDownList.SelectedValue);
            stockIn.ReorderLevel      = Convert.ToInt32(reorderLevelTextBox.Text);
            stockIn.AvailableQuantity = Convert.ToInt32(stockInQuantityTextBox.Text);
            stockIn.StockInQuantity   = Convert.ToInt32(stockInQuantityTextBox.Text);
            StockIn aStockIn = stockInManager.GetAvailableAndStockInQuantity(stockIn.ItemId);

            if (aStockIn != null)
            {
                int availableQuantity = aStockIn.AvailableQuantity;
                int stockInQuantity   = aStockIn.StockInQuantity;
                stockIn.AvailableQuantity     = stockIn.AvailableQuantity + availableQuantity;
                stockIn.StockInQuantity       = stockIn.StockInQuantity + stockInQuantity;
                messageLabel.Text             = stockInManager.Update(stockIn);
                availableQuantityTextBox.Text = stockIn.AvailableQuantity.ToString();
            }
            else
            {
                messageLabel.Text             = stockInManager.Save(stockIn);
                availableQuantityTextBox.Text = stockIn.AvailableQuantity.ToString();
            }
            stockInQuantityTextBox.Text = "";
        }