Esempio n. 1
0
        public TextTO getAllergiesAsXML(string appPwd, string patientICN)
        {
            TextTO result = new TextTO();

            if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null ||
                mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null)
            {
                result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!");
            }
            if (result.fault != null)
            {
                return(result);
            }

            CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]);

            cxn.Pid = patientICN;
            CdsClinicalDao dao = new CdsClinicalDao(cxn);

            try
            {
                result.text = dao.getAllergiesAsXML();
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Esempio n. 2
0
        public TextTO getLabReportsAsXML(string appPwd, string patientICN, string fromDate, string toDate)
        {
            TextTO result = new TextTO();

            if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null ||
                mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null)
            {
                result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!");
            }
            if (result.fault != null)
            {
                return(result);
            }

            CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]);

            cxn.Pid = patientICN;
            CdsLabsDao dao = new CdsLabsDao(cxn);

            try
            {
                // TODO - validate app password
                result.text = dao.getAllLabReports(fromDate, toDate, 0); // function is probably ignoring these params
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
        public void Run(string manifestPath, CdsConnection cdsConnection)
        {
            var manifest = SerialisationWrapper.DeserialiseFromFile <ProcessActivationManifest>(manifestPath);
            var client   = XrmClient.GetCrmServiceClientFromManifestConfiguration(manifest.CdsConnection);

            ValidateManifest(manifest);
            if (!ValidationResult.IsValid)
            {
                // TODO - throw a good error ;)
                return;
            }

            if (manifest.LoggingConfiguration == null)
            {
                manifest.LoggingConfiguration = new LoggingConfiguration()
                {
                    LoggerConfigurationType = LoggerConfigurationType.Console,
                    LogLevelToTrace         = LogLevel.Information
                };
            }

            var processWrapper = new ProcessActivationWrapper();

            processWrapper.SetStatusFromManifest(client, manifest);
        }
Esempio n. 4
0
        public void Run(string manifestPath, CdsConnection cdsConnection)
        {
            // TODO - throw good errors if manifest can't be found/read/isInvalid
            var manifest = SerialisationWrapper.DeserialiseFromFile <ConfigurationManifest>(manifestPath);
            // TODO - throw good error if XrmClient is unauthorised/etc...
            var client = XrmClient.GetCrmServiceClientFromManifestConfiguration(manifest.CdsConnection);

            ValidateManifest(manifest);
            if (!ValidationResult.IsValid)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Manifest is not valid. Not progressing with registration");
                Console.WriteLine($"\nErrors found in manifest validation:\n{ValidationResult}");
                Console.ResetColor();

                // QUESTION - Do you really want to throw an exception here, if you're already logging the val output?
                throw new InvalidManifestException("Exiting processing with exception - Manifest is not valid");
            }

            if (manifest.LoggingConfiguration == null)
            {
                manifest.LoggingConfiguration = new LoggingConfiguration()
                {
                    LoggerConfigurationType = LoggerConfigurationType.Console,
                    LogLevelToTrace         = LogLevel.Information
                };
            }

            var configWrapper = new ConfigurationWrapper();

            configWrapper.GenerateCustomisations(manifest, client);
        }
Esempio n. 5
0
        public TextTO getHthVitalsAsXML(String appPwd, String icn)
        {
            TextTO result = new TextTO();

            if (mySession == null || mySession.SiteTable == null || mySession.SiteTable.getSite("201") == null ||
                mySession.SiteTable.getSite("201").Sources == null || mySession.SiteTable.getSite("201").Sources[0] == null)
            {
                result.fault = new FaultTO("No CDS endpoint (site 201) in sites file!");
            }
            if (result.fault != null)
            {
                return(result);
            }

            CdsConnection cxn = new CdsConnection(mySession.SiteTable.getSite("201").Sources[0]);
            CdsVitalsDao  dao = new CdsVitalsDao(cxn);

            try
            {
                result.text = dao.getHthVitals(icn); // function is probably ignoring these params
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
        public void Run(string manifestPath, CdsConnection cdsConnection)
        {
            var manifest = SerialisationWrapper.DeserialiseFromFile <PluginManifest>(manifestPath);

            if (cdsConnection != null)
            {
                manifest.CdsConnection = cdsConnection;
            }

            ValidateManifest(manifest);
            if (!ValidationResult.IsValid)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"Manifest is not valid. Not progressing with registration");
                Console.WriteLine($"\nErrors found in manifest validation:\n{ValidationResult}");
                Console.ResetColor();

                throw new InvalidManifestException("Exiting processing with exception - Manifest is no valid");
            }

            if (manifest.LoggingConfiguration == null)
            {
                manifest.LoggingConfiguration = new LoggingConfiguration()
                {
                    LoggerConfigurationType = LoggerConfigurationType.Console,
                    LogLevelToTrace         = LogLevel.Information
                };
            }

            var client = XrmClient.GetCrmServiceClientFromManifestConfiguration(manifest.CdsConnection);

            var pluginWrapper = new PluginWrapper();

            pluginWrapper.RegisterPlugins(manifest, client);
            pluginWrapper.RegisterServiceEndpoints(manifest, client);
        }
Esempio n. 7
0
 public abstract void Run(string manifestPath, CdsConnection cdsConnection = null);
Esempio n. 8
0
        public override void Run(string manifestPath, CdsConnection cdsConnection = null)
        {
            var registerPlugins = new RegisterPlugins();

            registerPlugins.Run(manifestPath, cdsConnection);
        }
Esempio n. 9
0
        public override void Run(string manifestPath, CdsConnection cdsConnection = null)
        {
            var toggle = new ToggleProcesses();

            toggle.Run(manifestPath, cdsConnection);
        }
Esempio n. 10
0
 public void Run(string manifestPath, CdsConnection cdsConnection)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 11
0
        public override void Run(string manifestPath, CdsConnection cdsConnection = null)
        {
            var generate = new GenerateCustomisations();

            generate.Run(manifestPath, cdsConnection);
        }
Esempio n. 12
0
        /// <summary>
        /// Creates a new CrmServiceClient from configuration passed through an XML manifest configuration
        /// </summary>
        /// <param name="cdsConnection"></param>
        /// <returns>CrmServiceClient</returns>
        public static IOrganizationService GetCrmServiceClientFromManifestConfiguration(CdsConnection cdsConnection)
        {
            switch (cdsConnection.ConnectionType)
            {
            case CdsConnectionType.AppRegistration:
                return(GetCrmServiceClientWithClientSecret(cdsConnection.CdsUrl, cdsConnection.CdsAppId,
                                                           cdsConnection.CdsAppSecret));

            case CdsConnectionType.ConnectionString:
                return(GetCrmServiceClient(cdsConnection.CdsConnectionString));

            case CdsConnectionType.UserNameAndPassword:
                return(GetCrmServiceClientWithO365(cdsConnection.CdsUrl, cdsConnection.CdsUserName,
                                                   cdsConnection.CdsPassword));

            default:
                throw new ArgumentOutOfRangeException(nameof(cdsConnection), "Type of CdsConnection.ConnectionType not recognised");
            }
        }
        public override void Run(string manifestPath, CdsConnection cdsConnection = null)
        {
            var unregister = new UnregisterPlugins();

            unregister.Run(manifestPath, cdsConnection);
        }