Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public static RentalActiveRecord MapResultsetToObject(DataRow dr)
        {
            RentalActiveRecord NewRental = new RentalActiveRecord();
            var librarianTemp            = new LibrarianTDG();
            var customerTemp             = new CustomerTDG();

            NewRental.ID         = Convert.ToInt32(dr.ItemArray[0].ToString());
            NewRental.Librarian  = LibrarianActiveRecord.MapResultsetToObject(librarianTemp.GetLibrarianByID(Convert.ToInt32(dr.ItemArray[1].ToString())).Rows[0]);
            NewRental.Customer   = CustomerActiveRecord.MapResultsetToObject(customerTemp.GetCustomerByID(Convert.ToInt32(dr.ItemArray[2].ToString())).Rows[0]);
            NewRental.RentalDate = Convert.ToDateTime(dr.ItemArray[3].ToString());
            if (dr.ItemArray[4] == DBNull.Value)
            {
                NewRental.ReturnDate = null;
            }
            else
            {
                NewRental.ReturnDate = Convert.ToDateTime(dr.ItemArray[4].ToString());
            }
            NewRental.Vraceno  = Convert.ToBoolean(dr.ItemArray[5].ToString());
            NewRental.Extended = Convert.ToBoolean(dr.ItemArray[6].ToString());

            return(NewRental);
        }
Exemple #4
0
 public BookInRentalActiveRecord()
 {
     ID     = null;
     Book   = null;
     Rental = null;
 }
Exemple #5
0
 public BookInRentalActiveRecord(BookActiveRecord _book, RentalActiveRecord _rental)
 {
     ID     = null;
     Book   = _book;
     Rental = _rental;
 }
Exemple #6
0
 public BookInRentalActiveRecord(int _id, BookActiveRecord _book, RentalActiveRecord _rental)
 {
     ID     = _id;
     Book   = _book;
     Rental = _rental;
 }