コード例 #1
0
        public AddEventInvoiceItemView(EventModel Event, EventInvoiceModel invoiceModel = null)
        {
            InitializeComponent();
            DataContext = _viewModel = new AddEventInvoiceItemViewModel(Event, invoiceModel);
            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;

            Loaded += OnAddEventInvoiceItemViewLoaded;
        }
コード例 #2
0
        private void ProcessEventInvoice(EventInvoiceModel invoiceModel)
        {
            _isEditMode = (invoiceModel != null);

            EventInvoice = (_isEditMode) ? invoiceModel : GetEventInvoice();
            if (_isEditMode)
            {
                EventInvoiceOriginal = EventInvoice.Clone();
            }
            EventInvoice.PropertyChanged += OnEventBookedProductModelPropertyChanged;
        }
コード例 #3
0
        private EventInvoiceModel GetEventInvoice()
        {
            var invoiceModel = new EventInvoiceModel(new EventInvoice()
            {
                ID                      = Guid.NewGuid(),
                EventID                 = _event.Event.ID,
                ShowInInvoice           = true,
                IncludeInCorrespondence = true,
                IncludeInForwardBook    = true
            });

            return(invoiceModel);
        }
コード例 #4
0
        public AddEventInvoiceItemViewModel(EventModel eventModel, EventInvoiceModel invoiceModel)
        {
            _event = eventModel;

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve <IDataUnitLocator>();

            _eventDataUnit = dataUnitLocator.ResolveDataUnit <IEventDataUnit>();

            SubmitCommand              = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute);
            AddItemCommand             = new RelayCommand(AddItemCommandExecuted);
            CancelCommand              = new RelayCommand(CancelCommandExecuted);
            AddProductCommand          = new RelayCommand(AddProductCommandExecuted);
            DeleteBookedProductCommand = new RelayCommand <EventBookedProductModel>(DeleteBookedProductCommandExecuted);

            ProcessEventInvoice(invoiceModel);
        }
コード例 #5
0
        private void AddInvoiceProduct(EventInvoiceModel model)
        {
            var charge = new EventCharge()
            {
                ID            = Guid.NewGuid(),
                EventID       = _event.Event.ID,
                ShowInInvoice = model.EventInvoice.ShowInInvoice
            };

            var item = new EventBookedProductModel(new EventBookedProduct()
            {
                ID = Guid.NewGuid(),
                EventBookingItemID = model.EventInvoice.ID,
                EventID            = _event.Event.ID,
                EventCharge        = charge
            });

            item.Quantity         = _event.Event.Places;
            item.PropertyChanged += OnEventBookedProductModelPropertyChanged;

            model.EventBookedProducts.Add(item);
        }