Ejemplo n.º 1
0
        protected void itemDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            reorderLevelTextBox.Enabled      = false;
            availableQuantityTextBox.Enabled = false;
            int id = Convert.ToInt32(itemDropDownList.SelectedValue);

            if (id == 0)
            {
                reorderLevelTextBox.Text = "0";
            }
            else
            {
                Item item = stockOutManager.GetReorderLevelByItemId(id);
                reorderLevelTextBox.Text = item.Reorder.ToString();
            }
            StockIn stockIn  = stockOutManager.GetAvailableQuantityByItemId(id);
            int     quantity = stockIn.Quantity;

            if (quantity == 0)
            {
                availableQuantityTextBox.Text = "0";
            }
            else
            {
                availableQuantityTextBox.Text = quantity.ToString();
            }
        }
        protected void itemDropdownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            reorderLevelTextBox.Enabled      = false;
            availableQuantityTextBox.Enabled = false;
            int id = Convert.ToInt32(itemDropdownList.SelectedValue);

            if (id == 0)
            {
                reorderLevelTextBox.Text = 0.ToString();
            }
            else
            {
                Item item = stockOutManager.GetReorderLevelByItemId(id);
                reorderLevelTextBox.Text = item.ReorderLevel.ToString();
            }
            StockIn stockIn  = stockOutManager.GetAvailableQuantityByItemId(id);
            int     quantity = stockIn.AvailableQuantity;

            if (quantity == 0)
            {
                availableQuantityTextBox.Text = 0.ToString();
            }
            else
            {
                List <StockOut> stockOutList = (List <StockOut>)ViewState["StockOut"];
                if (stockOutList != null)
                {
                    availableQuantityTextBox.Text = quantity.ToString();
                    foreach (StockOut stockOut in stockOutList)
                    {
                        int tempCompanyId = Convert.ToInt32(companyDropdownList.SelectedValue);
                        int tempItemId    = Convert.ToInt32(itemDropdownList.SelectedValue);
                        int companyId     = stockOut.CompanyId;
                        int itemId        = stockOut.ItemId;
                        if (tempCompanyId == companyId && tempItemId == itemId)
                        {
                            int stockOutQuantity = stockOut.StockOutQuantity;
                            availableQuantityTextBox.Text = (quantity - stockOutQuantity).ToString();
                            break;
                        }
                        else
                        {
                            availableQuantityTextBox.Text = quantity.ToString();
                        }
                    }
                }
                else
                {
                    availableQuantityTextBox.Text = quantity.ToString();
                }
            }
        }