コード例 #1
0
ファイル: Varies.cs プロジェクト: carlhuth/GenXSource
 /// <summary> Sets the data type of field 5 in the given OBX segment to the value of OBX-2.  The argument
 /// is a Segment as opposed to a particular OBX because it is meant to work with any version.
 /// </summary>
 public static void  fixOBX5(Segment segment, ModelClassFactory factory)
 {
     try
     {
         //get unqualified class name
         Primitive obx2 = (Primitive)segment.getField(2, 0);
         Type[]    reps = segment.getField(5);
         for (int i = 0; i < reps.Length; i++)
         {
             Varies v = (Varies)reps[i];
             if (obx2.Value == null)
             {
                 if (v.Data != null)
                 {
                     if (!(v.Data is Primitive) || ((Primitive)v.Data).Value != null)
                     {
                         throw new NuGenHL7Exception("OBX-5 is valued, but OBX-2 is not.  A datatype for OBX-5 must be specified using OBX-2.", NuGenHL7Exception.REQUIRED_FIELD_MISSING);
                     }
                 }
             }
             else
             {
                 //set class
                 System.Type c = factory.getTypeClass(obx2.Value, segment.Message.Version);
                 //                    Class c = Genetibase.NuGenHL7.parser.Parser.findClass(obx2.getValue(),
                 //                                                    segment.getMessage().getVersion(),
                 //                                                    "datatype");
                 v.Data = (Type)c.GetConstructor(new System.Type[] { typeof(Message) }).Invoke(new System.Object[] { v.Message });
             }
         }                 // for reps
     }
     catch (NuGenHL7Exception e)
     {
         throw e;
     }
     catch (System.Exception e)
     {
         throw new NuGenHL7Exception(e.GetType().FullName + " trying to set data type of OBX-5", NuGenHL7Exception.APPLICATION_INTERNAL_ERROR, e);
     }
 }
コード例 #2
0
ファイル: MFE.cs プロジェクト: xuchuansheng/GenXSource
		/// <summary> Returns all repetitions of Primary Key Value - MFE (MFE-4).</summary>
		public virtual Varies[] getPrimaryKeyValueMFE()
		{
			Varies[] ret = null;
			try
			{
				Type[] t = this.getField(4);
				ret = new Varies[t.Length];
				for (int i = 0; i < ret.Length; i++)
				{
					ret[i] = (Varies) t[i];
				}
			}
			catch (System.InvalidCastException )
			{
				throw new Exception();
			}
			catch (NuGenHL7Exception)
			{
				throw new Exception();
			}
			return ret;
		}