示例#1
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 = "";
        }