コード例 #1
0
ファイル: EventItemsViewModel.cs プロジェクト: syatin003/Wpf
        private void EditItemCommandExecuted(EventItemModel item)
        {
            RaisePropertyChanged("DisableParentWindow");

            if (item.Instance.GetType() == typeof(EventCateringModel))
            {
                var model = (EventCateringModel)item.Instance;

                var window = new AddCateringItemView(Event, model);
                window.ShowDialog();


                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }
            else if (item.Instance.GetType() == typeof(EventGolfModel))
            {
                var model = (EventGolfModel)item.Instance;

                var window = new AddEventGolfItemView(Event, model);
                window.ShowDialog();

                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }
            else if (item.Instance.GetType() == typeof(EventRoomModel))
            {
                var model = (EventRoomModel)item.Instance;

                var window = new AddRoomItemView(Event, model);
                window.ShowDialog();

                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }
            else if (item.Instance.GetType() == typeof(EventInvoiceModel))
            {
                var model  = (EventInvoiceModel)item.Instance;
                var window = new AddEventInvoiceItemView(Event, model);
                window.ShowDialog();

                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }
            RaisePropertyChanged("EnableParentWindow");
        }
コード例 #2
0
        private void EditItemCommandExecuted(EventItemModel item)
        {
            RaisePropertyChanged("DisableParentWindow");

            if (item.Instance.GetType() == typeof(EventCateringModel))
            {
                var model = (EventCateringModel)item.Instance;

                var window = new AddCateringItemView(Event, model, AlreadyBookedCaterings, AlreadyBookedRooms);
                window.ShowDialog();


                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    AlreadyBookedCaterings.Remove(model);
                    EventItemsAlreadyBooked.Remove(item);
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }
            else if (item.Instance.GetType() == typeof(EventGolfModel))
            {
                var model = (EventGolfModel)item.Instance;

                var window = new AddEventGolfItemView(Event, model, AlreadyBookedGolfs);
                window.ShowDialog();

                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    AlreadyBookedGolfs.Remove(model);
                    EventItemsAlreadyBooked.Remove(item);
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }
            else if (item.Instance.GetType() == typeof(EventRoomModel))
            {
                var model = (EventRoomModel)item.Instance;

                var window = new AddRoomItemView(Event, model, AlreadyBookedCaterings, AlreadyBookedRooms);
                window.ShowDialog();

                if (window.DialogResult != null && window.DialogResult.Value)
                {
                    AlreadyBookedRooms.Remove(model);
                    EventItemsAlreadyBooked.Remove(item);
                    _event.Event.LastEditDate = DateTime.Now;
                    _event.RefreshItems();
                }
            }

            RaisePropertyChanged("EnableParentWindow");
            if (EventItemsAlreadyBooked.Count == 0)
            {
                RaisePropertyChanged("CloseDialog");
            }
        }
コード例 #3
0
ファイル: EventItemsViewModel.cs プロジェクト: syatin003/Wpf
        private void AddRoomCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new AddRoomItemView(Event);

            window.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (window.DialogResult != null && window.DialogResult.Value)
            {
                _event.Event.LastEditDate = DateTime.Now;
                _event.RefreshItems();
            }
        }