public AddRoomItemView(EventModel Event, EventRoomModel roomModel = null, List <EventCateringModel> alreadyBookedCaterings = null, List <EventRoomModel> alreadyBookedRooms = null) { InitializeComponent(); DataContext = _viewModel = new AddRoomItemViewModel(Event, roomModel, alreadyBookedCaterings, alreadyBookedRooms); _viewModel.PropertyChanged += OnViewModelPropertyChanged; Owner = Application.Current.MainWindow; Loaded += OnAddRoomItemViewLoaded; }
private void ProcessEventRoom(EventRoomModel roomModel) { _isEditMode = (roomModel != null); EventRoom = (_isEditMode) ? roomModel : GetEventRoom(); if (_isEditMode) { CreateClockItems(); EventRoomOriginal = EventRoom.Clone(); } EventRoom.PropertyChanged += OnEventBookedProductModelPropertyChanged; }
private EventRoomModel GetEventRoom() { var eventRoom = new EventRoomModel(new EventRoom { ID = Guid.NewGuid(), EventID = _event.Event.ID, StartTime = _event.Date, EndTime = _event.Date, ShowInInvoice = true, IncludeInCorrespondence = true, IncludeInForwardBook = true }); return(eventRoom); }
public AddRoomItemViewModel(EventModel eventModel, EventRoomModel roomModel, List <EventCateringModel> alreadyBookedCaterings, List <EventRoomModel> alreadyBookedRooms) { _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); AlreadyBookedCaterings = alreadyBookedCaterings; AlreadyBookedRooms = alreadyBookedRooms; ProcessEventRoom(roomModel); }
private void AddRoomProduct(EventRoomModel model) { var charge = new EventCharge { ID = Guid.NewGuid(), EventID = _event.Event.ID, ShowInInvoice = model.EventRoom.ShowInInvoice }; var item = new EventBookedProductModel(new EventBookedProduct { ID = Guid.NewGuid(), EventBookingItemID = model.EventRoom.ID, EventID = _event.Event.ID, EventCharge = charge }); item.Quantity = _event.Event.Places; item.PropertyChanged += OnEventBookedProductModelPropertyChanged; model.EventBookedProducts.Add(item); }