Example #1
0
        private void dgv_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int r = e.RowIndex;

            switch (this.searchType)
            {
            case SearchType.NhanVien:
                FrmNhanVien nhanVien = new FrmNhanVien(dgv.Rows[r].Cells[0].Value.ToString());
                nhanVien.ShowDialog();
                break;

            case SearchType.SinhVien:
                FrmSinhVien sinhVien = new FrmSinhVien(dgv.Rows[r].Cells[0].Value.ToString());
                sinhVien.ShowDialog();
                break;

            case SearchType.PhieuDK:
                FrmDangKyPhong frmDangKy = new FrmDangKyPhong(dgv.Rows[r].Cells[0].Value.ToString());
                frmDangKy.ShowDialog();
                break;

            case SearchType.Phong:
                string   khu     = dgv.Rows[r].Cells["Khu"].Value.ToString();
                string   maPhong = dgv.Rows[r].Cells["MaPhong"].Value.ToString();
                FrmPhong phong   = new FrmPhong(khu, maPhong);
                phong.ShowDialog();
                break;

            case SearchType.HoaDon:
                FrmHoaDon hoaDon = new FrmHoaDon(MaHD: dgv.Rows[r].Cells[0].Value.ToString());
                hoaDon.ShowDialog();
                break;
            }

            //cập nhật lại những thay đổi, nếu có
            btnSearch_Click(btnSearch, new EventArgs());
        }
        private void Phong()
        {
            FrmDangKyPhong frmDangKyPhong = new FrmDangKyPhong();

            frmDangKyPhong.ShowDialog();
        }