private void btnThem_Click(object sender, EventArgs e) { TheThuVienDTO theThuVienDTO = new TheThuVienDTO { SoThe = txtMaThe.Text, NgayBatDau = dtmNgayBD.Value, TrangThai = true }; DocGiaDTO docGiaDTO = new DocGiaDTO { MaDocGia = txtMaDocGia.Text, TenDocGia = txtTenDocGia.Text, CMND = txtCMND.Text, DiaChi = txtDiaChi.Text, SoThe = txtMaThe.Text, TrangThai = true }; if (theThuVienBUS.themTheTV(theThuVienDTO) && docGiaBUS.themDocGia(docGiaDTO)) { MessageBox.Show(Constrant.ThemThanhCong, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show(Constrant.ThemThatBai, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSua_Click(object sender, EventArgs e) { DocGiaDTO docGiaDTO = new DocGiaDTO { MaDocGia = txtMaDocGia.Text, TenDocGia = txtTenDocGia.Text, CMND = txtCMND.Text, DiaChi = txtDiaChi.Text }; TheThuVienDTO theThuVienDTO = new TheThuVienDTO { SoThe = txtMaThe.Text, NgayBatDau = dtmNgayBD.Value }; if (docgiaBUS.suaDocGia(docGiaDTO) && theThuVienBUS.suaTheTV(theThuVienDTO)) { MessageBox.Show(Constrant.SuaThanhCong, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information); frmReaders_Load(sender, e); } else { MessageBox.Show(Constrant.SuaThatBai, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool suaTheThuVien(TheThuVienDTO theThuVienDTO) { try { TheThuVien theThuVien = data.TheThuViens.SingleOrDefault(u => u.SoThe == theThuVienDTO.SoThe && u.TrangThai == true); theThuVien.NgayBatDau = theThuVienDTO.NgayBatDau; data.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool themTheTV(TheThuVienDTO theThuVienDTO) { try { TheThuVien theThuVien = new TheThuVien { SoThe = theThuVienDTO.SoThe, NgayBatDau = theThuVienDTO.NgayBatDau, TrangThai = true }; data.TheThuViens.Add(theThuVien); data.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool suaTheTV(TheThuVienDTO theThuVienDTO) { return(theThuVienDAL.suaTheThuVien(theThuVienDTO)); }
public bool themTheTV(TheThuVienDTO theThuVienDTO) { return(theThuVienDAL.themTheTV(theThuVienDTO)); }