Пример #1
0
        bool ILookupHandler.Resolve(string query, bool interactive, out object result)
        {
            result = null;

            ExternalPractitionerDetail practitionerDetail = null;

            Platform.GetService <IExternalPractitionerAdminService>(
                service =>
            {
                var response       = service.LoadExternalPractitionerForEdit(new LoadExternalPractitionerForEditRequest(_practitionerRef));
                practitionerDetail = response.PractitionerDetail;
            });

            var component = new ExternalPractitionerContactPointSummaryComponent(_practitionerRef);

            practitionerDetail.ContactPoints.ForEach(p => component.Subject.Add(p));

            var exitCode = ApplicationComponent.LaunchAsDialog(
                _desktopWindow, component, SR.TitleContactPoints);

            if (exitCode == ApplicationComponentExitCode.Accepted)
            {
                result = component.SummarySelection.Item;
            }

            return(result != null);
        }
Пример #2
0
        public override void Start()
        {
            LoadExternalPractitionerEditorFormDataResponse formDataResponse = null;

            Platform.GetService <IExternalPractitionerAdminService>(service =>
            {
                formDataResponse = service.LoadExternalPractitionerEditorFormData(new LoadExternalPractitionerEditorFormDataRequest());

                if (_isNew)
                {
                    _practitionerDetail = new ExternalPractitionerDetail();
                }
                else
                {
                    var response        = service.LoadExternalPractitionerForEdit(new LoadExternalPractitionerForEditRequest(_practitionerRef));
                    _practitionerRef    = response.PractitionerDetail.PractitionerRef;
                    _practitionerDetail = response.PractitionerDetail;
                }
            });

            _contactPointSummaryComponent = new ExternalPractitionerContactPointSummaryComponent(_practitionerRef,
                                                                                                 formDataResponse.AddressTypeChoices,
                                                                                                 formDataResponse.PhoneTypeChoices,
                                                                                                 formDataResponse.ResultCommunicationModeChoices,
                                                                                                 formDataResponse.InformationAuthorityChoices,
                                                                                                 Formatting.PersonNameFormat.Format(_practitionerDetail.Name));
            _contactPointSummaryComponent.SetModifiedOnListChange = true;

            var rootPath = SR.TitleExternalPractitioner;

            this.Pages.Add(new NavigatorPage("NodeExternalPractitioner", _detailsEditor = new ExternalPractitionerDetailsEditorComponent(_isNew)));
            this.Pages.Add(new NavigatorPage("NodeExternalPractitioner/NodeContactPoints", _contactPointSummaryComponent));

            this.ValidationStrategy = new AllComponentsValidationStrategy();

            _detailsEditor.ExternalPractitionerDetail = _practitionerDetail;

            // Hide the merged contact points from user.
            CollectionUtils.ForEach(_practitionerDetail.ContactPoints,
                                    delegate(ExternalPractitionerContactPointDetail cp)
            {
                if (cp.IsMerged)
                {
                    _hiddenMergedContactPoints.Add(cp);
                }
                else
                {
                    _contactPointSummaryComponent.Subject.Add(cp);
                }
            });

            // instantiate all extension pages
            _extensionPages = new List <IExternalPractitionerEditorPage>();
            foreach (IExternalPractitionerEditorPageProvider pageProvider in new ExternalPractitionerEditorPageProviderExtensionPoint().CreateExtensions())
            {
                _extensionPages.AddRange(pageProvider.GetPages(new EditorContext(this)));
            }

            // add extension pages to navigator
            // the navigator will start those components if the user goes to that page
            foreach (var page in _extensionPages)
            {
                this.Pages.Add(new NavigatorPage(page.Path, page.GetComponent()));
            }

            base.Start();
        }