예제 #1
0
        protected void stockOutAddButton_Click(object sender, EventArgs e)
        {
            StockOut stockOut     = new StockOut();
            StockIn  stockIn      = new StockIn();
            string   checkCompany = companyDropDownList.SelectedItem.Text;
            string   checkItem    = itemDropDownList.SelectedItem.Text;
            int      companyid    = 0;
            int      itemid       = 0;



            if (stockOutQuantityTextBox.Text == "" && !(checkCompany.Equals("--Select--") || checkItem.Equals("--Select--")))
            {
                outputLabelForSubtract.Text = "Please fill Up quantity textBox.";
            }


            else if (!(checkCompany.Equals("--Select--") || checkItem.Equals("--Select--")))
            {
                companyid = Convert.ToInt32(companyDropDownList.SelectedValue);
                itemid    = Convert.ToInt32(itemDropDownList.SelectedValue);
                string stockinCheck = stockOutQuantityTextBox.Text;
                int    z            = 0;

                for (int i = 0; i < stockinCheck.Length; i++)
                {
                    if ((stockinCheck[i] >= 'a' && stockinCheck[i] <= 'z') || (stockinCheck[i] >= 'A' && stockinCheck[i] <= 'Z') || !(stockinCheck[i] >= '0' && stockinCheck[i] <= '9'))
                    {
                        z++;
                    }
                }



                if (stockInManager.GetQuantityByDropDown(companyid, itemid) == "0" || !(stockInManager.checkAvailability(companyid, itemid)))
                {
                    outputLabelForSubtract.Text = "Before adding anything, quantity Should be available. ";
                }
                else if (z > 0)
                {
                    outputLabelForSubtract.Text = "Please enter an integer value at stock quantity textbox";
                }
                else if (ViewState["stockOutVS"] == null && ViewState["stockInVS"] == null)
                {
                    List <StockOut> stockOutList = new List <StockOut>();
                    List <StockIn>  stockInList  = new List <StockIn>();
                    stockIn.CompanyId     = Convert.ToInt32(companyDropDownList.SelectedValue);
                    stockIn.ItemId        = Convert.ToInt32(itemDropDownList.SelectedValue);
                    stockIn.StockQuantity = Convert.ToInt32(stockOutQuantityTextBox.Text);
                    stockInList.Add(stockIn);

                    ViewState["stockInVS"] = stockInList;
                    stockOut.Company       = companyDropDownList.SelectedItem.Text;
                    stockOut.Item          = itemDropDownList.SelectedItem.Text;
                    stockOut.StockQuantity = Convert.ToInt32(stockOutQuantityTextBox.Text);
                    stockOutList.Add(stockOut);
                    ViewState["stockOutVS"]     = stockOutList;
                    stockOutGridView.DataSource = ViewState["stockOutVS"];
                    stockOutGridView.DataBind();
                }
                else
                {
                    List <StockIn> stockInList = (List <StockIn>)ViewState["stockInVS"];
                    stockIn.CompanyId     = Convert.ToInt32(companyDropDownList.SelectedValue);
                    stockIn.ItemId        = Convert.ToInt32(itemDropDownList.SelectedValue);
                    stockIn.StockQuantity = Convert.ToInt32(stockOutQuantityTextBox.Text);
                    stockInList.Add(stockIn);
                    ViewState["stockInVS"] = stockInList;

                    List <StockOut> stockOutList = (List <StockOut>)ViewState["stockOutVS"];
                    stockOut.Company       = companyDropDownList.SelectedItem.Text;
                    stockOut.Item          = itemDropDownList.SelectedItem.Text;
                    stockOut.StockQuantity = Convert.ToInt32(stockOutQuantityTextBox.Text);
                    stockOutList.Add(stockOut);
                    ViewState["stockOutVS"]     = stockOutList;
                    stockOutGridView.DataSource = ViewState["stockOutVS"];
                    stockOutGridView.DataBind();
                }
            }

            else
            {
                outputLabelForSubtract.Text = "Please select your desired things from dropdown list !";
            }
            stockOutQuantityTextBox.Text = "";
        }
예제 #2
0
        protected void stockInSaveButton_OnClick(object sender, EventArgs e)
        {
            StockIn stockIn      = new StockIn();
            string  checkCompany = companyDropDownList.SelectedItem.Text;
            string  checkItem    = itemDropDownList.SelectedItem.Text;



            //stockIn.Id = Convert.ToInt32(idHiddenField.Value);
            if (stockInQuantityTextBox.Text == "" && !(checkCompany.Equals("--Select--") || checkItem.Equals("--Select--")))
            {
                outputLabel.Text = "Please fill Up quantity textBox!";
            }
            else if (!(checkCompany.Equals("--Select--") || checkItem.Equals("--Select--")))
            {
                string stockinCheck = stockInQuantityTextBox.Text;
                int    z            = 0;

                for (int i = 0; i < stockinCheck.Length; i++)
                {
                    if ((stockinCheck[i] >= 'a' && stockinCheck[i] <= 'z') || (stockinCheck[i] >= 'A' && stockinCheck[i] <= 'Z') || !(stockinCheck[i] >= '0' && stockinCheck[i] <= '9'))
                    {
                        z++;
                    }
                }
                if (z > 0)
                {
                    outputLabel.Text = "Please enter an integer value in stock quantity textbox";
                }
                else
                {
                    stockIn.CompanyId     = Convert.ToInt32(companyDropDownList.SelectedValue);
                    stockIn.ItemId        = Convert.ToInt32(itemDropDownList.SelectedValue);
                    stockIn.StockQuantity = Convert.ToInt32(stockInQuantityTextBox.Text);


                    int companyid = Convert.ToInt32(companyDropDownList.SelectedValue);
                    int itemid    = Convert.ToInt32(itemDropDownList.SelectedValue);


                    outputLabel.Text              = stockInManager.SaveManager(stockIn);
                    reorderLevelTextBox.Text      = itemSetupManager.GetReorderLevelByDropDown(companyid);
                    availableQuantityTextBox.Text = stockInManager.GetQuantityByDropDown(companyid, itemid);

                    //companyDropDownList.DataSource = companySetupManager.GetAllCompanySetup();
                    //companyDropDownList.DataTextField = "CompanyName";
                    //companyDropDownList.DataValueField = "Id";
                    //companyDropDownList.DataBind();
                    //string code = "--Select--";
                    //companyDropDownList.Items.Insert(0, new ListItem(code, ""));

                    //itemDropDownList.Items.Clear();
                    //itemDropDownList.Items.Insert(0, new ListItem("--Select--", ""));
                    //reorderLevelTextBox.Text = "";
                    //availableQuantityTextBox.Text = "";
                }
            }
            else
            {
                outputLabel.Text = "Please select your desired things from dropdown list !";
            }


            stockInQuantityTextBox.Text = "";
        }