public SnoozeViewModel(FollowUpModel followUpModel) { FollowUp = followUpModel; OKCommand = new RelayCommand(OKCommandExecute, OKCommandCanExecute); CancelCommand = new RelayCommand(CancelCommandExecute); }
public AddFollowUpView(List<EnquiryModel> enquiries, FollowUpModel followUp = null) { InitializeComponent(); DataContext = ViewModel = new AddFollowUpViewModel(enquiries, followUp); Owner = Application.Current.MainWindow; Loaded += OnAddFollowUpViewLoaded; }
public AddFollowUpView(EnquiryModel enquiryModel, bool addToActivity, FollowUpModel followUp = null) { InitializeComponent(); DataContext = ViewModel = new AddFollowUpViewModel(enquiryModel, addToActivity, followUp); Owner = Application.Current.MainWindow; Loaded += OnAddFollowUpViewLoaded; }
public FollowUpPopUp(FollowUpModel followUp) { InitializeComponent(); DataContext = _viewModel = new FollowUpPopUpViewModel(followUp); _viewModel.PropertyChanged += ViewModelOnPropertyChanged; Owner = Application.Current.MainWindow; Loaded += OnFollowUpPopUpViewLoaded; }
public AddFollowUpView(FollowUpModel followUp = null) { InitializeComponent(); DataContext = ViewModel = new AddFollowUpViewModel(followUp); ViewModel.PropertyChanged += ViewModelOnPropertyChanged; Owner = Application.Current.MainWindow; Header = "Add TO DO"; Loaded += OnAddFollowUpViewLoaded; }
public ActivityModel(Activity activity) { _activity = activity; LoadedTime = DateTime.Now; if (_activity.FollowUp != null) { _followUp = new FollowUpModel(_activity.FollowUp); } }
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); }
public ActivityModel(Activity activity) { _activity = activity; LoadedTime = DateTime.Now; if (_activity.FollowUp != null) _followUp = new FollowUpModel(_activity.FollowUp); }
private void DeleteFollowUpCommandExecuted(FollowUpModel item) { Activity.FollowUp = null; _crmDataUnit.FollowUpsRepository.Delete(item.FollowUp); RaisePropertyChanged(() => HasActivityFollowUp); }
private void EditFollowUpCommandExecuted(FollowUpModel item) { RaisePropertyChanged("DisableParentWindow"); var window = new AddFollowUpView(_enquiry, true, item); window.ShowDialog(); RaisePropertyChanged("EnableParentWindow"); }
private void ProcessFollowUp(FollowUpModel followUpModel) { _isEditMode = (followUpModel != null); if (_isEditMode) { TakenByUser = followUpModel.TakenByUser; AssignedToUser = followUpModel.AssignedToUser; } FollowUp = (_isEditMode) ? followUpModel : GetFollowUp(); FollowUp.PropertyChanged += FollowUpOnPropertyChanged; }
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); }
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"); }
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; }
private FollowUpModel GetFollowUpWithoutEnquiry() { var followUpModel = new FollowUpModel(new Data.Model.FollowUp() { ID = Guid.NewGuid(), DateDue = DateTime.Now }); return followUpModel; }
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; }
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); }
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; }
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; } }
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(); }
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; } }