示例#1
0
        public void CodeValue_ToString()
        {
            var codeValueDetails = codeValue.ToString();

            Assert.IsNotNull(codeValueDetails);
            Assert.AreEqual(string.Format("[{0}] {1}", codeValue.Code, codeValue.Description), codeValueDetails);
        }
示例#2
0
        /// <summary>
        /// Get the display name for the enumeration
        /// </summary>
        private ST GetDisplayName(CodeValue <T> value)
        {
            if (value == null || !typeof(T).IsEnum)
            {
                return(null);
            }

            object[] ea = typeof(T).GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);

            if (ea.Length != 0 && !string.IsNullOrEmpty((ea[0] as DescriptionAttribute).Description))
            {
                return((ea[0] as DescriptionAttribute).Description);
            }
            return(null);
        }
示例#3
0
        /// <summary>
        /// Get code system for the specified value
        /// </summary>
        private string GetCodeSystem(CodeValue <T> value)
        {
            if (value == null || !typeof(T).IsEnum)
            {
                return(null);
            }

            object[] ea = typeof(T).GetField(value.ToString()).GetCustomAttributes(typeof(EnumerationAttribute), false),
            oa = typeof(T).GetCustomAttributes(typeof(StructureAttribute), false);

            if (ea.Length != 0 && !string.IsNullOrEmpty((ea[0] as EnumerationAttribute).SupplierDomain))
            {
                return((ea[0] as EnumerationAttribute).SupplierDomain);
            }
            if (String.IsNullOrEmpty(this.CodeSystem) && oa.Length != 0)
            {
                return((oa[0] as StructureAttribute).CodeSystem);
            }
            return(null);
        }
示例#4
0
 /// <summary>
 /// Represent this as a string
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(NullFlavor != null ? "" : Code == null ? "" : Code.ToString());
 }
示例#5
0
 public static void Write(CodeValue codeValue, int indentation, TextWriter wtr)
 {
     wtr.WriteLine("{0}{1} - CodeValue", Indentation(indentation), codeValue.ToString());
 }
示例#6
0
 public static void Write(CodeValue codeValue, int indentation, TextWriter wtr)
 {
     wtr.WriteLine("{0}{1} - CodeValue", Indentation(indentation), codeValue.ToString());
 }