예제 #1
0
        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;
        }
예제 #2
0
        private void ProcessEventRoom(EventRoomModel roomModel)
        {
            _isEditMode = (roomModel != null);

            EventRoom = (_isEditMode) ? roomModel : GetEventRoom();
            if (_isEditMode)
            {
                CreateClockItems();
                EventRoomOriginal = EventRoom.Clone();
            }
            EventRoom.PropertyChanged += OnEventBookedProductModelPropertyChanged;
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }