private void SearchButton_Click(object sender, EventArgs e)
        {
            stock.FromStockDate = fromDateTimePicker.Value.ToShortDateString();
            stock.ToStockDate   = toDateTimePicker.Value.ToShortDateString();
            bool flag = _stockReportManager.SearchExists(stock);

            if (flag)
            {
                stockReportDataGridView.DataSource = _stockReportManager.Search(stock);
            }
            else
            {
                MessageBox.Show("Data Not Found!", "Result");
                stockReportDataGridView.DataSource = _stockReportManager.Search(stock);
            }
        }
        private void searchButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (reorderCheckBox.Checked == false)
                {
                    Purchase purchase = new Purchase();
                    purchase.Date1 = startDateTimePicker.Value;
                    purchase.Date2 = endDateTimePicker.Value;
                    Product product = new Product();
                    if (String.IsNullOrEmpty(categoryTextBox.Text) && String.IsNullOrEmpty(productTextBox.Text))
                    {
                        MessageBox.Show("Please Enter at least one field to search");
                        return;
                    }

                    product.Name = productTextBox.Text;
                    Category category = new Category();
                    category.Name = categoryTextBox.Text;

                    showDataGridView.DataSource = _stockReportManager.Search(purchase, product, category);
                }
                else
                {
                    showDataGridView.DataSource = _stockReportManager.SearchByReorderLevel();
                }
            }catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
예제 #3
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            Purchase purchase = new Purchase();

            purchase.Date1 = startDateTimePicker.Value;
            purchase.Date2 = endDateTimePicker.Value;
            Product product = new Product();

            product.Name = productTextBox.Text;
            Category category = new Category();

            category.Name = categoryTextBox.Text;

            showDataGridView.DataSource = _stockReportManager.Search(purchase, product, category);
        }
예제 #4
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            stock.FromStockDate = Convert.ToDateTime(fromDateTimePicker.Text);
            stock.ToStockDate   = Convert.ToDateTime(toDateTimePicker.Text);


            //stock.FromStockDate = fromDateTimePicker.Value.ToShortDateString();
            //stock.ToStockDate = toDateTimePicker.Value.ToShortDateString();
            if (stock.FromStockDate <= stock.ToStockDate)
            {
                bool flag = _stockReportManager.SearchExists(stock);
                if (flag)
                {
                    stockReportDataGridView.DataSource = _stockReportManager.Search(stock);
                }
                else
                {
                    MessageBox.Show("Data Not Found!", "Result");
                    stockReportDataGridView.DataSource = _stockReportManager.Search(stock);
                }
            }
            //bool flag = _stockReportManager.SearchExists(stock);
            //if (flag)
            //{

            //        stockReportDataGridView.DataSource = _stockReportManager.Search(stock);

            //}
            //else
            //{
            //    MessageBox.Show("Data Not Found!","Result");
            //    stockReportDataGridView.DataSource = _stockReportManager.Search(stock);
            //}

            else
            {
                MessageBox.Show("End date should be greater than Start date");
                stockReportDataGridView.DataSource = _stockReportManager.Search(stock);
            }
        }