Exemplo n.º 1
0
 private OptionChoiceEntity(string description, string imageFullName, OptionChoice option, bool taken = false)
 {
     _pcs = new PropertyChangeSupport(this);
     _optionChoice = option;
     _imageFullPath = imageFullName;
     _taken = taken;
 }
Exemplo 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;
                }
            }
        }
Exemplo n.º 3
0
 public PromptViewModel(string title, string message, bool hasInput=true)
 {
     _pcs = new PropertyChangeSupport(this);
     _title = title;
     _message = message;
     _hasInput = hasInput;
 }
Exemplo n.º 4
0
 public PaymentEntity(Booking booking)
 {
     _pcs = new PropertyChangeSupport(this);
     _booking = booking;
     _requiredAmmount = booking.Total;
     _booking.Payment = booking.Payment;
 }
Exemplo 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;
 }
Exemplo 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>();
 }
Exemplo n.º 7
0
 public DiscountEntity(Discount discount)
 {
     _pcs = new PropertyChangeSupport(this);
     _discount = discount;
     if (discount != null)
     {
         _validityEntity = new DateRangeEntity(discount.Validity);
     }
 }
Exemplo 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;
 }
Exemplo 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);
 }
Exemplo 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;
        }
Exemplo 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;
        }
Exemplo n.º 12
0
        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;
            }
        }
Exemplo 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;
        }
Exemplo 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;
        }
Exemplo n.º 15
0
 public RoomEntity(Room room)
 {
     _pcs = new PropertyChangeSupport(this);
     _room = room;
 }
Exemplo 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);
            }
        }
Exemplo n.º 17
0
 public OptionEntity(Option opt)
 {
     _pcs = new PropertyChangeSupport(this);
     _opt = opt;
 }
Exemplo 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);
        }
Exemplo 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)=");
        }
Exemplo n.º 20
0
 public DateRangeEntity(DateRange dateRange)
 {
     _pcs = new PropertyChangeSupport(this);
     _dateRange = dateRange;
 }
Exemplo 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);
            }
        }
Exemplo n.º 22
0
 public UserEntity(User user)
 {
     _pcs = new PropertyChangeSupport(this);
     _user = user;
 }