/// <summary> /// lấy thông tin phiếu mượn bằng mã phiếu mượn /// </summary> /// <param name="maPhieu"></param> /// <returns></returns> public CT_PhieuMuon getCTPhieu(int maPhieu) { CT_PhieuMuon ctPhieu = new CT_PhieuMuon(); CT_PhieuMuonDAL ctPhieuDAL = new CT_PhieuMuonDAL(); ctPhieu = ctPhieuDAL.getCT_PhieuMuonById(maPhieu); return ctPhieu; }
/// <summary> /// ham cho muon sach. neu cho muon thanh cong tra ve true. nguoc lai la false /// </summary> /// <param name="maSach">Mã Sách</param> /// <param name="maDocGia">Mã Độc Giả</param> /// <returns></returns> public bool choMuon(int maSach,int maDocGia,int maNV) { ctPhieuDAL = new CT_PhieuMuonDAL(); phieuMuonDAL = new PhieuMuonDAL(); //đổ dữ liệu vào mã phiếu mượn phieuMuon = new PhieuMuon(); phieuMuon.docGia.MaDG = maDocGia; phieuMuon.NgayMuon = DateTime.Now; phieuMuon.nhanVien.MaNV = maNV; if (!phieuMuonDAL.insertPhieuMuon(phieuMuon)) return false; ctPhieu = new CT_PhieuMuon(); ctPhieu.phieuMuon = phieuMuonDAL.getPhieuMuonVuaNhap(); ctPhieu.sach.MaSach = maSach; ctPhieu.HanTra = DateTime.Now.AddDays(30); if (!ctPhieuDAL.insertCT_PhieuMuon(ctPhieu)) return false; return true; }