Example #1
0
        private void OpenEnquiryCommandExecute()
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new NewEnquiryView(Event.Enquiry);
            window.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");
        }
Example #2
0
        private async void OpenEventCommandExecute(EventEnquiryModel model)
        {
            RaisePropertyChanged("DisableParentWindow");

            if (model.Event != null)
            {
                var window = new EventDetailsView(model.Event);
                window.ShowDialog();
            }
            else
            {
                var enquiries = await _crmDataUnit.EnquiriesRepository.GetLightEnquiriesAsync(x => x.ID == model.Enquiry.Enquiry.ID);
                var enquiryModel = new EnquiryModel(enquiries.FirstOrDefault());

                var window = new NewEnquiryView(enquiryModel);
                window.ShowDialog();
            }

            RaisePropertyChanged("EnableParentWindow");

        }
Example #3
0
        private void EditEnquiryCommandExecute(EnquiryModel item)
        {

            RaisePropertyChanged("DisableParentWindow");
            var currentEnquiry = item.Clone();
            item.Refresh();
            var window = new NewEnquiryView(item);
            window.ShowDialog();
            RaisePropertyChanged("EnableParentWindow");
            if (window.DialogResult == null || window.DialogResult != true)
            {
                item.Refresh();
                return;
            }
            item.Refresh();
            var viewModel = window.DataContext as NewEnquiryViewModel;
            bool activityChanged = viewModel.ActivityChanged;
            bool followUpsChanged = viewModel.FoolowUpsChanged;

            //  var diff = LoggingService.FindDifference(currentEnquiry, item, out activityChanged, out followUpsChanged);
            //  ProcessUpdates(item, diff);

            if (activityChanged)
            {
                _allActivities.RemoveAll(x => x.Activity.EnquiryID == item.Enquiry.ID);

                foreach (var activity in window.ViewModel.Enquiry.Activities)
                {
                    _allActivities.Add(activity);
                }
                Activities = new ObservableCollection<ActivityModel>(_allActivities);
            }
            else
            {
                Activities.ForEach(x => x.Refresh());
            }
            if (followUpsChanged)
            {
                _allFollowUps.RemoveAll(
                    x => x.FollowUp.EnquiryID != null && (Guid)x.FollowUp.EnquiryID == item.Enquiry.ID);

                _allFollowUps.RemoveAll(x => x.TakenByUser == null);

                foreach (var followUp in window.ViewModel.Enquiry.FollowUps)
                {
                    SetFollowUpPriority(followUp);
                    _allFollowUps.Add(followUp);
                }

                FollowUps = new ObservableCollection<FollowUpModel>(_allFollowUps);
            }
            else
            {
                FollowUps.ForEach(x => x.Refresh());
            }
        }
Example #4
0
        private void OpenEnquiryCommandExecute()
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new NewEnquiryView(new EnquiryModel(FollowUp.FollowUp.Enquiry));
            window.ShowDialog();
            if (window.DialogResult != null && window.DialogResult.Value)
            {
                var isToDo = _followUp.IsToDo;
                var IsCurrentFollowUpDeleted = true;

                if (window.ViewModel.Enquiry.FollowUps.Where(followUp => followUp.FollowUp.ID == _followUp.FollowUp.ID).Count() > 0)
                    IsCurrentFollowUpDeleted = false;

                if (IsCurrentFollowUpDeleted)
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        var currentPopUp = Application.Current.MainWindow;
                        var viewModel = currentPopUp.DataContext as MainWindowModel;
                        var workspaceView = viewModel.WindowContent as WorkspaceView;
                        var tile = workspaceView.RootTileView.MaximizedItem as Tile;
                        if (tile.Name == "CRM")
                        {
                            var crmview = tile.Content as CRMView;
                            var crmvm = crmview.DataContext as CRMViewModel;

                            if (isToDo)
                                crmvm.ReloadFollowUps();
                            else
                            {
                                crmvm.ReloadFollowUpsAndEnquiries();
                            }
                        }
                    }));
                    RaisePropertyChanged("CloseParentWindow");
                }
                else
                {
                    RaisePropertyChanged("EnableParentWindow");
                }
            }
            else
            {
                RaisePropertyChanged("EnableParentWindow");
            }
        }
Example #5
0
        private void AddEnquiryCommandExecuted()
        {
            RaisePropertyChanged("DisableParentWindow");

            var window = new NewEnquiryView();
            window.ShowDialog();

            RaisePropertyChanged("EnableParentWindow");

            if (window.DialogResult != null && window.DialogResult == true)
            {
                _allEnquiries.Add(window.ViewModel.Enquiry);
                Enquiries = new ObservableCollection<EnquiryModel>(_allEnquiries.OrderBy(x => x.CreationDate));

                if (window.ViewModel.Enquiry.Activities.Any())
                {
                    foreach (var activity in window.ViewModel.Enquiry.Activities)
                    {
                        _allActivities.Add(activity);
                    }
                    Activities = new ObservableCollection<ActivityModel>(_allActivities);
                }

                if (window.ViewModel.Enquiry.FollowUps.Any())
                {
                    foreach (var followUp in window.ViewModel.Enquiry.FollowUps)
                    {
                        SetFollowUpPriority(followUp);
                        _allFollowUps.Add(followUp);
                    }
                    FollowUps = new ObservableCollection<FollowUpModel>(_allFollowUps);
                }
            }
        }