Exemplo n.º 1
0
 private void bbiSaveAndNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     SaveData();
     ResetData();
     id    = -1;
     _thtv = new tbl_TinhHinhThuViec();
 }
Exemplo n.º 2
0
 private void SaveData()
 {
     if (txtThaiDo.Text == "" || txtKinhNghiem.Text == "" || txtKhaNang.Text == "" || txtKinhNghiem.Text == "")
     {
         XtraMessageBox.Show("Không được bỏ trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     _thtv.HieuQuaLamViec    = txtThaiDo.Text;
     _thtv.KhaNangLamViec    = txtKhaNang.Text;
     _thtv.KinhNghiemLamViec = txtKinhNghiem.Text;
     _thtv.ThaiDoLamViec     = txtThaiDo.Text;
     _thtv.ThuViecID         = _tv.ThuViecID;
     _thtv.NgayCapNhap       = DateTime.Now;
     if (id == -1)
     {
         _thtv = TinhHinhThuViecBUS.Instance.AddData(_thtv);
         id    = _thtv.TinhHinhThuViecID;
         XtraMessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         TinhHinhThuViecBUS.Instance.UpdateData(_thtv);
         XtraMessageBox.Show("Sửa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 3
0
 private void LoadData()
 {
     if (id != -1)
     {
         _thtv              = TinhHinhThuViecBUS.Instance.GetOneData(id);
         txtHieuQua.Text    = _thtv.HieuQuaLamViec;
         txtKhaNang.Text    = _thtv.KhaNangLamViec;
         txtKinhNghiem.Text = _thtv.KinhNghiemLamViec;
         txtThaiDo.Text     = _thtv.ThaiDoLamViec;
     }
 }
Exemplo n.º 4
0
 public tbl_TinhHinhThuViec GetOneData(int id)
 {
     try
     {
         tbl_TinhHinhThuViec data = db.tbl_TinhHinhThuViec.Find(id);
         return(data);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         return(null);
     }
 }
Exemplo n.º 5
0
 public tbl_TinhHinhThuViec AddData(tbl_TinhHinhThuViec data)
 {
     try
     {
         tbl_TinhHinhThuViec d = db.tbl_TinhHinhThuViec.Add(data);
         db.SaveChanges();
         return(d);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         return(null);
     }
 }
Exemplo n.º 6
0
 public int UpdateData(tbl_TinhHinhThuViec data)
 {
     try
     {
         var update = db.tbl_TinhHinhThuViec.Find(data.TinhHinhThuViecID);
         update.copy(data);
         db.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         return(0);
     }
 }
Exemplo n.º 7
0
 public int DeleteData(int id)
 {
     try
     {
         tbl_TinhHinhThuViec tb = db.tbl_TinhHinhThuViec.Find(id);
         db.tbl_TinhHinhThuViec.Remove(tb);
         db.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
         return(-1);
     }
 }
Exemplo n.º 8
0
 private void bbiDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (id == -1)
     {
         XtraMessageBox.Show("Không có gì để xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     if (XtraMessageBox.Show("Bạn có chắc chắn xóa không", "Cảnh báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         int kq = TinhHinhThuViecBUS.Instance.DeleteData(id);
         if (kq == -1)
         {
             XtraMessageBox.Show("Xóa thất bại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         _thtv = new tbl_TinhHinhThuViec();
         id    = -1;
         ResetData();
     }
 }
Exemplo n.º 9
0
 public int UpdateData(tbl_TinhHinhThuViec data)
 {
     return(TinhHinhThuViecDAO.Instance.UpdateData(data));
 }
Exemplo n.º 10
0
 public tbl_TinhHinhThuViec AddData(tbl_TinhHinhThuViec data)
 {
     return(TinhHinhThuViecDAO.Instance.AddData(data));
 }