public AddEventInvoiceItemView(EventModel Event, EventInvoiceModel invoiceModel = null) { InitializeComponent(); DataContext = _viewModel = new AddEventInvoiceItemViewModel(Event, invoiceModel); _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Owner = Application.Current.MainWindow; Loaded += OnAddEventInvoiceItemViewLoaded; }
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); }
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); }
private EventInvoiceModel GetEventInvoice() { var invoiceModel = new EventInvoiceModel(new EventInvoice() { ID = Guid.NewGuid(), EventID = _event.Event.ID, ShowInInvoice = true, IncludeInCorrespondence = true, IncludeInForwardBook = true }); return invoiceModel; }
private void ProcessEventInvoice(EventInvoiceModel invoiceModel) { _isEditMode = (invoiceModel != null); EventInvoice = (_isEditMode) ? invoiceModel : GetEventInvoice(); if (_isEditMode) EventInvoiceOriginal = EventInvoice.Clone(); EventInvoice.PropertyChanged += OnEventBookedProductModelPropertyChanged; }