Exemplo n.º 1
0
        public SearchClientsViewModel(List <ClientEntity> clientEntities, bool reservationMode = false)
        {
            _pcs   = new PropertyChangeSupport(this);
            _title = "Resotel - Recherche de client";

            if (reservationMode)
            {
                _title = "Resotel - Recherche de réservation";
            }

            _searchClientVMs                     = new ObservableCollection <SearchClientViewModel>();
            _searchClientVMsSource               = CollectionViewProvider.Provider(_searchClientVMs);
            _searchClientVMsView                 = _searchClientVMsSource.View;
            _searchClientVMsView.Filter          = _filterClientNameOrFirstName;
            _searchClientVMsView.CurrentChanged += _client_selected;

            HashSet <string> clientKeys = new HashSet <string>();

            foreach (ClientEntity clientEntity in clientEntities)
            {
                if (clientKeys.Add($"{clientEntity.FirstName}{clientEntity.LastName}"))
                {
                    SearchClientViewModel clientSearchVM = new SearchClientViewModel(clientEntity, clientEntities);
                    _searchClientVMs.Add(clientSearchVM);
                    clientSearchVM.ClientSelected += _subClient_selected;
                }
            }
        }
Exemplo n.º 2
0
 private RoomsChoiceViewModel()
 {
     _pcs = new PropertyChangeSupport(this);
     _availableRoomChoiceEntities       = new ObservableCollection <RoomChoiceEntity>();
     _availableRoomChoiceEntitiesSource = CollectionViewProvider.Provider(_availableRoomChoiceEntities);
     _availableRoomChoiceEntitiesView   = _availableRoomChoiceEntitiesSource.View;
     _filteredRooms       = new List <Room>();
     _availableRoomCounts = new Dictionary <RoomKind, int>();
 }
Exemplo n.º 3
0
 private OptionsViewModel()
 {
     _pcs = new PropertyChangeSupport(this);
     _availableOptionChoiceEntities           = new ObservableCollection <OptionChoiceEntity>();
     _availableOptionsChoiceEntitiesSource    = CollectionViewProvider.Provider(_availableOptionChoiceEntities);
     _availableOptionChoiceEntitiesView       = _availableOptionsChoiceEntitiesSource.View;
     _choosenOptionsChoiceEntitiesSource      = CollectionViewProvider.Provider(_availableOptionChoiceEntities);
     _choosenOptionsChoiceEntitiesView        = _choosenOptionsChoiceEntitiesSource.View;
     _choosenOptionsChoiceEntitiesView.Filter = _isChoosen;
 }
Exemplo n.º 4
0
        public ClientBookingsViewModel(ClientEntity clientEntity)
        {
            _pcs                  = new PropertyChangeSupport(this);
            _clientEntity         = clientEntity;
            _clientBookingsSource = CollectionViewProvider.Provider(clientEntity.Bookings);
            _clientBookingsView   = _clientBookingsSource.View;
            Booking booking = default(Booking);

            _clientBookingsView.SortDescriptions.Add(new SortDescription($"{nameof(booking.Dates)}.{nameof(booking.Dates.Start)}", ListSortDirection.Ascending));
            _clientBookingsView.CurrentChanged += _clientBookingsView_currentChanged;

            _selectBookingCommand = new DelegateCommand <object>(_selectBooking);
            _cancelBookingCommand = new DelegateCommandAsync <object>(_cancelBooking);

            _clientBookingsView.Filter = _mustShowBooking;
        }
Exemplo n.º 5
0
        public SearchClientViewModel(ClientEntity clientEntity, IEnumerable <ClientEntity> clientEntities)
        {
            _pcs = new PropertyChangeSupport(this);
            _displayMoreToggled      = false;
            _clientEntity            = clientEntity;
            _subClientEntities       = new ObservableCollection <ClientEntity>();
            _subClientEntitiesSource = CollectionViewProvider.Provider(_subClientEntities);
            _subClientEntitiesView   = _subClientEntitiesSource.View;
            _subClientEntitiesView.CurrentChanged += _subClientEntitiesView_CurrentChanged;

            foreach (ClientEntity clientE in clientEntities)
            {
                if (clientE.FirstName == _clientEntity.FirstName && clientE.LastName == _clientEntity.LastName)
                {
                    _subClientEntities.Add(clientE);
                }
            }

            _needsCount        = _subClientEntities.Count > 1;
            _foundClientsCount = _subClientEntities.Count;
        }
Exemplo n.º 6
0
        private void _definePaymentModes()
        {
            Dictionary <PaymentMode, string> paymentModes = new Dictionary <PaymentMode, string>
            {
                { Models.PaymentMode.CreditCard, "Carte de crédit" },
                { Models.PaymentMode.Cheque, "Chèque" },
                { Models.PaymentMode.Cash, "Espèces" }
            };

            _paymentModes = new Dictionary <string, PaymentMode>
            {
                { "Carte de crédit", Models.PaymentMode.CreditCard },
                { "Chèque", Models.PaymentMode.Cheque },
                { "Espèces", Models.PaymentMode.Cash }
            };

            _paymentModesCollection       = new ObservableCollection <string>(paymentModes.Values);
            _paymentModesCollectionSource = CollectionViewProvider.Provider(_paymentModesCollection);
            _paymentModesCollectionView   = _paymentModesCollectionSource.View;

            _paymentModesCollectionView.CurrentChanged += _paymentModesCollectionView_CurrentChanged;

            _paymentModesCollectionView.MoveCurrentTo(paymentModes[_paymentEntity.Mode]);
        }