Example #1
0
 /// <exception cref="Ca.Infoway.Messagebuilder.Marshalling.HL7.XmlToModelTransformationException"></exception>
 protected virtual S GetNamePartType <S>(string value) where S : NamePartType
 {
     System.Type type = typeof(S);
     foreach (S partType in EnumPattern.Values <S>(type))
     {
         if (partType.Value.Equals(value))
         {
             return(partType);
         }
     }
     throw new XmlToModelTransformationException("Unexpected part of type: " + value);
 }
Example #2
0
        public virtual void TestAllHl7ErrorCodesAreInErrorCode()
        {
            IList <Hl7ErrorCode> oldErrorCode = EnumPattern.Values <Hl7ErrorCode>();

            for (int i = 0; i < oldErrorCode.Count; i++)
            {
                ErrorCode newErrorCode = TransformError.TransformCode(oldErrorCode[i]);
                if (newErrorCode == null)
                {
                    Assert.Fail("ErrorCode is missing Hl7ErrorCode: " + oldErrorCode[i].Name);
                }
            }
        }
Example #3
0
        public static SetOperator FindMatchingOperator(String operatorString)
        {
            SetOperator result = null;

            foreach (SetOperator setOperator in EnumPattern.Values <SetOperator>(typeof(SetOperator)))
            {
                if (setOperator.CodeValue.Equals(operatorString))
                {
                    result = setOperator;
                    break;
                }
            }
            return(result);
        }
Example #4
0
        public static ErrorCode TransformCode(Hl7ErrorCode hl7ErrorCode)
        {
            if (hl7ErrorCode == null)
            {
                return(null);
            }
            IList <ErrorCode> values = EnumPattern.Values <ErrorCode>();
            string            name   = hl7ErrorCode.Name;

            for (int i = 0; i < values.Count; i++)
            {
                if (StringUtils.Equals(values[i].Name, name))
                {
                    return(values[i]);
                }
            }
            return(null);
        }
Example #5
0
        private CalendarCycle ObtainAlignment(ParseContext context, XmlElement element, XmlToModelResult xmlToModelResult)
        {
            CalendarCycle alignment = null;

            if (element.HasAttribute("alignment"))
            {
                string alignmentString = element.GetAttribute("alignment");
                foreach (CalendarCycle calendarCycle in EnumPattern.Values <CalendarCycle>())
                {
                    if (StringUtils.Equals(calendarCycle.CalendarCycleCode, alignmentString))
                    {
                        alignment = calendarCycle;
                        break;
                    }
                }
                if (alignment == null)
                {
                    xmlToModelResult.AddHl7Error(new Hl7Error(Hl7ErrorCode.DATA_TYPE_ERROR, "Alignment attribute is not a valid CalendarCycle value. Value found: \""
                                                              + alignmentString + "\"", element));
                }
            }
            return(alignment);
        }
Example #6
0
 /// <summary>Obtains the media type registered for the supplied mime type.</summary>
 /// <remarks>
 /// Obtains the media type registered for the supplied mime type.
 /// Returns null if no media type could be found.
 /// </remarks>
 /// <param name="mimeType">the mimetype to match</param>
 /// <returns>the applicable X_DocumentMediaType</returns>
 public static Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType Get(string mimeType)
 {
     Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType result = null;
     foreach (Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType X_DocumentMediaType in EnumPattern.Values <Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType
                                                                                                                         >())
     {
         if (X_DocumentMediaType.MimeType.Equals(mimeType))
         {
             result = X_DocumentMediaType;
             break;
         }
     }
     return(result);
 }