Exemple #1
0
 private void button1_Click(object sender, EventArgs e)//button add Staff
 {
     getStaff();
     try
     {
         int data = StaffDAO.Instance.AddStaffToDataBase(staff.HoTen, staff.Ntns, staff.NgayBatDauVaoLam, staff.SoHD, staff.MaBacLuong, staff.MaPhongBan, staff.MaChucVu);
         MessageBox.Show("Thêm thành công");
         fstaff.loadStaff();
     }
     catch (Exception) { MessageBox.Show("Thêm thất bại"); }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         int data = DataProvide.Instance.ExecuteNonQuery(StaffDAO.Instance.deleteStaffDatabaseQuery(_staffCode));
         //return data(int) > 0 is success
         if (data > 0)
         {
             MessageBox.Show("Xóa nhân viên thành công");
             loadStaff();
             _fstaff.loadStaff();
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Xóa nhân viên thất bại ");
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         getInfor();
         //return data ( int ) < 0 is success
         if (StaffDAO.Instance.updateStaff(_staffCode, _staff.MaBacLuong, _staff.MaPhongBan, _staff.MaChucVu) < 0)
         {
             MessageBox.Show("Sửa nhân viên thành công");
             _fStaff.loadStaff();
         }
     }
     catch (Exception ex)
     {
         if (ex is SqlException)
         {
             MessageBox.Show("Nhập thông tin cần sửa");
         }
     }
 }