Exemple #1
0
        /// <summary>
        /// Builds to XML.
        /// </summary>
        /// <param name="patientKey">The patient key.</param>
        /// <param name="staffKey">The staff key.</param>
        /// <param name="agencyKey">The agency key.</param>
        /// <param name="locationKey">The location key.</param>
        /// <returns>A <see cref="System.String"/></returns>
        public string BuildToXml(long patientKey, long staffKey, long agencyKey, long locationKey)
        {
            LoadConfiguration();  //TODO: Refactor into Helper Class with Interface + Dto

            LoadEntitiesFromDomain(patientKey, staffKey, agencyKey, locationKey);

            Logger.Debug("Building NCScript Object");

            var script = new NCScript.NCScript
            {
                Credentials         = BuildCredentialsType(),
                UserRole            = DetermineUserRole(),
                Destination         = DetermineDestinationPage(),
                Account             = BuildAccountType(_agency),
                Location            = BuildLocationType(_location),
                LicensedPrescriber  = BuildLicensedPrescriberType(_staff),
                Patient             = BuildPatientType(_patient),
                OutsidePrescription = BuildOutsidePrescriptionType(_patient),
            };

            var serializer = new XmlSerializer(typeof(NCScript.NCScript));
            var stream     = new MemoryStream();

            serializer.Serialize(stream, script);
            var xml = Encoding.UTF8.GetString(stream.ToArray());

            Logger.Debug("NSCript Object successfully Generated. {0}", xml);

            return(xml);
        }
Exemple #2
0
        /// <summary>
        /// Builds to XML.
        /// </summary>
        /// <param name="patientKey">The patient key.</param>
        /// <param name="staffKey">The staff key.</param>
        /// <param name="agencyKey">The agency key.</param>
        /// <param name="locationKey">The location key.</param>
        /// <returns>A <see cref="System.String"/></returns>
        public string BuildToXml( long patientKey, long staffKey, long agencyKey, long locationKey )
        {
            LoadConfiguration (); //TODO: Refactor into Helper Class with Interface + Dto

            LoadEntitiesFromDomain ( patientKey, staffKey, agencyKey, locationKey );

            Logger.Debug ( "Building NCScript Object" );

            var script = new NCScript.NCScript
                {
                    Credentials = BuildCredentialsType (),
                    UserRole = DetermineUserRole (),
                    Destination = DetermineDestinationPage (),
                    Account = BuildAccountType ( _agency ),
                    Location = BuildLocationType ( _location ),
                    LicensedPrescriber = BuildLicensedPrescriberType ( _staff ),
                    Patient = BuildPatientType ( _patient ),
                    OutsidePrescription = BuildOutsidePrescriptionType ( _patient ),
                };

            var serializer = new XmlSerializer ( typeof( NCScript.NCScript ) );
            var stream = new MemoryStream ();

            serializer.Serialize ( stream, script );
            var xml = Encoding.UTF8.GetString ( stream.ToArray () );

            Logger.Debug ( "NSCript Object successfully Generated. {0}", xml );

            return xml;
        }