示例#1
0
        public Resource ParseJson(JsonReader reader)
        {
            SummaryTypeMap Map = new SummaryTypeMap();

            try
            {
                FhirJsonParser FhirJsonParser = new FhirJsonParser();
                return(FhirJsonParser.Parse <Resource>(reader));
            }
            catch (Exception oExec)
            {
                throw new Bug.Common.Exceptions.FhirFatalException(System.Net.HttpStatusCode.InternalServerError, oExec.Message);
            }
        }
示例#2
0
        public string SerializeToXml(Resource resource, Bug.Common.Enums.SummaryType summaryType = Bug.Common.Enums.SummaryType.False)
        {
            SummaryTypeMap Map = new SummaryTypeMap();

            try
            {
                FhirXmlSerializer FhirXmlSerializer = new FhirXmlSerializer();
                return(FhirXmlSerializer.SerializeToString(resource, Map.GetForward(summaryType)));
            }
            catch (Exception oExec)
            {
                throw new Bug.Common.Exceptions.FhirFatalException(System.Net.HttpStatusCode.InternalServerError, oExec.Message);
            }
        }
示例#3
0
        public byte[] SerializeToJsonBytes(IFhirResourceR4 fhirResource, Bug.Common.Enums.SummaryType summaryType = Bug.Common.Enums.SummaryType.False)
        {
            SummaryTypeMap Map = new SummaryTypeMap();

            try
            {
                FhirJsonSerializer FhirJsonSerializer = new FhirJsonSerializer(new SerializerSettings()
                {
                    Pretty = false, AppendNewLine = false
                });
                return(FhirJsonSerializer.SerializeToBytes(fhirResource.R4, Map.GetForward(summaryType)));
            }
            catch (Exception oExec)
            {
                throw new Bug.Common.Exceptions.FhirFatalException(System.Net.HttpStatusCode.InternalServerError, oExec.Message);
            }
        }