Exemplo n.º 1
0
        private async Task _editBooking(SumUpViewModel sumUpVM)
        {
            try
            {
                LinkedListNode <INavigableViewModel> prevNode = _navigation.Find(sumUpVM);
                BookingViewModel bookingVM = await BookingViewModel.LoadAsync(_navigation, _booking, prevNode);

                NextCalled?.Invoke(this, sumUpVM);
            } catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Exemplo n.º 2
0
        private async Task _validateBooking(BookingViewModel bookingVM)
        {
            try
            {
                await _roomChoices.AssignRoomsCommand.ExecuteAsync(_booking);

                LinkedListNode <INavigableViewModel> prevNode = _navigation.Find(this);
                SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, _booking, prevNode);
                NextCalled?.Invoke(null, this);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Exemplo n.º 3
0
        private async void _searchClient_clientSelected(object sender, ClientEntity selectedClientEntity)
        {
            try
            {
                (sender as SearchClientsViewModel).ClientSelected -= _searchClient_clientSelected;
                _booking.Client = selectedClientEntity.Client;
                await _roomChoices.AssignRoomsCommand.ExecuteAsync(_booking);

                LinkedListNode <INavigableViewModel> prevNode = _navigation.Find(this);
                SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, _booking, prevNode);
                NextCalled?.Invoke(null, this);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Exemplo n.º 4
0
 private void _sumUp(ClientViewModel clientVM)
 {
     try
     {
         int     bookingCnt = clientVM.ClientEntity.Bookings.Count;
         Booking booking    = clientVM.CurrentBookingVM.Booking;
         if (!(_navigation.Last.Value is SumUpViewModel))
         {
             LinkedListNode <INavigableViewModel> prevNode = _navigation.Find(this);
             SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, clientVM.CurrentBookingVM.Booking, prevNode);
         }
         NextCalled?.Invoke(null, clientVM);
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
     }
 }
Exemplo n.º 5
0
        private async Task _saveBooking(SumUpViewModel sumUpVM)
        {
            try
            {
                bool isNew = _booking.Id == 0;
                Logger.Log($"Enregistrement de la {(isNew ? "nouvelle " : "")}réservation: {(isNew ? "" : _booking.Id.ToString())}");
                bool paymentSet = false;
                if (_hasPayment && !_hadPayment)
                {
                    sumUpVM._booking.Payment.Date = DateTime.Now;
                    paymentSet = true;
                }
                await BookingRepository.Save(sumUpVM._booking);

                Logger.Log("Enregistrement de réservation : réussi");
                _unlockEditIfNeeded();

                if (paymentSet)
                {
                    _saveBookingCommand.ChangeCanExecute();
                }

                DateRange todayRange = new DateRange {
                    Start = DateTime.Now.Date,
                    End   = DateTime.Now.Date.AddDays(1.0d)
                };

                Logger.Log("Enregistrement de réservation : Récupération des chambres disponibles");
                List <Room> availableRoomsToday = await RoomRepository.GetAvailablesBetweenAsync(todayRange);

                if (availableRoomsToday.Count < 5)
                {
                    Logger.Log("Enregistrement de réservation : Alerte -5 chambres disponibles");
                    await Mailer.SendAsync("Il y a moins de 5 chambres disponibles");
                }

                PromptViewModel successPromptVM = new PromptViewModel("Succés", "La commande a réussi", false);
                ViewDriverProvider.ViewDriver.ShowView <PromptViewModel>(successPromptVM);
            } catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Exemplo n.º 6
0
 private void _clientBookings_bookingSelected(object sender, BookingEntity selectedBookingEntity)
 {
     try
     {
         Logger.Log("=Recherche de réservation=");
         Logger.Log("Recherche de réservation: réservation sélectionnée");
         (sender as ClientBookingsViewModel).BookingSelected -= _clientBookings_bookingSelected;
         Logger.Log("Recherche de réservation: démarrage récapitulatif de réservation");
         SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, selectedBookingEntity.Booking);
         sumUpVM.NextCalled     += _nextCalled;
         sumUpVM.PreviousCalled += _prevCalled;
         _currentEntities.Add(sumUpVM);
         _currentEntitiesView.MoveCurrentToPosition(_currentEntities.Count - 1);
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
     }
 }
Exemplo n.º 7
0
        private async Task _saveBooking(SumUpViewModel sumUpVM)
        {
            try
            {
                bool isNew = _booking.Id == 0;
                Logger.Log($"Enregistrement de la {(isNew ? "nouvelle " : "")}réservation: {(isNew ? "" : _booking.Id.ToString())}");
                bool paymentSet = false;
                if (_hasPayment && !_hadPayment)
                {
                    sumUpVM._booking.Payment.Date = DateTime.Now;
                    paymentSet = true;
                }
                await BookingRepository.Save(sumUpVM._booking);
                Logger.Log("Enregistrement de réservation : réussi");
                _unlockEditIfNeeded();

                if (paymentSet)
                {
                    _saveBookingCommand.ChangeCanExecute();
                }

                DateRange todayRange = new DateRange {
                    Start = DateTime.Now.Date,
                    End = DateTime.Now.Date.AddDays(1.0d)
                };

                Logger.Log("Enregistrement de réservation : Récupération des chambres disponibles");
                List<Room> availableRoomsToday = await RoomRepository.GetAvailablesBetweenAsync(todayRange);

                if(availableRoomsToday.Count < 5)
                {
                    Logger.Log("Enregistrement de réservation : Alerte -5 chambres disponibles");
                    await Mailer.SendAsync("Il y a moins de 5 chambres disponibles");
                }

                PromptViewModel successPromptVM = new PromptViewModel("Succés", "La commande a réussi", false);
                ViewDriverProvider.ViewDriver.ShowView<PromptViewModel>(successPromptVM);
            } catch(Exception ex)
            {
                Logger.Log(ex);
            }
        }
Exemplo n.º 8
0
 private async Task _editBooking(SumUpViewModel sumUpVM)
 {
     try
     {
         LinkedListNode<INavigableViewModel> prevNode = _navigation.Find(sumUpVM);
         BookingViewModel bookingVM = await BookingViewModel.LoadAsync(_navigation, _booking, prevNode);
         NextCalled?.Invoke(this, sumUpVM);
     } catch(Exception ex)
     {
         Logger.Log(ex);
     }
 }
Exemplo n.º 9
0
        private void _clientBookings_bookingSelected(object sender, BookingEntity selectedBookingEntity)
        {
            try
            {
                Logger.Log("=Recherche de réservation=");
                Logger.Log("Recherche de réservation: réservation sélectionnée");
                (sender as ClientBookingsViewModel).BookingSelected -= _clientBookings_bookingSelected;
                Logger.Log("Recherche de réservation: démarrage récapitulatif de réservation");
                SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, selectedBookingEntity.Booking);
                sumUpVM.NextCalled += _nextCalled;
                sumUpVM.PreviousCalled += _prevCalled;
                _currentEntities.Add(sumUpVM);
                _currentEntitiesView.MoveCurrentToPosition(_currentEntities.Count - 1);
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
Exemplo n.º 10
0
        private async Task _validateBooking(BookingViewModel bookingVM)
        {
            try
            {
                await _roomChoices.AssignRoomsCommand.ExecuteAsync(_booking);

                LinkedListNode<INavigableViewModel> prevNode = _navigation.Find(this);
                SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, _booking, prevNode);
                NextCalled?.Invoke(null, this);
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }
Exemplo n.º 11
0
        private async void _searchClient_clientSelected(object sender, ClientEntity selectedClientEntity)
        {
            try
            {
                (sender as SearchClientsViewModel).ClientSelected -= _searchClient_clientSelected;
                _booking.Client = selectedClientEntity.Client;
                await _roomChoices.AssignRoomsCommand.ExecuteAsync(_booking);

                LinkedListNode<INavigableViewModel> prevNode = _navigation.Find(this);
                SumUpViewModel sumUpVM = new SumUpViewModel(_navigation, _booking, prevNode);
                NextCalled?.Invoke(null, this);
            }
            catch (Exception ex)
            {

                Logger.Log(ex);
            }
        }