public tbl_MauThongBao GetOneData(int id) { try { tbl_MauThongBao data = db.tbl_MauThongBao.Find(id); return(data); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(null); } }
private void SaveData() { if (txtHinhThucTuyen.Text == "" || txtMucLuong.Text == "" || txtNoiLamViec.Text == "" || txtSL.Text == "" || txtThoiGianLamViec.Text == "" || txtTinhTrangHonNhan.Text == "" || txtTuoiDen.Text == "" || txtTuoiTu.Text == "" || txtViTri.Text == "") { XtraMessageBox.Show("Không được bỏ trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (_id == -1) { int sl = Convert.ToInt32(txtSL.Text); int to = Convert.ToInt32(txtTuoiTu.Text); int from = Convert.ToInt32(txtTuoiDen.Text); mau = new tbl_MauThongBao(); mau.NoiLamViec = txtNoiLamViec.Text; mau.YeuCauKyThuat = txtYeuCauKiThuat.Text; mau.SL = sl; mau.NoiLamViec = txtViTri.Text; mau.YeuCauKhac = txtYeuCauKhac.Text; mau.YeuCauNgoaiNgu = txtYeuCauNgoaiNgu.Text; mau.TuoiTu = to; mau.TuoiDen = from; mau.MucLuong = txtMucLuong.Text; mau.ThoiGianLamViec = txtThoiGianLamViec.Text; mau.TinhTrangHonNhan = txtTinhTrangHonNhan.Text; mau.HinhThucTuyen = txtHinhThucTuyen.Text; mau.NgayTaoMau = DateTime.Now; tbl_MauThongBao tb = MauThongBaoBUS.Instance.AddData(mau); _id = tb.ThongBaoID; } else { int sl = Convert.ToInt32(txtSL.Text); int to = Convert.ToInt32(txtTuoiTu.Text); int from = Convert.ToInt32(txtTuoiDen.Text); mau = new tbl_MauThongBao(); mau.ChucVu = txtViTri.Text; mau.YeuCauKyThuat = txtYeuCauKiThuat.Text; mau.SL = sl; mau.NoiLamViec = txtNoiLamViec.Text; mau.YeuCauKhac = txtYeuCauKhac.Text; mau.YeuCauNgoaiNgu = txtYeuCauNgoaiNgu.Text; mau.TuoiTu = to; mau.TuoiDen = from; mau.MucLuong = txtMucLuong.Text; mau.ThoiGianLamViec = txtThoiGianLamViec.Text; mau.TinhTrangHonNhan = txtTinhTrangHonNhan.Text; mau.HinhThucTuyen = txtHinhThucTuyen.Text; mau.NgayTaoMau = DateTime.Now; MauThongBaoBUS.Instance.UpdateData(mau); } }
public tbl_MauThongBao AddData(tbl_MauThongBao data) { try { tbl_MauThongBao d = db.tbl_MauThongBao.Add(data); db.SaveChanges(); return(d); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(null); } }
public int DeleteData(int id) { try { tbl_MauThongBao tb = db.tbl_MauThongBao.Find(id); db.tbl_MauThongBao.Remove(tb); db.SaveChanges(); return(1); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(-1); } }
public int UpdateData(tbl_MauThongBao data) { try { var update = db.tbl_MauThongBao.Find(data.ThongBaoID); update.copy(data); db.SaveChanges(); return(1); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(0); } }
private void LoadData(int id) { _id = id; this.mau = MauThongBaoBUS.Instance.GetOneData(id); txtMaThongBao.Text = this.mau.ThongBaoID.ToString(); txtNoiLamViec.Text = this.mau.NoiLamViec; txtYeuCauKiThuat.Text = this.mau.YeuCauKyThuat; txtSL.Text = this.mau.SL.ToString(); txtViTri.Text = this.mau.ChucVu; txtYeuCauKhac.Text = this.mau.YeuCauKhac; txtYeuCauNgoaiNgu.Text = this.mau.YeuCauNgoaiNgu; txtTuoiTu.Text = this.mau.TuoiTu.ToString(); txtTuoiDen.Text = this.mau.TuoiDen.ToString(); txtMucLuong.Text = this.mau.MucLuong; txtThoiGianLamViec.Text = this.mau.ThoiGianLamViec; txtTinhTrangHonNhan.Text = this.mau.TinhTrangHonNhan; txtHinhThucTuyen.Text = this.mau.HinhThucTuyen; txtNgayTaoMau.Text = this.mau.NgayTaoMau.ToString("dd/MM/yyyy"); }
public int UpdateData(tbl_MauThongBao data) { return(MauThongBaoDAO.Instance.UpdateData(data)); }
public tbl_MauThongBao AddData(tbl_MauThongBao data) { return(MauThongBaoDAO.Instance.AddData(data)); }