コード例 #1
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);
            }
        }
コード例 #2
0
        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);
            }
        }