private async void btnTimKiem_Click(object sender, EventArgs e)
        {
            switch (cbbTen.SelectedIndex)
            {
            // Ten
            case 0:
                CuTruBindingSource.Bind(await service.GetByNameAsync(txtTimKiem.Text), dgvCuTru);
                break;

            // Noi sinh
            case 1:
                CuTruBindingSource.Bind(await service.GetByBirthPlaceAsync(txtTimKiem.Text), dgvCuTru);
                break;

            // Que quan
            case 2:
                CuTruBindingSource.Bind(await service.GetByHometownAsync(txtTimKiem.Text), dgvCuTru);
                break;

            // Quoc tich
            case 3:
                CuTruBindingSource.Bind(await service.GetByNationAsync(txtTimKiem.Text), dgvCuTru);
                break;

            // Dia chi cu tru
            case 4:
                CuTruBindingSource.Bind(await service.GetByAddressAsync(txtTimKiem.Text), dgvCuTru);
                break;

            // Dia chi cong dan
            case 5:
                CuTruBindingSource.Bind(await service.GetByPersonalAddressAsync(txtTimKiem.Text), dgvCuTru);
                break;
            }
        }
Beispiel #2
0
        private async void btnDuyet_Click(object sender, EventArgs e)
        {
            var dialogResult = MessageBox.Show("Bạn có muốn duyệt cư trú này?", "Hahaha",
                                               MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialogResult == DialogResult.Yes)
            {
                var selectedRow   = dgvDanhSachChoDuyet.SelectedRows[0];
                var selectedCuTru = (CuTruDTO)selectedRow.DataBoundItem;

                var result = await repo.DuyetCuTru(SelectedCuTru.Id);

                if (result == true)
                {
                    MessageBox.Show("Đã duyệt thành công!", "OK", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Đã có lỗi xảy ra!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                // Tải lại danh sách
                CuTruBindingSource.Bind(await repo.GetByStateAsync(false), dgvDanhSachChoDuyet);
            }
        }
Beispiel #3
0
 private async void FormChoDuyet_Load(object sender, EventArgs e)
 {
     CuTruBindingSource.Bind(await repo.GetByStateAsync(false), dgvDanhSachChoDuyet);
 }
 private async void FormDanhSachCuTru_Load(object sender, EventArgs e)
 {
     ptbLoading.Show();
     CuTruBindingSource.Bind(await service.GetExpiredAsync(), dgvCuTru);
     ptbLoading.Hide();
 }
Beispiel #5
0
 public async void LoadDanhSach()
 {
     ptbLoading.Show();
     CuTruBindingSource.Bind(await service.GetAllAsync(), dgvCuTru);
     ptbLoading.Hide();
 }