Esempio n. 1
0
 private OptionChoiceEntity(string description, string imageFullName, OptionChoice option, bool taken = false)
 {
     _pcs = new PropertyChangeSupport(this);
     _optionChoice = option;
     _imageFullPath = imageFullName;
     _taken = taken;
 }
Esempio n. 2
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;
                }
            }
        }
Esempio n. 3
0
 public PromptViewModel(string title, string message, bool hasInput=true)
 {
     _pcs = new PropertyChangeSupport(this);
     _title = title;
     _message = message;
     _hasInput = hasInput;
 }
Esempio n. 4
0
 public PaymentEntity(Booking booking)
 {
     _pcs = new PropertyChangeSupport(this);
     _booking = booking;
     _requiredAmmount = booking.Total;
     _booking.Payment = booking.Payment;
 }
Esempio n. 5
0
 public RoomChoiceEntity(RoomKind kind, int maxAvailable, int count = 0)
 {
     _pcs = new PropertyChangeSupport(this);
     _bedKind = kind.ToBedKind();
     _roomKind = kind;
     _maxAvailable = maxAvailable;
     _count = count;
 }
Esempio n. 6
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>();
 }
Esempio n. 7
0
 public DiscountEntity(Discount discount)
 {
     _pcs = new PropertyChangeSupport(this);
     _discount = discount;
     if (discount != null)
     {
         _validityEntity = new DateRangeEntity(discount.Validity);
     }
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
 public BookingEntity(Booking booking)
 {
     _pcs = new PropertyChangeSupport(this);
     _booking = booking;
     _clientEntity = new ClientEntity(_booking.Client);
     _paymentEntity = new PaymentEntity(booking);
     _datesEntity = new DateRangeEntity(_booking.Dates);
     _discountedOptionChoiceEntity = new OptionChoiceEntity(_booking, _booking.DiscountedOptionChoice);
     _optionDiscountEntity = new DiscountEntity(_booking.OptionDiscount);
 }
Esempio n. 10
0
        public OptionChoiceEntity(OptionChoice optionChoice)
        {
            _pcs = new PropertyChangeSupport(this);
            _optionChoice = optionChoice;

            string cleanedLabel;

            cleanedLabel = _cleanLabel(optionChoice.Option.Label);
            _imageFullPath = string.Format("/Resources/{0}.png", cleanedLabel);
            _taken = false;
        }
Esempio n. 11
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;
        }
        public BookingParametersViewModel(Booking booking)
        {
            _pcs = new PropertyChangeSupport(this);

            _booking = booking;
            _booking.Dates.Start = booking.Dates.Start.Date;
            _booking.Dates.End = booking.Dates.End.Date;
            _dateRange = new DateRangeEntity(booking.Dates);
            _adultsCount = booking.AdultsCount;
            _babiesCount = booking.BabiesCount;
            _validateCommand = new DelegateCommand<object>(_validate);

            if(_adultsCount == 0 && booking.Id == 0)
            {
                AdultsCount = 1;
            }
        }
Esempio n. 13
0
        public OptionChoiceEntity(Booking booking, OptionChoice optionChoice)
        {
            _pcs = new PropertyChangeSupport(this);
            _optionChoice = optionChoice;
            _booking = booking;

            string cleanedLabel;
            if (optionChoice != null)
            {
                cleanedLabel = _cleanLabel(optionChoice.Option.Label);
                _imageFullPath = string.Format("/Resources/{0}.png", cleanedLabel);

                // restauration
                if(optionChoice.PeopleCount == 0 && optionChoice.Option.Id == 8)
                {
                    PeopleCount = 1;
                }
            }
            _taken = false;
        }
Esempio n. 14
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;
        }
Esempio n. 15
0
 public RoomEntity(Room room)
 {
     _pcs = new PropertyChangeSupport(this);
     _room = room;
 }
Esempio n. 16
0
        public SumUpViewModel(LinkedList<INavigableViewModel> navigation, Booking booking, LinkedListNode<INavigableViewModel> prevNode = null)
        {
            _pcs = new PropertyChangeSupport(this);
            _navigation = navigation;
            _booking = booking;
            _dates = booking.Dates;
            _clientEntity = new ClientEntity(booking.Client);
            _paymentEntity = new PaymentEntity(booking);
            _paymentEntity.PropertyChanged += _payment_changed;
            _hasPayment = _booking.Payment != null && _booking.Payment.Ammount > 0d;
            _hadPayment = _hasPayment;
            _wasInTempState = _booking.State == BookingState.Validated;

            _appliedPackEntities = new List<AppliedPackEntity>();
            _optionChoiceEntities = new List<OptionChoiceEntity>(booking.OptionChoices.Count);

            _updateOptionChoiceEntities(booking);

            _title = $"Réservation de {_clientEntity.FirstName} {_clientEntity.LastName} du {booking.Dates.Start:dd/MM/yyyy}";

            _fillAppliedPacksEntities(booking);


            bool canSave = _booking.State == BookingState.Validated;
            _defineCommands(canSave);
            _definePaymentModes();

            _unlockSaveIfNeeded();
            _unlockEditIfNeeded();




            if ((_booking.State != BookingState.Validated && canSave) ||
                (_booking.State == BookingState.Validated && !canSave)
            )
            {
                _saveBookingCommand.ChangeCanExecute();
            }


            if (prevNode != null)
            {
                _navigation.AddAfter(prevNode, this);
            }
            else
            {
                _navigation.AddLast(this);
            }
        }
Esempio n. 17
0
 public OptionEntity(Option opt)
 {
     _pcs = new PropertyChangeSupport(this);
     _opt = opt;
 }
Esempio n. 18
0
        public LoginViewModel()
        {
            _pcs = new PropertyChangeSupport(this);
            _loginResult = "";
            _resultReady = false;
            _title = "Resotel - Login";

            _loadCommand = new DelegateCommand<IUITimer>(_load);
            _loginCommand = new DelegateCommandAsync<object>(_loginCmd);
        }
Esempio n. 19
0
        public MainWindowViewModel(UserEntity user)
        {
            Logger.Log("=Initialisation Fenêtre principale (post login)=");
            _pcs = new PropertyChangeSupport(this);
            _user = user;
            _currentEntities = new ObservableCollection<INavigableViewModel>();
            _title = "Resotel - Facturation";
            _navigation = new LinkedList<INavigableViewModel>();

            _addBookingCommand = new DelegateCommand<object>(_addBooking);
            _closeBookingCommand = new DelegateCommand<IEntity>(_closeBooking);
            _addClientCommand = new DelegateCommand<object>(_addClient);
            _searchBookingCommand = new DelegateCommandAsync<object>(_searchBooking);
            _searchClientCommand = new DelegateCommandAsync<object>(_searchClient);
            _logoutCommand = new DelegateCommand<object>(_logOut);
            _nextCommand = new DelegateCommand<BookingViewModel>(_next);
            _prevCommand = new DelegateCommand<BookingViewModel>(_prev);
            Logger.Log("=fenêtre principale initialisée (post login)=");
        }
Esempio n. 20
0
 public DateRangeEntity(DateRange dateRange)
 {
     _pcs = new PropertyChangeSupport(this);
     _dateRange = dateRange;
 }
Esempio n. 21
0
        public BookingViewModel(LinkedList<INavigableViewModel> navigation, Booking booking, LinkedListNode<INavigableViewModel> prevNode = null)
        {
            _pcs = new PropertyChangeSupport(this);
            _navigation = navigation;
            _parameters = new BookingParametersViewModel(booking);
            _parameters.Defined += _parameters_defined;
            _parameters.PropertyChanged += _parametersChanged;
            _parametersValidated = false;
            _booking = booking;
            _clientEntity = new ClientEntity(_booking.Client);
            _bookingEntity = new BookingEntity(_booking);
            _clientEntity.Bookings.Add(_bookingEntity);
            _computeTitle(_clientEntity);
            _clientEntity.PropertyChanged += _clientChanged;

            _searchClientCommand = new DelegateCommandAsync<BookingViewModel>(_searchClient, false);
            _newClientCommand = new DelegateCommandAsync<BookingViewModel>(_newClient, false);
            _validateBookingCommand = new DelegateCommandAsync<BookingViewModel>(_validateBooking, false);

            if (prevNode == null)
            {
                _navigation.AddLast(this);
            }
            else
            {
                _navigation.AddAfter(prevNode, this);
            }
        }
Esempio n. 22
0
 public UserEntity(User user)
 {
     _pcs = new PropertyChangeSupport(this);
     _user = user;
 }