Exemplo n.º 1
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.º 2
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.º 3
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);
            }
        }