Exemplo n.º 1
0
        public AddCateringItemView(EventModel Event, EventCateringModel eventCatering = null, List<EventCateringModel> alreadyBookedCaterings = null, List<EventRoomModel> alreadyBookedRooms = null)
        {
            InitializeComponent();

            DataContext = _viewModel = new AddCateringItemViewModel(Event, eventCatering, alreadyBookedCaterings, alreadyBookedRooms);
            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;

            Loaded += OnAddCateringItemViewLoaded;
        }
Exemplo n.º 2
0
        private void AddCateringProduct(EventCateringModel model)
        {
            var charge = new EventCharge
            {
                ID = Guid.NewGuid(),
                EventID = _event.Event.ID,
                ShowInInvoice = model.EventCatering.ShowInInvoice
            };

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

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

            model.EventBookedProducts.Add(productModel);
        }
Exemplo n.º 3
0
        private void ProcessEventCatering(EventCateringModel cateringModel)
        {
            _isEditMode = (cateringModel != null);

            EventCatering = cateringModel ?? GetEventCatering();
            if (_isEditMode)
            {
                CreateClockItems();
                EventCateringOriginal = EventCatering.Clone();
            }
            EventCatering.PropertyChanged += OnEventBookedProductModelPropertyChanged;
            if (_isEditMode)
                cateringModel.EventBookedProducts.ForEach(product =>
                    {
                        product.PropertyChanged += OnEditBookedProductModelPropertyChanged;
                    });
        }
Exemplo n.º 4
0
        private EventCateringModel GetEventCatering()
        {
            var cateringModel = new EventCateringModel(new EventCatering
            {
                ID = Guid.NewGuid(),
                EventID = _event.Event.ID,
                StartTime = _event.Date,
                EndTime = _event.Date,
                ShowInInvoice = true,
                IncludeInCorrespondence = true,
                IncludeInForwardBook = true
            });

            return cateringModel;
        }
Exemplo n.º 5
0
        public AddCateringItemViewModel(EventModel eventModel, EventCateringModel cateringModel, 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;

            ProcessEventCatering(cateringModel);
        }