public CorrespondenceView(ContactModel model,string sample)
        {
            InitializeComponent();
            DataContext = _viewModel = new CorrespondenceViewModel(model,sample);

            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Loaded += OnCorrespondenceViewLoaded;
        }
Beispiel #2
0
        public ActivityView(ContactModel model)
        {
            InitializeComponent();
            DataContext = _viewModel = new ActivityViewModel(model);

            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Loaded += OnActivityViewLoaded;
        }
Beispiel #3
0
        public ActivityViewModel(ContactModel model)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>();
            _crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();

            _contactModel = model;

            OpenEventCommand = new RelayCommand<EventEnquiryModel>(OpenEventCommandExecute);
        }
Beispiel #4
0
        public AddContactView(ContactModel model = null, bool isFromMembership = false)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddContactViewModel(model, isFromMembership);
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;

            Loaded += OnAddContactViewLoaded;
        }
        public ContactDetailsViewModel(ContactModel model, bool isFromMembership, MemberModel member)
        {
            IsFromMembership = isFromMembership;

            if (member != null)
            {
                _originalMember = member.Clone();
                Member = member;
            }

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            if (IsFromMembership)
                _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>();
            else
                _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>();

            SaveChangesCommand = new RelayCommand(SaveChangesCommandExecute, SaveChangesCommandCanExecute);

            if (IsFromMembership)
                CanEdit = AccessService.Current.UserHasPermissions(Resources.PERMISSION_MEMBERSHIP_EDIT_CONTACT_ALLOWED);
            else
                CanEdit = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_CONTACT_ALLOWED);

            if (IsFromMembership)
                ProcessContact(Member.Contact);
            else
                ProcessContact(model);
        }
 private void ProcessContact(ContactModel model)
 {
     ContactModel = model;
     ContactModel.PropertyChanged += ContactModelOnPropertyChanged;
 }
Beispiel #7
0
        public EventModel(Event @event, bool isFromReports = false, RoundAgeReportFilter filterValue = RoundAgeReportFilter.None, bool isActualEvent = true)
        {
            _event = @event;

            _eventType = _event.EventType;
            _eventStatus = _event.EventStatus;

            EventUpdates = new ObservableCollection<EventUpdate>();
            EventItems = new ObservableCollection<EventItemModel>();
            EventNotes = new ObservableCollection<EventNoteModel>();
            EventCharges = new ObservableCollection<EventChargeModel>();
            EventItemsWithNotes = new ObservableCollection<EventItemModel>();
            EventContacts = new ObservableCollection<EventContact>();
            Correspondences = new ObservableCollection<CorrespondenceModel>();
            Reports = new ObservableCollection<ReportModel>();
            EventReminders = new ObservableCollection<EventReminderModel>();

            if (isFromReports)
            {
                EventPayments = new ObservableCollection<EventPaymentModel>(_event.EventPayments.Select(x => new EventPaymentModel(x)));
                EventCaterings = new List<EventCateringModel>(_event.EventCaterings.Select(x => new EventCateringModel(x)));
                EventGolfs = new List<EventGolfModel>(_event.EventGolfs.Where(eventGolf => !eventGolf.IsLinked).Select(x => new EventGolfModel(x)));
                EventRooms = new List<EventRoomModel>(_event.EventRooms.Select(x => new EventRoomModel(x)));
                EventInvoices = new List<EventInvoiceModel>(_event.EventInvoices.Select(x => new EventInvoiceModel(x)));
                EventBookedProducts = new List<EventBookedProductModel>(_event.EventBookedProducts.Select(x => new EventBookedProductModel(x)));
                EventNotes = new ObservableCollection<EventNoteModel>(_event.EventNotes.Select(x => new EventNoteModel(x)));

                SetEventPriceForReports(filterValue);
                UpdatePaymentDetails();
                Days = DateTime.Now - Event.Date;
            }
            else
            {
                EventPayments = new ObservableCollection<EventPaymentModel>();
                EventCaterings = new List<EventCateringModel>();
                EventRooms = new List<EventRoomModel>();
                EventGolfs = new List<EventGolfModel>();
                EventInvoices = new List<EventInvoiceModel>();
                EventBookedProducts = new List<EventBookedProductModel>();
            }
            Documents = new List<Document>();

            if (_event.Contact != null)
                PrimaryContact = new ContactModel(_event.Contact);

            LoadedTime = DateTime.Now;

            RefreshChanges();

            IsActualEvent = isActualEvent;
            IsGroupDateVisible = true;
        }
 private void ShowSelectedContactTabs(ContactModel model)
 {
     if (model != null)
     {
         if (CanViewContactDetails)
             ContactDetailsContent = new ContactDetailsView(model);
         if (CanViewCorrespondence)
             CorrespondenceContent = new CorrespondenceView(model,"Contact");
         if (CanViewActivity)
             ActivityContent = new ActivityView(model);
         if (CanViewAccounts)
             AccountsContent = new AccountsView(model);
     }
 }
Beispiel #9
0
 public AccountsView(ContactModel model)
 {
     InitializeComponent();
     DataContext = _viewModel = new AccountsViewModel(model);
     Loaded += OnAccountsViewLoaded;
 }
Beispiel #10
0
        private void EditContactCommandExecuted(ContactModel model)
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new AddContactView(model, IsFromMembership);
            window.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");


            if (window.DialogResult != null && window.DialogResult == true)
            {
                if (IsFromMembership)
                    _membershipDataUnit.ContactsRepository.RefreshContact();
                else
                    _contactsDataUnit.ContactsRepository.RefreshContact();
            }
        }
Beispiel #11
0
 private void ProcessContact(ContactModel model)
 {
     _isEditMode = (model != null);
     ContactModel = model ?? GetContact();
     if (_isEditMode)
         _originalContactModel = ContactModel.Clone();
     ContactModel.PropertyChanged += ContactModelOnPropertyChanged;
 }
Beispiel #12
0
        public AddContactViewModel(ContactModel model, bool isFromMembership)
        {
            IsFromMembership = isFromMembership;
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            if (IsFromMembership)
                _membershipDataUnit = dataUnitLocator.ResolveDataUnit<IMembershipDataUnit>();
            else
                _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>();

            OkCommand = new RelayCommand(OkCommandExecuted, OkCommandCanExecute);
            CancelContactCommand = new RelayCommand(CancelContactCommandExecuted);

            ProcessContact(model);
        }
        public CorrespondenceViewModel(ContactModel model,string sample)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>();
            this.view = sample;
            _contactModel = model;

            _startDate = DateTime.Today.AddDays(-1);
            _endDate = DateTime.Today.AddDays(1);

            OpenEmailCommand = new RelayCommand<CorrespondenceModel>(OpenEmailCommandExecute);
        }
Beispiel #14
0
        public AccountsViewModel(ContactModel model)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _contactsDataUnit = dataUnitLocator.ResolveDataUnit<IContactsDataUnit>();

            _contactModel = model;

            OpenInvoiceCommand = new RelayCommand<EventPaymentInvoiceModel>(OpenInvoiceCommandExecute);
        }
Beispiel #15
0
        public MemberModel(Member member)
        {
            _member = member;

            MembershipUpdates = new ObservableCollection<MembershipUpdate>();

            if (_member != null)
            {
                if (_member.Contact != null) _contact = new ContactModel(_member.Contact);

                StartDate = _member.StartDate == default(DateTime) ? (DateTime?)null : Convert.ToDateTime(_member.StartDate);

                RenewalDate = _member.RenewalDate == default(DateTime) ? (DateTime?)null : Convert.ToDateTime(_member.RenewalDate);

                MemberNotes = new ObservableCollection<MemberNoteModel>(_member.MemberNotes.OrderByDescending(x => x.CreationDate).Select(x => new MemberNoteModel(x)));
            }
            else
                MemberNotes = new ObservableCollection<MemberNoteModel>();

        }
Beispiel #16
0
        private async void SetContactToEnquiry(ContactModel contact)
        {
            // Selected contact use ContactDataUnit so we need to get the same object but from EventDataUnit
            var contacts = await _eventsDataUnit.ContactsRepository.GetAllAsync(x => x.ID == contact.Contact.ID);

            Application.Current.Dispatcher.BeginInvoke(
                new Action(() => { Event.PrimaryContact = new ContactModel(contacts.FirstOrDefault()); }));
        }
Beispiel #17
0
        private async void SetContactToEnquiry(ContactModel model)
        {
            // Selected contact use ContactDataUnit so we need to get tha same object but from CrmDataUnit
            var contacts = await _crmDataUnit.ContactsRepository.GetAllAsync(x => x.ID == model.Contact.ID);

            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                Enquiry.PrimaryContact = new ContactModel(contacts.FirstOrDefault());
                //_enquiry.Enquiry.Contact = contacts.FirstOrDefault();    //Primary Contact issue
            }));
        }
 public ContactDetailsView(ContactModel model, bool isFromMembership = false, MemberModel member = null)
 {
     InitializeComponent();
     DataContext = _viewModel = new ContactDetailsViewModel(model, isFromMembership, member);
     Loaded += OnContactDetailsViewLoaded;
 }
Beispiel #19
0
        public CorrespondenceModel(Corresponcence correspondence)
        {
            _correspondence = correspondence;

            if (correspondence.CorresponcenceType != null)
                _corresponcenceType = _correspondence.CorresponcenceType;
            if (correspondence.Contact != null)
                _contactTo = new ContactModel(correspondence.Contact);

            Documents = new ObservableCollection<Document>();
        }