private void frmChiTietPhieuPhong_Load(object sender, EventArgs e)
 {
     SetGridViewStyle(dgvChiTietDichVu);
     FillDichVuCombobox(DichVu.GetAll());
     FillLoaiPhongCombobox(LoaiPhong.GetAll());
     cmbLoaiPhong.SelectedIndex = 0;
     //FillSoPhongCombobox(Phong.GetAll().);
     FillTenBookingCombobox(Booking.GetAll());
     FillComboboxNhanVien(cmbNhanVien, NhanVien.GetAll());
     cmbSoPhong.SelectedIndex  = 0;
     cmbNhanVien.SelectedIndex = 0;
 }
Exemple #2
0
 private void frmCapNhatLichLamViec_Load(object sender, EventArgs e)
 {
     try
     {
         SetGridViewStyle(dgvCapNhatLichLamViec);
         FillTenNhanVienCombobox(NhanVien.GetAll());
         FillCaCombobox(LichLamViec.GetAll());;
         BindGrid(LichLamViec.GetAll());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void btnTimKiemTTNV_Click(object sender, EventArgs e)
        {
            List <NhanVien> listKQTK        = NhanVien.GetAll();
            var             listTimNhanVien = listKQTK.Where(p => (p is NhanVien) && (p as NhanVien).TenNV.ToLower().Contains(txtTimKiemTTNV.Text.ToLower())).ToList();

            if (listTimNhanVien.Count > 0)
            {
                BindGrid(listTimNhanVien);
            }
            else
            {
                MessageBox.Show("Không tìm thấy nhân viên nào!");
            }
        }
 private void frmCapNhatThongTinNhanVien_Load(object sender, EventArgs e)
 {
     try
     {
         SetGridViewStyle(dgvThongTinNhanVien);
         BindGrid(NhanVien.GetAll());
         string imageFolder      = Path.Combine(System.IO.Path.GetDirectoryName(Application.ExecutablePath), "Images");
         string fileDefaultImage = Path.Combine(imageFolder, "user.png");
         picThongTinNhanVien.Image = Image.FromFile(fileDefaultImage);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void btnLuuTTNV_Click(object sender, EventArgs e)
        {
            NhanVien s = GetNhanVien();

            s.NhanVienID = (int)dgvThongTinNhanVien.CurrentRow.Cells[1].Value;
            NhanVien db = NhanVien.GetNhanVien(s.NhanVienID);

            if (db != null)
            {
                db = s;
                db.InsertUpdate();
                MessageBox.Show("Sửa thành công!");
            }
            BindGrid(NhanVien.GetAll());
        }
 private void btnXoaTTNV_Click(object sender, EventArgs e)
 {
     try
     {
         //không xóa được những thằng đang có liên kết đến bảng khác.
         //ví dụ k thể xóa những nv có id 1->3 vì bên lịch làm việc có 3 id nv từ 1->3
         int rowIndex = (int)dgvThongTinNhanVien.CurrentRow.Cells[1].Value;
         NhanVien.Delete(rowIndex);
         BindGrid(NhanVien.GetAll());
     }
     catch (Exception)
     {
         MessageBox.Show("Xóa không thành công vì liên quan đến các dữ liệu khác!");
     }
 }
 private void btnThemTTNV_Click(object sender, EventArgs e)
 {
     try
     {
         NhanVien s  = GetNhanVien();
         NhanVien db = NhanVien.GetNhanVien(s.NhanVienID);
         if (db == null)
         {
             s.InsertUpdate();
             MessageBox.Show("Thêm nhân viên thành công!");
         }
         BindGrid(NhanVien.GetAll());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void btnHuyCapNhatLoaiPhong_Click(object sender, EventArgs e)
 {
     BindGrid(NhanVien.GetAll());
 }