Пример #1
0
        private void bttim_Click(object sender, EventArgs e)
        {
            if (txtmanv.Text == "" && dtp1.Value == dtp1.MinDate && dtp2.Value == dtp2.MinDate)
            {
                dataGridView1.DataSource = DAL_LichSuChuyenBac.listall();
            }

            if (dtp1.Value != dtp1.MinDate || dtp2.Value == dtp2.MinDate)
            {
                string ten   = txtmanv.Text.Trim();
                string ngay1 = dtp1.Value.Month + "/" + dtp1.Value.Day + "/" + dtp1.Value.Year;
                string ngay2 = dtp2.Value.Month + "/" + dtp2.Value.Day + "/" + dtp2.Value.Year;
                if (dtp2.Value == dtp2.MinDate)
                {
                    ngay2 = DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + DateTime.Now.Year;
                }
                DateTime dt = new DateTime(1994, 1, 1);
                if (dtp1.Value > dtp2.Value && dtp2.Value != dt)
                {
                    MessageBox.Show("Từ ngày phải nhỏ hơn đến ngày !!");
                }

                else
                {
                    dataGridView1.DataSource = _bizlichsucb.BIZTimLSChuyenBac(ten, ngay1, ngay2);
                }
                if (dataGridView1.RowCount == 0)
                {
                    MessageBox.Show("Không tìm thấy dữ liệu cần tìm !!");
                }
            }
        }
 public List <LichSuChuyenBac> BIZLayDS()
 {
     return(DAL_LichSuChuyenBac.listall());
 }