示例#1
0
        private void ProcessNote(EnquiryNoteModel noteModel)
        {
            _isEditMode = (noteModel != null);

            EnquiryNote = (_isEditMode) ? noteModel : GetNote();
            if (_isEditMode)
                _originalEnquiryNote = EnquiryNote.Clone();
            EnquiryNote.PropertyChanged += EnquiryNoteOnPropertyChanged;
        }
示例#2
0
        public AddNoteView(EnquiryModel enquiryModel, EnquiryNoteModel note = null)
        {
            InitializeComponent();
            DataContext = _viewModel = new AddEnquiryNoteViewModel(enquiryModel, note);

            Owner = Application.Current.MainWindow;

            Loaded += OnAddNoteViewLoaded;
        }
示例#3
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);
        }
示例#4
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");
        }
示例#5
0
        private EnquiryNoteModel GetNote()
        {
            var noteModel = new EnquiryNoteModel(new EnquiryNote()
            {
                ID = Guid.NewGuid(),
                Enquiry = _enquiry.Enquiry,
                Date = DateTime.Now,
            });

            return noteModel;
        }
示例#6
0
 private void DeleteNoteCommandExecuted(EnquiryNoteModel item)
 {
     Enquiry.EnquiryNotes.Remove(item);
     _crmDataUnit.EnquiryNotesRepository.Delete(item.EnquiryNote);
 }