public AddAlternativeContactView(EventModel eventModel)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddAlternativeContactViewModel(eventModel);

            Owner = Application.Current.MainWindow;
        }
Example #2
0
        public AddInvoiceView(EventModel eventModel)
        {
            InitializeComponent();
            DataContext = _viewModel = new AddInvoiceViewModel(eventModel);

            Owner = Application.Current.MainWindow;
        }
Example #3
0
        public SendEventMailView(EventModel model, CorrespondenceModel correspondence = null)
        {
            InitializeComponent();

            //ClipboardEx.ClipboardHandlers.Clear();

            //ClipboardHandler clipboardHandlerRtf = new ClipboardHandler();
            //clipboardHandlerRtf.ClipboardDataFormat = DataFormats.Rtf;
            //clipboardHandlerRtf.DocumentFormatProvider = new RtfFormatProvider();

            //ClipboardHandler clipboardHandlerHtml = new ClipboardHandler();
            //clipboardHandlerHtml.ClipboardDataFormat = DataFormats.Html;
            //clipboardHandlerHtml.DocumentFormatProvider = new HtmlFormatProvider();

            //ClipboardHandler clipboardHandlerText = new ClipboardHandler();
            //clipboardHandlerText.ClipboardDataFormat = DataFormats.Text;
            //clipboardHandlerText.DocumentFormatProvider = new TxtFormatProvider();

            //ClipboardEx.ClipboardHandlers.Add(clipboardHandlerRtf);
            //ClipboardEx.ClipboardHandlers.Add(clipboardHandlerHtml);
            //ClipboardEx.ClipboardHandlers.Add(clipboardHandlerText);

            DataContext = ViewModel = new SendEventMailViewModel(model, correspondence);

            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;

            Loaded += OnSendEmailViewLoaded;
        }
Example #4
0
        public EventBookingView(EventModel eventModel, bool IsDuplicate=false)
        {
            InitializeComponent();
            DataContext = ViewModel = new EventBookingViewModel(eventModel,IsDuplicate);
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Loaded += OnEventBookingViewLoaded;
        }
Example #5
0
        public FromTemplateViewModel(EventModel eventModel)
        {
            _event = eventModel;
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventsDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();
            OKCommand = new RelayCommand(OKCommandExecuted, OKCommandCanExecute);

        }
Example #6
0
 public override void CopyFrom(IAppointment other)
 {
     var eventAppointment = other as EventAppointment;
     if (eventAppointment != null)
     {
         this.Event = eventAppointment.Event;
     }
     base.CopyFrom(other);
 }
Example #7
0
        public AddEventChargeView(EventModel eventModel, EventChargeModel charge = null)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddEventChargeViewModel(eventModel, charge);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddEventChargeViewLoaded;
        }
        public AddEventPaymentView(EventModel Event, EventPaymentModel model = null)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddEventPaymentViewModel(Event, model);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddEventPaymentViewLoaded;
        }
Example #9
0
        public FromTemplateView(EventModel eventModel)
        {
            InitializeComponent();
            DataContext = ViewModel = new FromTemplateViewModel(eventModel);

            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
            Owner = Application.Current.MainWindow;

            Loaded += FromTemplateView_Loaded;
        }
Example #10
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;
        }
        public AddEventInvoiceItemView(EventModel Event, EventInvoiceModel invoiceModel = null)
        {
            InitializeComponent();
            DataContext = _viewModel = new AddEventInvoiceItemViewModel(Event, invoiceModel);
            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;

            Loaded += OnAddEventInvoiceItemViewLoaded;
        }
Example #12
0
        public EventDetailsViewModel(EventModel model)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventsDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();
            _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>();

            EditEventCommand = new RelayCommand<EventModel>(EditEventCommandExecuted, EditEventCommandCanExecute);

            Event = model;
        }
Example #13
0
        public AddEventChargeViewModel(EventModel eventModel, EventChargeModel charge)
        {
            _event = eventModel;

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventsDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();

            SubmitCommand = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute);

            ProcessCharge(charge);
        }
        public AddEventGolfItemView(EventModel eventModel, EventGolfModel golfModel = null, System.Collections.Generic.List<EventGolfModel> alreadyBookedGolfs = null)
        {
            InitializeComponent();
            DataContext = _viewModel = new AddEventGolfItemViewModel(eventModel, golfModel, alreadyBookedGolfs);

            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;

            Loaded += OnAddEventGolfItemViewLoaded;
        }
        public AddEventReminderView(EventModel eventModel, EventReminderModel eventReminder = null)
        {
            InitializeComponent();
            if (eventReminder != null)
                this.Header = "Edit Event Reminder";
            DataContext = ViewModel = new AddEventReminderViewModel(eventModel, eventReminder);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddEventReminderViewLoaded;
        }
Example #16
0
        public AddNoteViewModel(EventModel eventModel, EventNoteModel noteModel)
        {
            _event = eventModel;

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventsDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();

            SubmitCommand = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute);
            CancelCommand = new RelayCommand(CancelCommandExecuted);

            ProcessNote(noteModel);
        }
Example #17
0
        public AddInvoiceViewModel(EventModel eventModel)
        {
            _event = eventModel;

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();

            GetInvoiceNumberCommand = new RelayCommand(GetInvoiceNumberCommandExecuted, GetInvoiceNumberCommandCanExecute);
            UndoGetInvoiceNumberCommand = new RelayCommand(UndoGetInvoiceNumberCommandExecuted, UndoGetInvoiceNumberCommandCanExecute);
            ShowInvoiceReportCommand = new RelayCommand(ShowInvoiceReportCommandExecuted, ShowInvoiceReportCommandCanExecute);

            Invoice = GetInvoice();
        }
        public AddEventReminderViewModel(EventModel eventModel, EventReminderModel eventReminderModel)
        {
            _event = eventModel;
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();

            CanEditEveryoneEventReminders = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_EVERYONE_FOLLOWUP_ALLOWED);
            CanEditOwnEventReminders = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_OWN_FOLLOWUP_ALLOWED);

            SubmitCommand = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute);
            CancelCommand = new RelayCommand(CancelCommandExecuted);

            ProcessEventReminder(eventReminderModel);
        }
Example #19
0
 public EventPaymentInvoiceModel(EventPayment payment, Event event_)
 {
     _eventPayment = payment;
     Event = new EventModel(event_);
 }
Example #20
0
 public EventPaymentInvoiceModel(Invoice invoice, Event event_)
 {
     _invoice = invoice;
     Event = new EventModel(event_);
 }
Example #21
0
        public async Task LoadLightEventDetails(EventModel model)
        {
            if (!model.EventItems.Any())
            {
                var products = await _eventsDataUnit.EventBookedProductsRepository.GetAllAsync(x => x.EventID == model.Event.ID);
                model.EventBookedProducts = new List<EventBookedProductModel>(products.Select(x => new EventBookedProductModel(x)));

                var caterings = await _eventsDataUnit.EventCateringsRepository.GetAllAsync(x => x.EventID == model.Event.ID);
                model.EventCaterings = new List<EventCateringModel>(caterings.Select(x => new EventCateringModel(x)));

                var rooms = await _eventsDataUnit.EventRoomsRepository.GetAllAsync(x => x.EventID == model.Event.ID);
                model.EventRooms = new List<EventRoomModel>(rooms.Select(x => new EventRoomModel(x)));

                var golfs = await _eventsDataUnit.EventGolfsRepository.GetAllAsync(x => x.EventID == model.Event.ID && x.IsLinked == false);
                model.EventGolfs = new List<EventGolfModel>(golfs.Select(x => new EventGolfModel(x)));

                var invoices = await _eventsDataUnit.EventInvoicesRepository.GetAllAsync(x => x.EventID == model.Event.ID);
                model.EventInvoices = new List<EventInvoiceModel>(invoices.Select(x => new EventInvoiceModel(x)));
            }
        }
Example #22
0
 public EventPaymentInvoiceModel(EventPayment payment, Event event_)
 {
     _eventPayment = payment;
     Event         = new EventModel(event_);
 }
        private void ProcessUpdates(EventModel model, List<EventUpdate> eventUpdates)
        {
            eventUpdates.ForEach(update =>
                {
                    model.EventUpdates.Insert(0, update);
                    _eventDataUnit.EventUpdatesRepository.Add(update);
                });

            model.EventUpdates = new ObservableCollection<EventUpdate>(model.EventUpdates.OrderByDescending(x => x.Date));
        }
Example #24
0
        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;
                }
            }
        }
Example #25
0
 private bool EditEventCommandCanExecute(EventModel arg)
 {
     return AccessService.Current.UserHasPermissions(Properties.Resources.PERMISSION_EDIT_EVENT_ALLOWED);
 }
Example #26
0
 private bool DeleteEventCommandCanExecute(EventModel eventModel)
 {
     return AccessService.Current.UserHasPermissions(Properties.Resources.PERMISSION_DELETE_EVENT_ALLOWED);
 }
Example #27
0
        private void EditEventCommandExecuted(EventModel item)
        {

            RaisePropertyChanged("DisableParentWindow");

            var bookingView = new BookingView(BookingViews.Event, item);

            bookingView.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (bookingView.DialogResult != null && bookingView.DialogResult == true)
            {
                item.Refresh();
                item.RefreshItems();
                RefreshAppointments();
            }
            else
            {
                item.Refresh();
            }

            UpdateEventsDataRange();

        }
Example #28
0
 public EventPaymentInvoiceModel(Invoice invoice, Event event_)
 {
     _invoice = invoice;
     Event    = new EventModel(event_);
 }
        public AddEventReminderViewModel(IEnumerable<EventModel> events, EventReminderModel eventReminderModel)
        {
            var Today = DateTime.Now;
            Events = events.Where(x => x.Date.Date > Today.Date).OrderBy(x => x.Date).ThenBy(x => x.Name).ToList();

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _eventDataUnit = dataUnitLocator.ResolveDataUnit<IEventDataUnit>();

            CanEditEveryoneEventReminders = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_EVERYONE_FOLLOWUP_ALLOWED);
            CanEditOwnEventReminders = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_OWN_FOLLOWUP_ALLOWED);

            SubmitCommand = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute);
            CancelCommand = new RelayCommand(CancelCommandExecuted);

            OpenEventCommand = new RelayCommand(OpenEventCommandExecute, OpenEventCommandCanExecute);
            if (eventReminderModel != null)
            {
                ProcessEventReminder(eventReminderModel);
                SelectedEvent = Events.FirstOrDefault(x => x.Event == eventReminderModel.EventReminder.Event);
                _originalEvent = SelectedEvent.Clone();
            }
            else
            {
                EventReminder = GetEventReminderWithoutEvent();
                EventReminder.PropertyChanged += EventReminderOnPropertyChanged;
            }

        }
        private async void SubmitCommandExecuted()
        {
            if (!IsEditMode)
            {
                if (AreEventsVisible)
                {
                    EventReminder.EventReminder.EventID = SelectedEvent.Event.ID;
                    EventReminder.EventReminder.Event = SelectedEvent.Event;
                }
                else
                    _event.EventReminders.Add(EventReminder);
                _eventDataUnit.EventRemindersRepository.Add(EventReminder.EventReminder);

                var primaryContact = EventReminder.EventReminder.Event != null ? EventReminder.EventReminder.Event.Contact == null ? String.Empty : "Primary Contact: " + EventReminder.EventReminder.Event.Contact.FirstName + " "
                    + EventReminder.EventReminder.Event.Contact.LastName : String.Empty;

                var msg = "Event-Reminder" + "\n" + "Created by " + EventReminder.CreatedByUser.FirstName + " " +
                          EventReminder.CreatedByUser.LastName + " at " + DateTime.Now + "\n" +
                          "Event Name: " + EventReminder.EventName + "\n" + primaryContact + "\n" + EventReminder.WhatToDo;
                var email = new CorrespondenceModel(new Corresponcence()
                {
                    ID = Guid.NewGuid(),
                    Date = DateTime.Now,
                    FromAddress = EventReminder.CreatedByUser.EmailAddress,
                    ToAddress = EventReminder.AssignedToUser.EmailAddress,
                    Subject = "Event-Reminder",
                    Message = msg,
                });

                await EmailService.SendEmail(email, null, null);
                if (AreEventsVisible)
                {
                    _originalEvent = SelectedEvent.Clone();
                    SelectedEvent.EventReminders.Add(EventReminder);
                    var eventUpdates = LoggingService.FindDifference(_originalEvent, SelectedEvent);
                    if (!SelectedEvent.EventUpdates.Any())
                    {
                        var updates = await _eventDataUnit.EventUpdatesRepository.GetAllAsync(x => x.EventID == SelectedEvent.Event.ID);
                        SelectedEvent.EventUpdates = new ObservableCollection<EventUpdate>(updates.OrderByDescending(x => x.Date));
                    }
                    ProcessUpdates(SelectedEvent, eventUpdates);

                    await _eventDataUnit.SaveChanges();
                }
            }
            else
            {
                _eventReminder.AssignedToUser = AssignedToUser;
                _eventReminder.EventReminder.AssignedToUserID = AssignedToUser.ID;
                EventReminder.EventReminder.LastEditDate = DateTime.Now;
                if (AreEventsVisible)
                {
                    if (_originalEvent.Event.ID != _selectedEvent.Event.ID)
                    {
                        _originalEvent = _selectedEvent.Clone();
                    }

                    EventReminder.EventReminder.Event = SelectedEvent.Event;
                    SelectedEvent.EventReminders.Where(x => x.EventReminder == _eventReminder.EventReminder).FirstOrDefault().AssignedToUser = AssignedToUser;
                    var eventUpdates = LoggingService.FindDifference(_originalEvent, SelectedEvent);
                    if (!SelectedEvent.EventUpdates.Any())
                    {
                        var updates = await _eventDataUnit.EventUpdatesRepository.GetAllAsync(x => x.EventID == SelectedEvent.Event.ID);
                        SelectedEvent.EventUpdates = new ObservableCollection<EventUpdate>(updates.OrderByDescending(x => x.Date));
                    }
                    ProcessUpdates(_selectedEvent, eventUpdates);

                    await _eventDataUnit.SaveChanges();
                }
                else
                    _eventDataUnit.EventRemindersRepository.SetEntityModified(_eventReminder.EventReminder);
                EventReminder.Refresh();
            }

        }
Example #31
0
 public EventEnquiryModel(EventModel model)
 {
     _event = model;
 }
        public AddEventInvoiceItemViewModel(EventModel eventModel, EventInvoiceModel invoiceModel)
        {
            _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);

            ProcessEventInvoice(invoiceModel);
        }
Example #33
0
        private void DeleteEventCommandExecuted(EventModel eventModel)
        {
            if (eventModel == null) return;

            bool? dialogResult = null;
            string confirmText = Properties.Resources.MESSAGE_ASK_BEFORE_DELETING_ITEM;

            RaisePropertyChanged("DisableParentWindow");

            RadWindow.Confirm(new DialogParameters()
            {
                Owner = Application.Current.MainWindow,
                Content = confirmText,
                Closed = (sender, args) => { dialogResult = args.DialogResult; }
            });

            RaisePropertyChanged("EnableParentWindow");

            if (dialogResult != true) return;

            eventModel.Event.IsDeleted = true;

            var update = new EventUpdate()
            {
                ID = Guid.NewGuid(),
                Date = DateTime.Now,
                Event = eventModel.Event,
                UserID = AccessService.Current.User.ID,
                Message = string.Format("Event {0} was deleted", eventModel.Name),
                OldValue = eventModel.Name,
                NewValue = null,
                ItemId = eventModel.Event.ID,
                ItemType = "Event",
                Field = "Event",
                Action = UpdateAction.Removed
            };

            _eventsDataUnit.EventUpdatesRepository.Add(update);

            _eventsDataUnit.SaveChanges();

            _allEvents.Remove(eventModel);
            Events.Remove(eventModel);
            SelectedEvent = null;

            RefreshAppointments();
        }