Beispiel #1
0
        public BookingViewModel(IUnitOfWork unit, IEventAggregator eventAggregator,
                                IBookingCalculate calculationService,
                                ISearchGuestService searchGuestService,
                                IBookingFacade bookingFacade,
                                IRegionManager regionManager)
        {
            _unit = unit;
            _calculationService = calculationService;
            _searchGuestService = searchGuestService;
            _bookingFacade      = bookingFacade;
            _eventAggregator    = eventAggregator;

            _regionManager = regionManager;

            GuestResults = new ObservableCollection <Guest>();
            SearchRooms  = new SearchWrapper();
            Guest        = new GuestWrapper();

            SearchCommand = new DelegateCommand(SearchExecute, CanSearchExecute).ObservesCanExecute(() => SearchRooms.IsEnabled);
            BookCommand   = new DelegateCommand <object>(BookExecute, CanBookExecute).ObservesCanExecute(() => IsGuestFormValid);

            _eventAggregator.GetEvent <LoadEvent>().Subscribe(OnLoadEvent);

            Calculation.GetInstance().StayTypeChanged             += BookingViewModel_StayTypeChanged;
            SelectedRoomChange.GetInstance().RoomSelectionChanged += BookingViewModel_RoomSelectionChanged;
            SelectedGuestEvent.GetInstance().SelectedGuestChanged += OnSelectedGuestChange;

            SearchRooms.StateChanged += SearchRooms_StateChanged;
            Guest.StateChanged       += Guest_StateChanged;
        }
 private void CreateNewReservationDialogViewModel_SelectedGuestHasChanged(object sender, EventArgs.SelectedGuestEventArgs e)
 {
     if (e.Guest != null)
     {
         Guest = new GuestWrapper()
         {
             FirstName = e.Guest.FirstName,
             LastName  = e.Guest.LastName,
             Phone     = e.Guest.Phone,
             Email     = e.Guest.Email,
             Address   = e.Guest.Address
         };
     }
 }
        public CreateNewReservationDialogViewModel(IRoomService roomService, IStayTypeService stayTypeService, ISearchGuestService searchGuestService)
        {
            _roomService        = roomService;
            _stayTypeService    = stayTypeService;
            _searchGuestService = searchGuestService;

            Guest = new GuestWrapper();

            NextCommand              = new DelegateCommand(NextCommandExecute);
            CloseCommand             = new DelegateCommand(OnCloseCommand);
            CreateReservationCommand = new DelegateCommand(CreateReservation, CanCreateReservation);
            SelectedGuestChange.GetIstance().SelectedGuestHasChanged += CreateNewReservationDialogViewModel_SelectedGuestHasChanged;
            Guest.StateChanged += Guest_StateChanged;
        }
Beispiel #4
0
 private void OnSelectedGuestChange(object sender, SelectedGuestEventArgs e)
 {
     //TODO: Refactor
     if (e.Guest != null)
     {
         Guest = new GuestWrapper
         {
             FirstName = e.Guest.FirstName,
             LastName  = e.Guest.LastName,
             Address   = e.Guest.Address,
             Email     = e.Guest.Email,
             Phone     = e.Guest.Phone,
             Jmbg      = e.Guest.Jmbg
         };
     }
 }