예제 #1
0
        protected void searchButton_Click(object sender, EventArgs e)
        {
            ViewSalesBetweenTwoDates viewSalesBetweenTwoDates = new ViewSalesBetweenTwoDates();

            viewSalesBetweenTwoDates.FromDate = DateTime.Parse(fromDateTextBox.Text);
            viewSalesBetweenTwoDates.ToDate   = DateTime.Parse(toDateTextBox.Text);
            if (viewSalesBetweenTwoDates.FromDate > viewSalesBetweenTwoDates.ToDate)
            {
                messageLabel.Text = "From date should not be greater";
            }
            else
            {
                List <StockOut> stockOuts = viewSalesBetweenTwoDatesManager.Search(viewSalesBetweenTwoDates);
                viewSalesBetweenTwoDatesGridView.DataSource = stockOuts;
                viewSalesBetweenTwoDatesGridView.DataBind();
            }
        }
        public List <StockOut> Search(ViewSalesBetweenTwoDates viewSalesBetweenTwoDates)
        {
            Query   = "SELECT ItemName,StockOutQuantity FROM StockOut WHERE Date BETWEEN '" + viewSalesBetweenTwoDates.FromDate + "' AND '" + viewSalesBetweenTwoDates.ToDate + "' AND ActionType='Sell'";
            Command = new SqlCommand(Query, Connection);
            Connection.Open();
            Reader = Command.ExecuteReader();
            List <StockOut> stockOuts = new List <StockOut>();

            while (Reader.Read())
            {
                StockOut stockOut = new StockOut();
                stockOut.Item             = Reader["ItemName"].ToString();
                stockOut.StockOutQuantity = (int)Reader["StockOutQuantity"];
                stockOuts.Add(stockOut);
            }
            Reader.Close();
            Connection.Close();
            return(stockOuts);
        }
예제 #3
0
 public List <StockOut> Search(ViewSalesBetweenTwoDates viewSalesBetweenTwoDates)
 {
     return(viewSalesBetweenTwoDatesGateway.Search(viewSalesBetweenTwoDates));
 }