Ejemplo n.º 1
0
        public StockOutChartVM GetChartThingsByItemId(int itemId)
        {
            StockOutChartVM newChart = new StockOutChartVM();

            newChart = aStockGateway.GetChartThingsByItemId(itemId);
            return(newChart);
        }
Ejemplo n.º 2
0
        public StockOutChartVM GetChartThingsByItemId(int itemId)
        {
            Connection.Open();

            StockOutChartVM stockOutChartVM = new StockOutChartVM();

            Query   = "select * from StockChart where ID=" + itemId + "";
            Command = new SqlCommand(Query, Connection);
            Reader  = Command.ExecuteReader();
            while (Reader.Read())
            {
                stockOutChartVM.ItemId      = (int)Reader["ID"];
                stockOutChartVM.ItemName    = Reader["Item"].ToString();
                stockOutChartVM.CompanyName = Reader["Company"].ToString();
            }
            Reader.Close();
            Connection.Close();
            return(stockOutChartVM);
        }
Ejemplo n.º 3
0
        protected void addButton_Click(object sender, EventArgs e)
        {
            bool chartflag = false;
            int  itemId    = Convert.ToInt32(itemDropDownList.SelectedValue);
            List <StockOutChartVM> aTempStockChartList = new List <StockOutChartVM>();
            StockOutChartVM        aStockChart         = new StockOutChartVM();

            try
            {
                aStockChart.Quantity = Convert.ToInt32(stockTextBox.Text);
            }
            catch
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please Insert a valid Stock Quantity value')", true);
                return;
            }

            aStockChart = aStockManager.GetChartThingsByItemId(itemId);

            aStockChart.Quantity = Convert.ToInt32(stockTextBox.Text);

            if ((List <StockOutChartVM>)ViewState["chart"] == null)
            {
                aTempStockChartList.Add(aStockChart);
                if (!aStockManager.IsItOkAdd(aTempStockChartList, itemId))
                {
                    chartflag = true;
                }
                else
                {
                    aStockChartList.Add(aStockChart);
                    ViewState["chart"] = aStockChartList;
                    ClearAllControls();
                }
            }
            else
            {
                aTempStockChartList = (List <StockOutChartVM>)ViewState["chart"];

                aTempStockChartList.Add(aStockChart);
                if (!aStockManager.IsItOkAdd(aTempStockChartList, itemId))
                {
                    aTempStockChartList.RemoveAt(aTempStockChartList.Count - 1);
                    aStockChartList = aTempStockChartList;
                    chartflag       = true;
                }
                else
                {
                    aStockChartList    = aTempStockChartList;
                    ViewState["chart"] = aStockChartList;
                    ClearAllControls();
                }
            }

            if (chartflag)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Can not be added in chart due to quantity limit')", true);
            }

            stockOutGridView.DataSource = aStockChartList;
            stockOutGridView.DataBind();
        }