Esempio n. 1
0
 public function PageLoad()
 {
     try {
         $reservation = $this->_presenter->BuildReservation();
         $this->_presenter->HandleReservation($reservation);
         if ($this->_reservationSavedSuccessfully) {
             $this->Display('Ajax/reservation/update_successful.tpl');
         } else {
             $this->Display('Ajax/reservation/save_failed.tpl');
         }
     } catch (Exception $ex) {
         Log::Error('ReservationUpdatePage - Critical error saving reservation: %s', $ex);
         $this->Display('Ajax/reservation/reservation_error.tpl');
     }
 }
Esempio n. 2
0
 public function PageLoad()
 {
     try {
         $reservation = $this->_presenter->BuildReservation();
         $this->_presenter->HandleReservation($reservation);
         if ($this->_reservationSavedSuccessfully) {
             $this->Set('Resources', $reservation->AllResources());
             $this->Set('Instances', $reservation->Instances());
             $this->Set('Timezone', ServiceLocator::GetServer()->GetUserSession()->Timezone);
             $this->Display('Ajax/reservation/update_successful.tpl');
         } else {
             $this->Display('Ajax/reservation/save_failed.tpl');
         }
     } catch (Exception $ex) {
         Log::Error('ReservationUpdatePage - Critical error saving reservation: %s', $ex);
         $this->Display('Ajax/reservation/reservation_error.tpl');
     }
 }
 public function testHandlingReservationCreationDelegatesToServicesForValidationAndPersistenceAndNotification()
 {
     $builder = new ExistingReservationSeriesBuilder();
     $series = $builder->Build();
     $series->SetStatusId(ReservationStatus::Pending);
     $instance = new Reservation($series, NullDateRange::Instance());
     $series->WithCurrentInstance($instance);
     $this->handler->expects($this->once())->method('Handle')->with($this->equalTo($series), $this->isInstanceOf('FakeReservationUpdatePage'))->will($this->returnValue(true));
     $this->presenter->HandleReservation($series);
     $this->assertEquals($instance->ReferenceNumber(), $this->page->referenceNumber);
     $this->assertEquals($series->RequiresApproval(), $this->page->requiresApproval);
 }