Exemplo n.º 1
0
 private void btnTimKiem_Click(object sender, EventArgs e)
 {
     if (txtTimKiem.Text.Trim() != "")
     {
         if (rbMaHoaDon.Checked)
         {
             int maHoaDon = 0;
             if (int.TryParse(txtTimKiem.Text, out maHoaDon))
             {
                 DataTable dt = hoadonController.SearchMaHoaDon(int.Parse(txtTimKiem.Text));
                 if (dt.Rows.Count > 0)
                 {
                     dgvDanhSachHoaDon.DataSource = dt;
                 }
                 else
                 {
                     clearHoaDonData();
                 }
             }
             else
             {
                 clearHoaDonData();
             }
         }
         else
         {
             DataTable dt = hoadonController.SearchTenKhachHang(txtTimKiem.Text);
             if (dt.Rows.Count > 0)
             {
                 dgvDanhSachHoaDon.DataSource = dt;
             }
             else
             {
                 clearHoaDonData();
             }
         }
     }
     else
     {
         load();
     }
 }
Exemplo n.º 2
0
 private void btnTimKiem_Click(object sender, EventArgs e)
 {
     if (txtTimKiem.Text.Trim() != "")
     {
         if (cbbTimKiem.SelectedIndex == 0)
         {
             int number = 0;
             if (int.TryParse(txtTimKiem.Text, out number))
             {
                 dgvDanhSachHoaDon.DataSource = hoadonController.SearchMaHoaDon(number);
             }
         }
         else
         {
             dgvDanhSachHoaDon.DataSource = hoadonController.SearchTenKhachHang(txtTimKiem.Text);
         }
     }
     else
     {
         dgvDanhSachHoaDon.DataSource = hoadonController.GetAllHoaDon();
     }
 }
Exemplo n.º 3
0
        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            if (txtTimKiem.Text.Trim() != "")
            {
                int value = 0;
                bool isNumber = int.TryParse(txtTimKiem.Text, out value);
                if (cbbTimKiem.SelectedIndex == 0)
                {
                    dgvDanhSachHoaDon.DataSource = hoadonController.SearchMaHoaDon(value);
                }
                else if (cbbTimKiem.SelectedIndex == 1)
                {
                    int day, month, year;
                    string[] array = txtTimKiem.Text.Split('/');
                    if (array.Length == 3)
                    {
                        if (int.TryParse(array[0], out day) && int.TryParse(array[1], out month) && int.TryParse(array[2], out year))
                        {
                            DateTime date = new DateTime(year, month, day);
                            dgvDanhSachHoaDon.DataSource = hoadonController.SearchNgayLap(date);
                        }
                    }
                }
                else if (cbbTimKiem.SelectedIndex == 2)
                {

                }
                else if (cbbTimKiem.SelectedIndex == 3)
                {
                    dgvDanhSachHoaDon.DataSource = hoadonController.SearchTenKhachHang(txtTimKiem.Text);
                }
            }
            else
            {
                load();
            }
        }