Esempio n. 1
0
        public static T CreateElementInstance <T>(ChoHL7Configuration configuration, params object[] args)
        {
            ChoHL7Version version = configuration.Version;

            string fieldTypeName = "ChoETL.HL7.Model.{0}.{1}".FormatString(version.ToString(), typeof(T).Name);

            if (!ChoHL7MessageCache.Instance.HL7FieldTypeDict.ContainsKey(fieldTypeName))
            {
                throw new ChoHL7Exception("Can't find '{0}' HL7 field type.".FormatString(fieldTypeName));
            }

            return((T)CreateInstance(ChoHL7MessageCache.Instance.HL7FieldTypeDict[fieldTypeName], args));
        }
Esempio n. 2
0
        private static ChoHL7Segment CreateInstance(ChoHL7Configuration configuration, string segmentType)
        {
            ChoHL7Version version = configuration.Version;
            ChoHL7Segment msg     = null;

            string segmentTypeName = "ChoETL.HL7.Model.{0}.{1}".FormatString(version.ToString(), segmentType);

            if (!ChoHL7MessageCache.Instance.HL7SegmentDict.ContainsKey(segmentTypeName))
            {
                throw new ChoHL7Exception("Can't find '{0}' HL7 Segment type.".FormatString(segmentTypeName));
            }

            msg = Activator.CreateInstance(ChoHL7MessageCache.Instance.HL7SegmentDict[segmentTypeName]) as ChoHL7Segment;
            return(msg);
        }
Esempio n. 3
0
        private static ChoHL7Message CreateInstance(ChoHL7Configuration configuration)
        {
            ChoHL7MessageType mt      = configuration.MessageType;
            ChoHL7Version     version = configuration.Version;

            ChoHL7Message msg = null;

            string messageTypeName = "ChoETL.HL7.Model.{0}.{1}".FormatString(version.ToString(), mt.ToString());

            if (!ChoHL7MessageCache.Instance.HL7MessageDict.ContainsKey(messageTypeName))
            {
                throw new ChoHL7Exception("Can't find '{0}' HL7 Message type.".FormatString(messageTypeName));
            }

            msg             = CreateInstance(ChoHL7MessageCache.Instance.HL7MessageDict[messageTypeName]) as ChoHL7Message;
            msg.Version     = version;
            msg.MessageType = mt;
            return(msg);
        }