コード例 #1
0
ファイル: EventCateringModel.cs プロジェクト: syatin003/Wpf
        public EventCateringModel(EventCatering eventCatering)
        {
            _eventCatering = eventCatering;
            EventBookedProducts = new ObservableCollection<EventBookedProductModel>();

            _room = _eventCatering.Room;
        }
コード例 #2
0
        private async void OKCommandExecuted()
        {
            IsBusy = true;

            var fromEvent = SelectedEvent;

            await LoadLightEventDetails(fromEvent);

            // Event Caterings
            if (fromEvent.EventCaterings.Any())
            {
                fromEvent.EventCaterings.ForEach(x =>
                {
                    var catering = new EventCatering()
                    {
                        ID = Guid.NewGuid(),
                        EventID = _event.Event.ID,
                        Event = _event.Event,
                        Time = x.EventCatering.Time,
                        RoomID = x.EventCatering.RoomID,
                        StartTime = x.EventCatering.StartTime,
                        EndTime = x.EventCatering.EndTime,
                        Notes = x.EventCatering.Notes,
                        ShowInInvoice = x.EventCatering.ShowInInvoice,
                        IncludeInForwardBook = x.EventCatering.IncludeInForwardBook,
                        IncludeInCorrespondence = x.EventCatering.IncludeInCorrespondence,
                        IsSpecial = x.EventCatering.IsSpecial
                    };

                    var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventCatering.ID).ToList();

                    if (products.Any())
                    {
                        products.ForEach(y =>
                        {
                            var product = new EventBookedProduct()
                            {
                                ID = Guid.NewGuid(),
                                EventID = _event.Event.ID,
                                ProductID = y.EventBookedProduct.ProductID,
                                Product = y.EventBookedProduct.Product,
                                EventBookingItemID = catering.ID,
                                Quantity = _event.Event.Places,
                                Price = y.EventBookedProduct.Price
                            };

                            var charge = new EventCharge()
                            {
                                ID = product.ID,
                                EventID = _event.Event.ID,
                                ProductID = product.ProductID,
                                Quantity = product.Quantity,
                                Price = product.Price,
                                Product = product.Product,
                                ShowInInvoice = catering.ShowInInvoice
                            };

                            product.EventCharge = charge;


                            _eventsDataUnit.EventBookedProductsRepository.Add(product);
                            _eventsDataUnit.EventChargesRepository.Add(charge);
                            _event.EventBookedProducts.Add(new EventBookedProductModel(product));
                            _event.EventCharges.Add(new EventChargeModel(charge));
                        });
                    }
                    _eventsDataUnit.EventCateringsRepository.Add(catering);
                    _event.EventCaterings.Add(new EventCateringModel(catering));
                });
            }

            // Event Rooms
            if (fromEvent.EventRooms.Any())
            {
                fromEvent.EventRooms.ForEach(x =>
                {
                    var room = new EventRoom()
                    {
                        ID = Guid.NewGuid(),
                        EventID = _event.Event.ID,
                        Event = _event.Event,
                        RoomID = x.EventRoom.RoomID,
                        StartTime = x.EventRoom.StartTime,
                        EndTime = x.EventRoom.EndTime,
                        Notes = x.EventRoom.Notes,
                        ShowInInvoice = x.EventRoom.ShowInInvoice,
                        IncludeInForwardBook = x.EventRoom.IncludeInForwardBook,
                        IncludeInCorrespondence = x.EventRoom.IncludeInCorrespondence,
                    };

                    var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventRoom.ID).ToList();

                    if (products.Any())
                    {
                        products.ForEach(y =>
                        {
                            var product = new EventBookedProduct()
                            {
                                ID = Guid.NewGuid(),
                                EventID = _event.Event.ID,
                                ProductID = y.EventBookedProduct.ProductID,
                                Product = y.EventBookedProduct.Product,
                                EventBookingItemID = room.ID,
                                Quantity = _event.Event.Places,
                                Price = y.EventBookedProduct.Price
                            };

                            var charge = new EventCharge()
                            {
                                ID = product.ID,
                                EventID = _event.Event.ID,
                                ProductID = product.ProductID,
                                Quantity = product.Quantity,
                                Price = product.Price,
                                Product = product.Product,
                                ShowInInvoice = room.ShowInInvoice
                            };
                            product.EventCharge = charge;

                            _eventsDataUnit.EventBookedProductsRepository.Add(product);
                            _eventsDataUnit.EventChargesRepository.Add(charge);
                            _event.EventBookedProducts.Add(new EventBookedProductModel(product));
                            _event.EventCharges.Add(new EventChargeModel(charge));
                        });
                    }
                    _eventsDataUnit.EventRoomsRepository.Add(room);
                    _event.EventRooms.Add(new EventRoomModel(room));
                });
            }

            // Event Golfs
            var fromEventGolfs = fromEvent.EventGolfs.Where(eventGolf => !eventGolf.EventGolf.IsLinked);
            if (fromEventGolfs.Any())
            {
                fromEvent.EventGolfs.ForEach(x =>
                {
                    var golf = new EventGolf()
                    {
                        ID = Guid.NewGuid(),
                        EventID = _event.Event.ID,
                        Event = _event.Event,
                        Time = x.EventGolf.Time,
                        TeeID = x.EventGolf.TeeID,
                        HoleID = x.EventGolf.HoleID,
                        Slots = x.EventGolf.Slots,
                        Notes = x.EventGolf.Notes,
                        ShowInInvoice = x.EventGolf.ShowInInvoice,
                        IncludeInForwardBook = x.EventGolf.IncludeInForwardBook,
                        IncludeInCorrespondence = x.EventGolf.IncludeInCorrespondence,
                        EventGolf1 = x.EventGolf.EventGolf1 != null ? new EventGolf()
                        {
                            ID = Guid.NewGuid(),
                            EventID = _event.Event.ID,
                            Event = _event.Event,
                            Time = x.EventGolf.EventGolf1.Time,
                            TeeID = x.EventGolf.EventGolf1.TeeID,
                            HoleID = x.EventGolf.EventGolf1.HoleID,
                            Slots = x.EventGolf.EventGolf1.Slots,
                            Notes = x.EventGolf.EventGolf1.Notes,
                            ShowInInvoice = x.EventGolf.EventGolf1.ShowInInvoice,
                            IncludeInForwardBook = x.EventGolf.EventGolf1.IncludeInForwardBook,
                            IncludeInCorrespondence = x.EventGolf.EventGolf1.IncludeInCorrespondence,
                            IsLinked = true
                        } : null
                    };

                    var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventGolf.ID).ToList();

                    if (products.Any())
                    {
                        products.ForEach(y =>
                        {
                            var product = new EventBookedProduct()
                            {
                                ID = Guid.NewGuid(),
                                EventID = _event.Event.ID,
                                ProductID = y.EventBookedProduct.ProductID,
                                Product = y.EventBookedProduct.Product,
                                EventBookingItemID = golf.ID,
                                Quantity = _event.Event.Places,
                                Price = y.EventBookedProduct.Price
                            };

                            var charge = new EventCharge()
                            {
                                ID = product.ID,
                                EventID = _event.Event.ID,
                                ProductID = product.ProductID,
                                Product = product.Product,
                                Quantity = product.Quantity,
                                Price = product.Price,
                                ShowInInvoice = golf.ShowInInvoice
                            };
                            product.EventCharge = charge;
                            _eventsDataUnit.EventBookedProductsRepository.Add(product);
                            _eventsDataUnit.EventChargesRepository.Add(charge);
                            _event.EventBookedProducts.Add(new EventBookedProductModel(product));
                            _event.EventCharges.Add(new EventChargeModel(charge));
                        });
                    }
                    _eventsDataUnit.EventGolfsRepository.Add(golf);
                    _event.EventGolfs.Add(new EventGolfModel(golf));
                });
            }

            // Event Invoices
            if (fromEvent.EventInvoices.Any())
            {
                fromEvent.EventInvoices.ForEach(x =>
                {
                    var invoice = new EventInvoice()
                    {
                        ID = Guid.NewGuid(),
                        EventID = _event.Event.ID,
                        Event = _event.Event,
                        Notes = x.EventInvoice.Notes,
                        ShowInInvoice = x.EventInvoice.ShowInInvoice,
                        IncludeInForwardBook = x.EventInvoice.IncludeInForwardBook,
                        IncludeInCorrespondence = x.EventInvoice.IncludeInCorrespondence,
                    };

                    var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventInvoice.ID).ToList();

                    if (products.Any())
                    {
                        products.ForEach(y =>
                        {
                            var product = new EventBookedProduct()
                            {
                                ID = Guid.NewGuid(),
                                EventID = _event.Event.ID,
                                ProductID = y.EventBookedProduct.ProductID,
                                Product = y.EventBookedProduct.Product,
                                EventBookingItemID = invoice.ID,
                                Quantity = _event.Event.Places,
                                Price = y.EventBookedProduct.Price
                            };

                            var charge = new EventCharge()
                            {
                                ID = product.ID,
                                EventID = _event.Event.ID,
                                ProductID = product.ProductID,
                                Product = product.Product,
                                Quantity = product.Quantity,
                                Price = product.Price,
                                ShowInInvoice = invoice.ShowInInvoice
                            };
                            product.EventCharge = charge;
                            _eventsDataUnit.EventBookedProductsRepository.Add(product);
                            _eventsDataUnit.EventChargesRepository.Add(charge);
                            _event.EventBookedProducts.Add(new EventBookedProductModel(product));
                            _event.EventCharges.Add(new EventChargeModel(charge));
                        });
                    }
                    _eventsDataUnit.EventInvoicesRepository.Add(invoice);
                    _event.EventInvoices.Add(new EventInvoiceModel(invoice));
                });
            }
            RaisePropertyChanged("CloseDialog");
            IsBusy = false;
        }
コード例 #3
0
 /// <summary>
 /// Create a new EventCatering object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="eventID">Initial value of the EventID property.</param>
 /// <param name="time">Initial value of the Time property.</param>
 /// <param name="roomID">Initial value of the RoomID property.</param>
 /// <param name="startTime">Initial value of the StartTime property.</param>
 /// <param name="endTime">Initial value of the EndTime property.</param>
 /// <param name="showInInvoice">Initial value of the ShowInInvoice property.</param>
 /// <param name="includeInForwardBook">Initial value of the IncludeInForwardBook property.</param>
 /// <param name="includeInCorrespondence">Initial value of the IncludeInCorrespondence property.</param>
 /// <param name="isSpecial">Initial value of the IsSpecial property.</param>
 public static EventCatering CreateEventCatering(global::System.Guid id, global::System.Guid eventID, global::System.DateTime time, global::System.Guid roomID, global::System.DateTime startTime, global::System.DateTime endTime, global::System.Boolean showInInvoice, global::System.Boolean includeInForwardBook, global::System.Boolean includeInCorrespondence, global::System.Boolean isSpecial)
 {
     EventCatering eventCatering = new EventCatering();
     eventCatering.ID = id;
     eventCatering.EventID = eventID;
     eventCatering.Time = time;
     eventCatering.RoomID = roomID;
     eventCatering.StartTime = startTime;
     eventCatering.EndTime = endTime;
     eventCatering.ShowInInvoice = showInInvoice;
     eventCatering.IncludeInForwardBook = includeInForwardBook;
     eventCatering.IncludeInCorrespondence = includeInCorrespondence;
     eventCatering.IsSpecial = isSpecial;
     return eventCatering;
 }
コード例 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the EventCaterings EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEventCaterings(EventCatering eventCatering)
 {
     base.AddObject("EventCaterings", eventCatering);
 }
コード例 #5
0
ファイル: EventsViewModel.cs プロジェクト: syatin003/Wpf
        private async void DuplicateEventCommandExecuted()
        {

            RaisePropertyChanged("DisableParentWindow");
            var addDuplicateView = new DuplicateView();
            addDuplicateView.ShowDialog();
            RaisePropertyChanged("EnableParentWindow");

            if (addDuplicateView.DialogResult != null && addDuplicateView.DialogResult == true)
            {
                var addDuplicateViewModel = addDuplicateView.DataContext as DuplicateViewModel;
                if (addDuplicateViewModel != null)
                {
                    IsBusy = true;

                    var fromEvent = SelectedEvent;

                    await LoadLightEventDetails(fromEvent);

                    // General event info
                    var toEvent = new Event()
                    {
                        ID = Guid.NewGuid(),
                        Name = addDuplicateViewModel.EventName,
                        Date = Convert.ToDateTime(addDuplicateViewModel.EventDate),
                        Places = fromEvent.Places,
                        ContactID = fromEvent.Event.ContactID,
                        EventTypeID = fromEvent.Event.EventTypeID,
                        EventType = fromEvent.Event.EventType,
                        EventStatusID = fromEvent.Event.EventStatusID,
                        EventStatus = fromEvent.Event.EventStatus,
                        CreationDate = DateTime.Now,
                        MembersOnly = fromEvent.Event.MembersOnly,
                        ShowInForwardBook = fromEvent.Event.ShowInForwardBook,
                        ShowOnCalendar = fromEvent.Event.ShowOnCalendar,
                        UsedAsTemplate = fromEvent.Event.UsedAsTemplate,
                        InvoiceAddress = fromEvent.Event.InvoiceAddress,
                        StartTime = fromEvent.StartTime,
                        EndTime = fromEvent.EndTime
                    };

                    var toEventModel = new EventModel(toEvent);
                    // Notes
                    if (!fromEvent.EventNotes.Any())
                    {
                        var notes = await _eventsDataUnit.EventNotesRepository.GetAllAsync(x => x.EventID == fromEvent.Event.ID);
                        fromEvent.EventNotes = new ObservableCollection<EventNoteModel>(notes.Select(x => new EventNoteModel(x)));
                    }

                    if (fromEvent.EventNotes.Any())
                    {
                        fromEvent.EventNotes.ForEach(x =>
                        {
                            var note = new EventNote()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                EventNoteTypeID = x.EventNote.EventNoteTypeID,
                                UserID = x.EventNote.UserID,
                                Date = DateTime.Now,
                                Note = x.Note
                            };

                            _eventsDataUnit.EventNotesRepository.Add(note);
                            toEventModel.EventNotes.Add(new EventNoteModel(note));
                        });
                    }

                    // Altarnative Contacts
                    if (!fromEvent.EventContacts.Any())
                    {
                        var contacts = await _eventsDataUnit.EventContactsRepository.GetAllAsync(x => x.EventID == fromEvent.Event.ID);
                        fromEvent.EventContacts = new ObservableCollection<EventContact>(contacts);
                    }

                    if (fromEvent.EventContacts.Any())
                    {
                        fromEvent.EventContacts.ForEach(x =>
                        {
                            var contact = new EventContact()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                ContactID = x.ContactID
                            };

                            _eventsDataUnit.EventContactsRepository.Add(contact);
                            toEventModel.EventContacts.Add(contact);
                        });
                    }

                    // Event Caterings
                    if (fromEvent.EventCaterings.Any())
                    {
                        fromEvent.EventCaterings.ForEach(x =>
                        {
                            var catering = new EventCatering()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                Event = toEventModel.Event,
                                Time = x.EventCatering.Time,
                                RoomID = x.EventCatering.RoomID,
                                StartTime = x.EventCatering.StartTime,
                                EndTime = x.EventCatering.EndTime,
                                Notes = x.EventCatering.Notes,
                                ShowInInvoice = x.EventCatering.ShowInInvoice,
                                IncludeInForwardBook = x.EventCatering.IncludeInForwardBook,
                                IncludeInCorrespondence = x.EventCatering.IncludeInCorrespondence,
                                IsSpecial = x.EventCatering.IsSpecial
                            };

                            var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventCatering.ID).ToList();

                            if (products.Any())
                            {
                                products.ForEach(y =>
                                {
                                    var product = new EventBookedProduct()
                                    {
                                        ID = Guid.NewGuid(),
                                        EventID = toEventModel.Event.ID,
                                        ProductID = y.EventBookedProduct.ProductID,
                                        EventBookingItemID = catering.ID,
                                        Quantity = y.EventBookedProduct.Quantity,
                                        Price = y.EventBookedProduct.Price
                                    };

                                    var charge = new EventCharge()
                                    {
                                        ID = product.ID,
                                        EventID = toEventModel.Event.ID,
                                        ProductID = product.ProductID,
                                        Quantity = product.Quantity,
                                        Price = product.Price,
                                        ShowInInvoice = catering.ShowInInvoice
                                    };
                                    product.EventCharge = charge;

                                    _eventsDataUnit.EventBookedProductsRepository.Add(product);
                                    _eventsDataUnit.EventChargesRepository.Add(charge);
                                    toEventModel.EventBookedProducts.Add(new EventBookedProductModel(product));
                                    toEventModel.EventCharges.Add(new EventChargeModel(charge));
                                });
                            }
                            _eventsDataUnit.EventCateringsRepository.Add(catering);
                            toEventModel.EventCaterings.Add(new EventCateringModel(catering));
                        });
                    }

                    // Event Rooms
                    if (fromEvent.EventRooms.Any())
                    {
                        fromEvent.EventRooms.ForEach(x =>
                        {
                            var room = new EventRoom()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                Event = toEventModel.Event,
                                RoomID = x.EventRoom.RoomID,
                                StartTime = x.EventRoom.StartTime,
                                EndTime = x.EventRoom.EndTime,
                                Notes = x.EventRoom.Notes,
                                ShowInInvoice = x.EventRoom.ShowInInvoice,
                                IncludeInForwardBook = x.EventRoom.IncludeInForwardBook,
                                IncludeInCorrespondence = x.EventRoom.IncludeInCorrespondence,
                            };

                            var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventRoom.ID).ToList();

                            if (products.Any())
                            {
                                products.ForEach(y =>
                                {
                                    var product = new EventBookedProduct()
                                    {
                                        ID = Guid.NewGuid(),
                                        EventID = toEventModel.Event.ID,
                                        ProductID = y.EventBookedProduct.ProductID,
                                        EventBookingItemID = room.ID,
                                        Quantity = y.EventBookedProduct.Quantity,
                                        Price = y.EventBookedProduct.Price
                                    };

                                    var charge = new EventCharge()
                                    {
                                        ID = product.ID,
                                        EventID = toEventModel.Event.ID,
                                        ProductID = product.ProductID,
                                        Quantity = product.Quantity,
                                        Price = product.Price,
                                        ShowInInvoice = room.ShowInInvoice
                                    };
                                    product.EventCharge = charge;

                                    _eventsDataUnit.EventBookedProductsRepository.Add(product);
                                    _eventsDataUnit.EventChargesRepository.Add(charge);
                                    toEventModel.EventBookedProducts.Add(new EventBookedProductModel(product));
                                    toEventModel.EventCharges.Add(new EventChargeModel(charge));
                                });
                            }
                            _eventsDataUnit.EventRoomsRepository.Add(room);
                            toEventModel.EventRooms.Add(new EventRoomModel(room));
                        });
                    }

                    // Event Golfs
                    var fromEventGolfs = fromEvent.EventGolfs.Where(eventGolf => !eventGolf.EventGolf.IsLinked);
                    if (fromEventGolfs.Any())
                    {
                        fromEventGolfs.ForEach(x =>
                        {
                            var golf = new EventGolf()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                Event = toEventModel.Event,
                                Time = x.EventGolf.Time,
                                TeeID = x.EventGolf.TeeID,
                                HoleID = x.EventGolf.HoleID,
                                Slots = x.EventGolf.Slots,
                                Notes = x.EventGolf.Notes,
                                ShowInInvoice = x.EventGolf.ShowInInvoice,
                                IncludeInForwardBook = x.EventGolf.IncludeInForwardBook,
                                IncludeInCorrespondence = x.EventGolf.IncludeInCorrespondence,
                                EventGolf1 = x.EventGolf.EventGolf1 != null ? new EventGolf()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                Event = toEventModel.Event,
                                Time = x.EventGolf.EventGolf1.Time,
                                TeeID = x.EventGolf.EventGolf1.TeeID,
                                HoleID = x.EventGolf.EventGolf1.HoleID,
                                Slots = x.EventGolf.EventGolf1.Slots,
                                Notes = x.EventGolf.EventGolf1.Notes,
                                ShowInInvoice = x.EventGolf.EventGolf1.ShowInInvoice,
                                IncludeInForwardBook = x.EventGolf.EventGolf1.IncludeInForwardBook,
                                IncludeInCorrespondence = x.EventGolf.EventGolf1.IncludeInCorrespondence,
                                IsLinked = true
                            } : null
                            };

                            var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventGolf.ID).ToList();

                            if (products.Any())
                            {
                                products.ForEach(y =>
                                {
                                    var product = new EventBookedProduct()
                                    {
                                        ID = Guid.NewGuid(),
                                        EventID = toEventModel.Event.ID,
                                        ProductID = y.EventBookedProduct.ProductID,
                                        EventBookingItemID = golf.ID,
                                        Quantity = y.EventBookedProduct.Quantity,
                                        Price = y.EventBookedProduct.Price
                                    };

                                    var charge = new EventCharge()
                                    {
                                        ID = product.ID,
                                        EventID = toEventModel.Event.ID,
                                        ProductID = product.ProductID,
                                        Quantity = product.Quantity,
                                        Price = product.Price,
                                        ShowInInvoice = golf.ShowInInvoice
                                    };
                                    product.EventCharge = charge;

                                    _eventsDataUnit.EventBookedProductsRepository.Add(product);
                                    _eventsDataUnit.EventChargesRepository.Add(charge);
                                    toEventModel.EventBookedProducts.Add(new EventBookedProductModel(product));
                                    toEventModel.EventCharges.Add(new EventChargeModel(charge));
                                });
                            }

                            _eventsDataUnit.EventGolfsRepository.Add(golf);
                            toEventModel.EventGolfs.Add(new EventGolfModel(golf));
                        });
                    }

                    // Event Invoices
                    if (fromEvent.EventInvoices.Any())
                    {
                        fromEvent.EventInvoices.ForEach(x =>
                        {
                            var invoice = new EventInvoice()
                            {
                                ID = Guid.NewGuid(),
                                EventID = toEventModel.Event.ID,
                                Event = toEventModel.Event,
                                Notes = x.EventInvoice.Notes,
                                ShowInInvoice = x.EventInvoice.ShowInInvoice,
                                IncludeInForwardBook = x.EventInvoice.IncludeInForwardBook,
                                IncludeInCorrespondence = x.EventInvoice.IncludeInCorrespondence,
                            };

                            var products = fromEvent.EventBookedProducts.Where(y => y.EventBookedProduct.EventBookingItemID == x.EventInvoice.ID).ToList();

                            if (products.Any())
                            {
                                products.ForEach(y =>
                                {
                                    var product = new EventBookedProduct()
                                    {
                                        ID = Guid.NewGuid(),
                                        EventID = toEventModel.Event.ID,
                                        ProductID = y.EventBookedProduct.ProductID,
                                        EventBookingItemID = invoice.ID,
                                        Quantity = y.EventBookedProduct.Quantity,
                                        Price = y.EventBookedProduct.Price
                                    };

                                    var charge = new EventCharge()
                                    {
                                        ID = product.ID,
                                        EventID = toEventModel.Event.ID,
                                        ProductID = product.ProductID,
                                        Quantity = product.Quantity,
                                        Price = product.Price,
                                        ShowInInvoice = invoice.ShowInInvoice
                                    };
                                    product.EventCharge = charge;

                                    _eventsDataUnit.EventBookedProductsRepository.Add(product);
                                    _eventsDataUnit.EventChargesRepository.Add(charge);
                                    toEventModel.EventBookedProducts.Add(new EventBookedProductModel(product));
                                    toEventModel.EventCharges.Add(new EventChargeModel(charge));
                                });
                            }
                            _eventsDataUnit.EventInvoicesRepository.Add(invoice);
                            toEventModel.EventInvoices.Add(new EventInvoiceModel(invoice));
                        });
                    }

                    _eventsDataUnit.EventsRepository.DetectChanges();
                    toEventModel.RefreshItems();
                    RaisePropertyChanged("DisableParentWindow");
                    var bookingView = new BookingView(BookingViews.Event, toEventModel, true);
                    bookingView.ShowDialog();
                    RaisePropertyChanged("EnableParentWindow");

                    // Refresh grid if event was added
                    if (bookingView.DialogResult != null && bookingView.DialogResult == true)
                    {
                        var eventBookingView = bookingView.ViewModel.Content as EventBookingView;
                        _allEvents.Add(eventBookingView.ViewModel.Event);
                        _allEvents = new List<EventModel>(_allEvents.OrderBy(x => x.Date));
                        Events = new ObservableCollection<EventModel>(_allEvents);
                        UpdateEventsDataRange();
                        RefreshAppointments();
                    }
                    IsBusy = false;
                }
            }
        }
コード例 #6
0
        private void MapChangedDataAfterRefresh(EventCatering eventCateringOriginal, EventCatering eventCateringChanged)
        {
            eventCateringOriginal.Time = eventCateringChanged.Time;
            eventCateringOriginal.RoomID = eventCateringChanged.RoomID;
            eventCateringOriginal.StartTime = eventCateringChanged.StartTime;
            eventCateringOriginal.EndTime = eventCateringChanged.EndTime;
            eventCateringOriginal.Notes = eventCateringChanged.Notes;
            eventCateringOriginal.ShowInInvoice = eventCateringChanged.ShowInInvoice;
            eventCateringOriginal.IncludeInForwardBook = eventCateringChanged.IncludeInForwardBook;
            eventCateringOriginal.IncludeInCorrespondence = eventCateringChanged.IncludeInCorrespondence;
            eventCateringOriginal.IsSpecial = eventCateringChanged.IsSpecial;

        }