private void btnBorrowReturn_Return_Click(object sender, EventArgs e) { TraSach_DTO ts_DTO = new TraSach_DTO { MaTra = txtBorrowReturn_ReturnID.Text, NgayLap = (DateTime)dtpReturnReturn_DateFound.Value, MaMuon = txtBorrowReturn_BorrowID.Text, TrangThai = true }; CTTraSach_DTO ctt_DTO = new CTTraSach_DTO { MaTra = txtBorrowReturn_ReturnID.Text, MaSach = dtgBorrow_Return.Rows[dtgBorrow_Return.SelectedRows[0].Index].Cells[2].Value.ToString(), NgayTra = DateTime.Now, SoLuong = int.Parse(txtBorrowReturn_Quantity.Text), TienThue = 0, TrangThai = true }; if (trasach_BUS.ThemTraSach(ts_DTO)) { if (ctts_BUS.ThemCTTS(ctt_DTO) && sach_BUS.UpLoadSLTra(ctt_DTO.MaSach, ctt_DTO.SoLuong) && ctms_BUS.UpDateTraSach(ts_DTO.MaMuon, ctt_DTO.MaSach)) { frmSuccess frmSuccess = new frmSuccess(5); frmSuccess.ShowDialog(); this.Hide(); frmBorrow_Return_Load(sender, e); } else { frmFailed frmFailed = new frmFailed(5); frmFailed.ShowDialog(); } } else { frmFailed frmFailed = new frmFailed(5); frmFailed.ShowDialog(); } }
public bool ThemCTTS(CTTraSach_DTO ctts_DTO) { try { CTTraSach ctts = new CTTraSach { MaTra = ctts_DTO.MaTra, MaSach = ctts_DTO.MaSach, NgayTra = ctts_DTO.NgayTra, SoLuong = ctts_DTO.SoLuong, TienThue = 0, TrangThai = true }; data.CTTraSaches.Add(ctts); data.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool ThemCTTS(CTTraSach_DTO ctts) { return(ctts_DAO.ThemCTTS(ctts)); }