예제 #1
0
        protected void lostButton_Click(object sender, EventArgs e)
        {
            StockOutSell stockOutSell = new StockOutSell();

            if (ViewState["stockOutVS"] == null && ViewState["stockInVS"] == null)
            {
                outputLabelForSubtract.Text = "Please add in the grid first !";
            }
            else
            {
                List <StockOut> stockOutSellList = (List <StockOut>)ViewState["stockOutVS"];
                List <StockIn>  stockInSellList  = (List <StockIn>)ViewState["stockInVS"];
                foreach (var stockInlistVar in stockInSellList)
                {
                    outputLabelForSubtract.Text = stockInManager.DeleteManager(stockInlistVar);
                }


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

                reorderLevelTextBox.Text      = itemSetupManager.GetReorderLevelByDropDown(companyid);
                availableQuantityTextBox.Text = stockInManager.GetQuantityByDropDown(companyid, itemid);
                ViewState["stockOutVS"]       = null;
                ViewState["stockInVS"]        = null;
                stockOutGridView.DataSource   = null;
                stockOutGridView.DataBind();
            }


            stockOutQuantityTextBox.Text = "";
            //availableQuantityTextBox.Text = "";
            //reorderLevelTextBox.Text = "";
        }
        public int SaveSellGateway(StockOutSell stockOutSell)
        {
            //INSERT INTO StockOutSell VALUES(2,2,'2018-05-04 21:46:12')
            string query = "INSERT INTO StockOutSell VALUES(" + stockOutSell.ItemId + "," + stockOutSell.Sell + ",'" + stockOutSell.Date + "')";

            Command = new SqlCommand(query, Connection);
            Connection.Open();
            int rowAffect = Command.ExecuteNonQuery();

            Connection.Close();
            return(rowAffect);
        }
        public string SaveSellManager(StockOutSell stockOutSell)
        {
            int row = stockOutSellGateway.SaveSellGateway(stockOutSell);

            if (row > 0)
            {
                return("Save Sell item Successful !");
            }
            else
            {
                return("Saving Sell item Failed !");
            }
        }
예제 #4
0
        protected void sellButton_Click(object sender, EventArgs e)
        {
            StockOutSell stockOutSell = new StockOutSell();

            if (ViewState["stockOutVS"] == null && ViewState["stockInVS"] == null)
            {
                outputLabelForSubtract.Text = "Please add in the grid first !";
            }
            else
            {
                List <StockOut> stockOutSellList = (List <StockOut>)ViewState["stockOutVS"];
                List <StockIn>  stockInSellList  = (List <StockIn>)ViewState["stockInVS"];
                foreach (var stockInlistVar in stockInSellList)
                {
                    stockOutSell.ItemId = stockInlistVar.ItemId;
                    stockOutSell.Sell   = stockInlistVar.StockQuantity;           // sell koto hocche ta rakhlam
                    DateTime time     = DateTime.Now;                             // Use current time
                    string   dateTime = time.ToString("yyyy-MM-dd HH':'mm':'ss"); // modify the format depending upon input required in the column in database

                    stockOutSell.Date = dateTime;
                    stockOutSellManager.SaveSellManager(stockOutSell);


                    outputLabelForSubtract.Text = stockInManager.DeleteManager(stockInlistVar);
                }
                int companyid = Convert.ToInt32(companyDropDownList.SelectedValue);
                int itemid    = Convert.ToInt32(itemDropDownList.SelectedValue);

                reorderLevelTextBox.Text      = itemSetupManager.GetReorderLevelByDropDown(companyid);
                availableQuantityTextBox.Text = stockInManager.GetQuantityByDropDown(companyid, itemid);
                ViewState["stockOutVS"]       = null;
                ViewState["stockInVS"]        = null;
                stockOutGridView.DataSource   = null;
                stockOutGridView.DataBind();
            }


            stockOutQuantityTextBox.Text = "";
        }