Exemplo n.º 1
0
        public SnoozeViewModel(FollowUpModel followUpModel)
        {
            FollowUp = followUpModel;

            OKCommand = new RelayCommand(OKCommandExecute, OKCommandCanExecute);
            CancelCommand = new RelayCommand(CancelCommandExecute);
        }
Exemplo n.º 2
0
        public AddFollowUpView(List<EnquiryModel> enquiries, FollowUpModel followUp = null)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddFollowUpViewModel(enquiries, followUp);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddFollowUpViewLoaded;
        }
Exemplo n.º 3
0
        public AddFollowUpView(EnquiryModel enquiryModel, bool addToActivity, FollowUpModel followUp = null)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddFollowUpViewModel(enquiryModel, addToActivity, followUp);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddFollowUpViewLoaded;
        }
Exemplo n.º 4
0
        public FollowUpPopUp(FollowUpModel followUp)
        {
            InitializeComponent();
            DataContext = _viewModel = new FollowUpPopUpViewModel(followUp);

            _viewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;
            Loaded += OnFollowUpPopUpViewLoaded;
        }
Exemplo n.º 5
0
        public AddFollowUpView(FollowUpModel followUp = null)
        {
            InitializeComponent();
            DataContext = ViewModel = new AddFollowUpViewModel(followUp);

            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            Owner = Application.Current.MainWindow;
            Header = "Add TO DO";
            Loaded += OnAddFollowUpViewLoaded;
        }
Exemplo n.º 6
0
        public ActivityModel(Activity activity)
        {
            _activity = activity;

            LoadedTime = DateTime.Now;

            if (_activity.FollowUp != null)
            {
                _followUp = new FollowUpModel(_activity.FollowUp);
            }
        }
Exemplo n.º 7
0
        public FollowUpPopUpViewModel(FollowUpModel followUpModel)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();

            FollowUp = followUpModel;

            SnoozeCommand = new RelayCommand(SnoozeCommandExecute);
            OpenEnquiryCommand = new RelayCommand(OpenEnquiryCommandExecute, OpenEnquiryCommandCanExecute);
            DeleteFollowUpCommand = new RelayCommand(DeleteFollowUpCommandExecute);
        }
Exemplo n.º 8
0
        public ActivityModel(Activity activity)
        {
            _activity = activity;

            LoadedTime = DateTime.Now;

            if (_activity.FollowUp != null)
                _followUp = new FollowUpModel(_activity.FollowUp);
        }
Exemplo n.º 9
0
 private void DeleteFollowUpCommandExecuted(FollowUpModel item)
 {
     Activity.FollowUp = null;
     _crmDataUnit.FollowUpsRepository.Delete(item.FollowUp);
     RaisePropertyChanged(() => HasActivityFollowUp);
 }
Exemplo n.º 10
0
        private void EditFollowUpCommandExecuted(FollowUpModel item)
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new AddFollowUpView(_enquiry, true, item);
            window.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");
        }
Exemplo n.º 11
0
        private void ProcessFollowUp(FollowUpModel followUpModel)
        {
            _isEditMode = (followUpModel != null);

            if (_isEditMode)
            {
                TakenByUser = followUpModel.TakenByUser;
                AssignedToUser = followUpModel.AssignedToUser;
            }
            FollowUp = (_isEditMode) ? followUpModel : GetFollowUp();
            FollowUp.PropertyChanged += FollowUpOnPropertyChanged;
        }
Exemplo n.º 12
0
        private void DeleteFollowUpCommandExecuted(FollowUpModel item)
        {
            if (Enquiry.Activities.Any(x => x.FollowUp == item))
            {
                Enquiry.Activities.First(x => x.FollowUp == item).FollowUp = null;
            }

            Enquiry.FollowUps.Remove(item);
            _crmDataUnit.FollowUpsRepository.Delete(item.FollowUp);
        }
Exemplo n.º 13
0
 private void EditFollowUpCommandExecuted(FollowUpModel item)
 {
     RaisePropertyChanged("DisableParentWindow");
     _originalFollowUp = item.Clone();
     var window = new AddFollowUpView(Enquiry, false, item);
     window.ShowDialog();
     if (window.DialogResult != null && !window.DialogResult.Value)
     {
         item.FollowUp.DateDue = _originalFollowUp.FollowUp.DateDue;
         item.FollowUp.WhatToDo = _originalFollowUp.FollowUp.WhatToDo;
         item.FollowUp.UserDueToDoID = _originalFollowUp.FollowUp.UserDueToDoID;
         item.Refresh();
     }
     RaisePropertyChanged("EnableParentWindow");
 }
Exemplo n.º 14
0
        public async void LoadData()
        {
            IsBusy = true;

            var users = await _crmDataUnit.UsersRepository.GetUsersAsync();
            Users = new ObservableCollection<User>(users);

            OnLoadCurrentUser();

            if (_isEditMode)
            {
                var desiredFollowUp = await _crmDataUnit.FollowUpsRepository.GetUpdatedFollowUp(_followUp.FollowUp.ID);
                // Check if we have new changes
                if (desiredFollowUp != null && desiredFollowUp.LastEditDate != null && _followUp.LoadedTime < desiredFollowUp.LastEditDate)
                {
                    FollowUp = new FollowUpModel(desiredFollowUp);

                    AssignedToUser = desiredFollowUp.User1;
                    // _forceRefreshActivityData = true;
                }
            }

            IsBusy = false;
        }
Exemplo n.º 15
0
        private FollowUpModel GetFollowUpWithoutEnquiry()
        {
            var followUpModel = new FollowUpModel(new Data.Model.FollowUp()
            {
                ID = Guid.NewGuid(),
                DateDue = DateTime.Now
            });

            return followUpModel;
        }
Exemplo n.º 16
0
        private FollowUpModel GetFollowUp()
        {
            var followUpModel = new FollowUpModel(new Data.Model.FollowUp()
            {
                ID = Guid.NewGuid(),
                EnquiryID = _enquiry.Enquiry.ID,
                DateDue = DateTime.Now
            });

            //  followUpModel.FollowUp.Enquiry = _enquiry.Enquiry;

            return followUpModel;
        }
Exemplo n.º 17
0
        public AddFollowUpViewModel(EnquiryModel enquiryModel, bool addToActivity, FollowUpModel followUpModel)
        {
            _enquiry = enquiryModel;

            _addToActivity = addToActivity;
            IsFromCRM = false;

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();

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

            ProcessFollowUp(followUpModel);
        }
Exemplo n.º 18
0
 private void SetFollowUpPriority(FollowUpModel followUp)
 {
     var statuses = FollowUpStatuses.OrderByDescending(x => x.NumberOfDays);
     foreach (var status in statuses)
     {
         if ((followUp.DateDue.Date - DateTime.Today).TotalDays >= status.NumberOfDays)
         {
             followUp.Priority = status.Priority;
             break;
         }
     }
     if (followUp.Priority == 0)
         followUp.Priority = statuses.Last().Priority;
 }
Exemplo n.º 19
0
        public AddFollowUpViewModel(IEnumerable<EnquiryModel> enquiries, FollowUpModel followUpModel)
        {
            Enquiries = enquiries.OrderBy(x => x.EventType.Name).ThenByDescending(x => x.CreationDate).ToList();

            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();

            CanEditEveryoneFollowUps = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_EVERYONE_FOLLOWUP_ALLOWED);
            CanEditOwnFollowUps = AccessService.Current.UserHasPermissions(Resources.PERMISSION_EDIT_OWN_FOLLOWUP_ALLOWED);
            IsFromCRM = true;

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

            OpenEnquiryCommand = new RelayCommand(OpenEnquiryCommandExecute, OpenEnquiryCommandCanExecute);

            if (followUpModel != null)
            {
                ProcessFollowUp(followUpModel);
                SelectedEnquiry = Enquiries.FirstOrDefault(x => x.Enquiry == followUpModel.FollowUp.Enquiry);
                _originalEnquiry = SelectedEnquiry.Clone();
            }
            else
            {
                FollowUp = GetFollowUpWithoutEnquiry();
                FollowUp.PropertyChanged += FollowUpOnPropertyChanged;
            }

        }
Exemplo n.º 20
0
        private void EditFollowUpCommandExecute(FollowUpModel item)
        {
            RaisePropertyChanged("DisableParentWindow");

            AddFollowUpView window;

            if (item.IsToDo)
            {
                window = new AddFollowUpView(item);
                window.ShowDialog();
            }
            else
            {
                window = new AddFollowUpView(_allEnquiries, item);
                window.ShowDialog();
            }

            RaisePropertyChanged("EnableParentWindow");

            item.Refresh();

            if (window.DialogResult == null || window.DialogResult != true) return;

            ReloadEnquiries();
        }
Exemplo n.º 21
0
        public AddFollowUpViewModel(FollowUpModel followUpModel)
        {
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve<IDataUnitLocator>();
            _crmDataUnit = dataUnitLocator.ResolveDataUnit<ICrmDataUnit>();

            SubmitCommand = new RelayCommand(SubmitCommandExecuted, SubmitCommandCanExecute);
            CancelCommand = new RelayCommand(CancelCommandExecuted);
            IsFromCRM = false;
            _isToDo = true;

            if (followUpModel != null)
            {
                ProcessFollowUp(followUpModel);
            }
            else
            {
                FollowUp = GetFollowUpWithoutEnquiry();
                FollowUp.PropertyChanged += FollowUpOnPropertyChanged;
            }
        }