public static RentalActiveRecord Find(int _id) { RentalActiveRecord rental = new RentalActiveRecord(); var rentalGateWay = new RentalTDG(); DataTable dt = rentalGateWay.GetRentalByID(_id); rental = MapResultsetToObject(dt.Rows[0]); return(rental); }
public static BookInRentalActiveRecord MapResultsetToObject(DataRow dr) { BookInRentalActiveRecord NewBook = new BookInRentalActiveRecord(); var bookTemp = new BookTDG(); var rentalTemp = new RentalTDG(); NewBook.ID = Convert.ToInt32(dr.ItemArray[0].ToString()); NewBook.Book = BookActiveRecord.MapResultsetToObject(bookTemp.GetBookByID(Convert.ToInt32(dr.ItemArray[1].ToString())).Rows[0]); NewBook.Rental = RentalActiveRecord.MapResultsetToObject(rentalTemp.GetRentalByID(Convert.ToInt32(dr.ItemArray[2].ToString())).Rows[0]); return(NewBook); }
public static List <RentalActiveRecord> Find() { List <RentalActiveRecord> rentalsList = new List <RentalActiveRecord>(); var rentalGateWay = new RentalTDG(); DataTable dt = rentalGateWay.Find(); foreach (DataRow dr in dt.Rows) { rentalsList.Add(MapResultsetToObject(dr)); } return(rentalsList); }
public void Save() { var rentalGateWay = new RentalTDG(); if (ID == null) { int tmpId = rentalGateWay.Insert((int)this.Librarian.ID, (int)this.Customer.ID, RentalDate, ReturnDate, Vraceno, Extended); ID = tmpId; } else { rentalGateWay.Update(ID, Librarian.ID, Customer.ID, RentalDate, ReturnDate, Vraceno, Extended); } }