public bool themPhieuTraSach(ref DTO_TRASACH dtots, List <int> lsmasach, int ctrltinhieu) { BLL_Sach bllsach = new BLL_Sach(); BLL_PhieuMuonSach bllphieums = new BLL_PhieuMuonSach(); int idtrasach = 0, numsachhong = dtots.TIENBOITHUONG; khoiTao_DoiTuongTraSach(ref dtots); foreach (int idsach in lsmasach) { int ishong = (numsachhong-- > 0 ? 1 : 0); tra_TungSach(ref dtots, idsach, ishong); } if (ctrltinhieu == 1) { return(true); } idtrasach = dalphieuts.themPhieuTraSach(dtots); if (idtrasach > -1) { foreach (int idsach in lsmasach) { themCTP_TraSach(idtrasach, idsach); bllsach.suaTinhTrangSach(idsach, "Con Hang"); bllphieums.suaCTP_MuonSach(dtots.ID_USER, idsach); } bllphieums.tongKet_MuonSach(dtots.ID_USER); return(true); } return(false); }
public bool themPhieuMuonSach(DTO_MUONSACH dtoms, List <int> lsmasach) { BLL_Sach bllsach = new BLL_Sach(); BLL_QuyDinh bllquydinh = new BLL_QuyDinh(); int idmuonsach = 0, maxsongaymuon = 0, totalphims = 0, feemuonsach = 0; maxsongaymuon = bllquydinh.layQuyDinh("So Ngay Muon Toi Da"); // 3 feemuonsach = bllquydinh.layQuyDinh("Tien Muon Sach"); // 2 foreach (int idsach in lsmasach) { totalphims += feemuonsach; } dtoms.NGAYMUON = DateTime.Today.Date.ToString("yyyy-MM-dd"); dtoms.NGAYTRA = DateTime.Today.AddDays(maxsongaymuon).Date.ToString("yyyy-MM-dd"); dtoms.TONGTIEN = totalphims; dtoms.TRANGTHAI = 0; dtoms.CREATED_AT = DateTime.Now; idmuonsach = dalphieums.themPhieuMuonSach(dtoms); if (idmuonsach > -1) { foreach (int idsach in lsmasach) { themCTP_MuonSach(idmuonsach, idsach); bllsach.suaTinhTrangSach(idsach, "Het Hang"); } return(true); } return(false); }