Пример #1
0
        private void StartRuleWatch()
        {
            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <EditMedicationViewModel, IDataTransferObject> ();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.Medication);
            ruleExecutor.WatchSubject(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NidaDrugQuestionnaireViewModel"/> class.
        /// </summary>
        /// <param name="userDialogService">The user dialog service.</param>
        /// <param name="asyncRequestDispatcherFactory">The async request dispatcher factory.</param>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="commandFactory">The command factory.</param>
        public NidaDrugQuestionnaireViewModel(
            IUserDialogService userDialogService,
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IAccessControlManager accessControlManager,
            IEventAggregator eventAggregator,
            ICommandFactory commandFactory)
            : base(userDialogService, asyncRequestDispatcherFactory, accessControlManager, eventAggregator, commandFactory)
        {
            _eventAggregator = eventAggregator;
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;
            _userDialogService             = userDialogService;

            var commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            SaveCommand = commandFactoryHelper.BuildDelegateCommand <KeyedDataTransferObject> (
                () => SaveCommand,
                dto =>
            {
                var name = PropertyUtil.ExtractPropertyName(() => EditingDto);
                if (dto != null && EditingDto.GetType() != dto.GetType())
                {
                    name = EditingDto.GetType().GetProperties().First(pi => pi.PropertyType == dto.GetType()).Name;
                }
                return(name);
            },
                ExecuteSaveCommand,
                CanExecuteSaveCommand);

            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <NidaDrugQuestionnaireViewModel, IDataTransferObject> ();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.EditingDto);
            ruleExecutor.WatchSubject(this);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TedsAdmissionInterviewViewModel"/> class.
        /// </summary>
        /// <param name="userDialogService">The user dialog service.</param>
        /// <param name="asyncRequestDispatcherFactory">The async request dispatcher factory.</param>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="commandFactory">The command factory.</param>
        public TedsAdmissionInterviewViewModel(
            IUserDialogService userDialogService,
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IAccessControlManager accessControlManager,
            IEventAggregator eventAggregator,
            ICommandFactory commandFactory)
            : base(userDialogService, asyncRequestDispatcherFactory, accessControlManager, eventAggregator, commandFactory)
        {
            _userDialogService             = userDialogService;
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;

            _primaryDetailedDrugCodeList   = new ObservableCollection <DetailedDrugCodeDto> ();
            _secondaryDetailedDrugCodeList = new ObservableCollection <DetailedDrugCodeDto> ();
            _tertiaryDetailedDrugCodeList  = new ObservableCollection <DetailedDrugCodeDto> ();

            var commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            RemoveSubstanceUsageCommand = commandFactoryHelper.BuildDelegateCommand <string> (
                () => RemoveSubstanceUsageCommand, ExecuteRemoveSubstanceUsage);

            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <TedsAdmissionInterviewViewModel, IDataTransferObject>();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.EditingDto);
            ruleExecutor.WatchSubject(this);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SaveMailAttachmentPatientDocumentViewModel"/> class.
        /// </summary>
        /// <param name="userDialogService">The user dialog service.</param>
        /// <param name="asyncRequestDispatcherFactory">The async request dispatcher factory.</param>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="commandFactory">The command factory.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="navigationService">The navigation service.</param>
        /// <param name="popupService">The popup service.</param>
        public SaveMailAttachmentPatientDocumentViewModel(
            IUserDialogService userDialogService,
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IAccessControlManager accessControlManager,
            ICommandFactory commandFactory,
            IEventAggregator eventAggregator,
            INavigationService navigationService,
            IPopupService popupService)
            : base(userDialogService, asyncRequestDispatcherFactory, accessControlManager, commandFactory)
        {
            _userDialogService             = userDialogService;
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;
            _eventAggregator   = eventAggregator;
            _navigationService = navigationService;
            _popupService      = popupService;

            var commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            CreatePatientImportDocumentCommand = commandFactoryHelper.BuildDelegateCommand(
                () => CreatePatientImportDocumentCommand, ExecuteCreatePatientImportDocumentCommand);

            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <SaveMailAttachmentPatientDocumentViewModel, IDataTransferObject> ();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.EditingDto);
            ruleExecutor.WatchSubject(this);
        }
Пример #5
0
        private void StartRuleWatch()
        {
            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <ProgramOfferingEditorViewModel, IDataTransferObject> ();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.EditingDto);
            ruleExecutor.IgnoreProperty(vm => vm.Programs);
            ruleExecutor.WatchSubject(this);
        }
Пример #6
0
        private void HandleInitializationCompleted(ReceivedResponses receivedResponses)
        {
            var responses = from response in receivedResponses.Responses
                            where typeof(GetLookupValuesResponse).IsAssignableFrom(response.GetType())
                            select response;

            LookupValueLists = responses.Cast <GetLookupValuesResponse>().ToDictionary(
                response => response.Name, response => response.LookupValues);

            if (PayorCoverage == null)
            {
                var response = receivedResponses.Get <DtoResponse <PayorCoverageCacheDto> > ();
                PayorCoverage = response.DataTransferObject;

                _ruleExecutor.WatchSubject(this);
            }

            PatientSummary = receivedResponses.Get <DtoResponse <PatientSummaryDto> > ().DataTransferObject;

            IsLoading = false;
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GpraInterviewViewModel"/> class.
        /// </summary>
        /// <param name="userDialogService">The user dialog service.</param>
        /// <param name="asyncRequestDispatcherFactory">The async request dispatcher factory.</param>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="commandFactory">The command factory.</param>
        public GpraInterviewViewModel(
            IUserDialogService userDialogService,
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IAccessControlManager accessControlManager,
            IEventAggregator eventAggregator,
            ICommandFactory commandFactory)
            : base(userDialogService, asyncRequestDispatcherFactory, accessControlManager, eventAggregator, commandFactory)
        {
            _userDialogService             = userDialogService;
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;

            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <GpraInterviewViewModel, IDataTransferObject> ();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.EditingDto);
            ruleExecutor.WatchSubject(this);
        }
Пример #8
0
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand(KeyValuePair <string, string>[] parameters)
        {
            var patientKey = parameters.GetValue <long> ("PatientKey");

            if (SelfPayment != null)
            {
                _ruleExecutor.StopWatchingSubject(this);
            }

            SelfPayment                       = new SelfPaymentDto();
            SelfPayment.PatientKey            = patientKey;
            SelfPayment.CollectedByStaffKey   = _currentStaffKey;
            SelfPayment.CultureName           = "en-US";
            SelfPayment.CurrencyWellKnownName = Currency.USDollars;

            _ruleExecutor.WatchSubject(this);

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();

            requestDispatcher.AddLookupValuesRequest("PaymentMethod");
            requestDispatcher.ProcessRequests(HandleInitializationCompleted, HandleInitializationError);
            IsLoading = true;
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TedsDischargeInterviewViewModel"/> class.
        /// </summary>
        /// <param name="userDialogService">The user dialog service.</param>
        /// <param name="asyncRequestDispatcherFactory">The async request dispatcher factory.</param>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="popupService">The popup service.</param>
        /// <param name="commandFactory">The command factory.</param>
        public TedsDischargeInterviewViewModel(
            IUserDialogService userDialogService,
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IAccessControlManager accessControlManager,
            IEventAggregator eventAggregator,
            IPopupService popupService,
            ICommandFactory commandFactory)
            : base(userDialogService, asyncRequestDispatcherFactory, accessControlManager, eventAggregator, commandFactory)
        {
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;
            _userDialogService             = userDialogService;
            _popupService = popupService;

            var commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            ViewAdmissionCommand        = commandFactoryHelper.BuildDelegateCommand(() => ViewAdmissionCommand, ExecuteViewAdmissionCommand);
            RemoveSubstanceUsageCommand = commandFactoryHelper.BuildDelegateCommand <string>(
                () => RemoveSubstanceUsageCommand, ExecuteRemoveSubstanceUsage);

            var ruleExecutor = new NotifyPropertyChangedRuleExecutor <TedsDischargeInterviewViewModel, IDataTransferObject>();

            ruleExecutor.AddRunAllRulesProperty(vm => vm.EditingDto);
            ruleExecutor.WatchSubject(this);
        }
Пример #10
0
 private void StartRuleWatch()
 {
     var ruleExecutor = new NotifyPropertyChangedRuleExecutor<EditMedicationViewModel, IDataTransferObject> ();
     ruleExecutor.AddRunAllRulesProperty ( vm => vm.Medication );
     ruleExecutor.WatchSubject ( this );
 }