Example #1
0
 public RentalActiveRecord(LibrarianActiveRecord _librarian, CustomerActiveRecord _customer, DateTime _rentalDate, DateTime?_returnDate, bool _vraceno)
 {
     ID         = null;
     Librarian  = _librarian;
     Customer   = _customer;
     RentalDate = _rentalDate;
     ReturnDate = _returnDate;
     Vraceno    = _vraceno;
     Extended   = false;
 }
Example #2
0
        public static LibrarianActiveRecord MapResultsetToObject(DataRow dr)
        {
            LibrarianActiveRecord NewLibrarian = new LibrarianActiveRecord();

            NewLibrarian.ID      = Convert.ToInt32(dr.ItemArray[0].ToString());
            NewLibrarian.Name    = dr.ItemArray[1].ToString();
            NewLibrarian.Surname = dr.ItemArray[2].ToString();
            NewLibrarian.Email   = dr.ItemArray[3].ToString();

            return(NewLibrarian);
        }
Example #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);
        }