Пример #1
0
 public void CreateBooking()
 {
     EquipList.Add(new Equipment(1, 2, DateTime.Now));
     Book.Add(new Logic.Booking(1, EquipList, DateTime.Now, DateTime.Today, "41412622", true));
     Logic.Booking bk = Book.GetById(1);
     Assert.AreEqual(bk._phone, "41412622");
 }
Пример #2
0
 /// <summary>
 /// Create a given booking on registry
 /// </summary>
 /// <param name="newBooking">The new booking to create</param>
 public void AddNewBooking(Booking newBooking)
 {
     try
     {
         repo.Add(newBooking);
         UnitOfWork.Commit();
     }
     catch (Exception ex)
     {
         LogManager.Error(ex.Message);
         throw;
     }
 }
Пример #3
0
        public void GetAll()
        {
            MySqlCommand cmd    = new MySqlCommand("SELECT Id, StartDate, EndDate, Phone, Status FROM Booking");
            DataTable    dtbook = db.GetData(cmd);

            if (dtbook != null)
            {
                foreach (DataRow rw in dtbook.Rows)
                {
                    List <Equipment> eqList = GetAllEquipmentsForBooking(Convert.ToInt32(rw["Id"]));

                    bookingRep.Add(new Booking(
                                       Convert.ToInt32(rw["Id"]),
                                       eqList,
                                       Convert.ToDateTime(rw["StartDate"]),
                                       Convert.ToDateTime(rw["EndDate"]),
                                       rw["Phone"].ToString(),
                                       Convert.ToBoolean(rw["Status"])
                                       ));
                }
            }
        }
Пример #4
0
        // Booking

        public void AddBooking(Booking obj)
        {
            Booking book = bookData.Add(obj);

            BookRep.Add(book);
        }