Beispiel #1
0
        public AddNoteView(EnquiryModel enquiryModel, EnquiryNoteModel note = null)
        {
            InitializeComponent();
            DataContext = _viewModel = new AddEnquiryNoteViewModel(enquiryModel, note);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddNoteViewLoaded;
        }
Beispiel #2
0
        private EnquiryNoteModel GetNote()
        {
            var noteModel = new EnquiryNoteModel(new EnquiryNote()
            {
                ID      = Guid.NewGuid(),
                Enquiry = _enquiry.Enquiry,
                Date    = DateTime.Now,
            });

            return(noteModel);
        }
Beispiel #3
0
        private void ProcessNote(EnquiryNoteModel noteModel)
        {
            _isEditMode = (noteModel != null);

            EnquiryNote = (_isEditMode) ? noteModel : GetNote();
            if (_isEditMode)
            {
                _originalEnquiryNote = EnquiryNote.Clone();
            }
            EnquiryNote.PropertyChanged += EnquiryNoteOnPropertyChanged;
        }
Beispiel #4
0
        public AddEnquiryNoteViewModel(EnquiryModel enquiryModel, EnquiryNoteModel noteModel)
        {
            _enquiry = enquiryModel;
            var dataUnitLocator = ContainerAccessor.Instance.GetContainer().Resolve <IDataUnitLocator>();

            _crmDataUnit = dataUnitLocator.ResolveDataUnit <ICrmDataUnit>();

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

            ProcessNote(noteModel);
        }
Beispiel #5
0
        private void EditNoteCommandExecuted(EnquiryNoteModel item)
        {
            RaisePropertyChanged("DisableParentWindow");
            _originalEventNote = item.Clone();
            var window = new AddNoteView(Enquiry, item);

            window.ShowDialog();
            if (window.DialogResult != null && !window.DialogResult.Value)
            {
                item.EnquiryNote.Note = _originalEventNote.EnquiryNote.Note;
                item.Refresh();
            }

            RaisePropertyChanged("EnableParentWindow");
        }
Beispiel #6
0
 private void DeleteNoteCommandExecuted(EnquiryNoteModel item)
 {
     Enquiry.EnquiryNotes.Remove(item);
     _crmDataUnit.EnquiryNotesRepository.Delete(item.EnquiryNote);
 }