Пример #1
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();
            }
        }