当前位置: 首页>>代码示例>>C#>>正文


C# IModelClassFactory.GetTypeClass方法代码示例

本文整理汇总了C#中IModelClassFactory.GetTypeClass方法的典型用法代码示例。如果您正苦于以下问题:C# IModelClassFactory.GetTypeClass方法的具体用法?C# IModelClassFactory.GetTypeClass怎么用?C# IModelClassFactory.GetTypeClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IModelClassFactory的用法示例。


在下文中一共展示了IModelClassFactory.GetTypeClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: fixOBX5

		/// <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(ISegment segment, IModelClassFactory factory)
		{
			try
			{
				//get unqualified class name
				IPrimitive obx2 = (IPrimitive) segment.GetField(2, 0);

				foreach (IType repetition in segment.GetField(5))
				{
					Varies v = (Varies) repetition;

					if (obx2.Value == null)
					{
						if (v.Data != null)
						{
							if (!(v.Data is IPrimitive) || ((IPrimitive) v.Data).Value != null)
							{
								throw new HL7Exception(
									"OBX-5 is valued, but OBX-2 is not.  A datatype for OBX-5 must be specified using OBX-2.",
									HL7Exception.REQUIRED_FIELD_MISSING);
							}
						}
					}
					else
					{
						Type c = factory.GetTypeClass(obx2.Value, segment.Message.Version);
						v.Data = (IType) c.GetConstructor(new [] {typeof (IMessage), typeof(String)}).Invoke(new Object[] {v.Message, v.Description});
					}
				}
			}
			catch (HL7Exception e)
			{
				throw e;
			}
			catch (Exception e)
			{
				throw new HL7Exception(e.GetType().FullName + " trying to set data type of OBX-5",
					HL7Exception.APPLICATION_INTERNAL_ERROR, e);
			}
		}
开发者ID:RickIsWright,项目名称:nHapi,代码行数:43,代码来源:Varies.cs

示例2: fixOBX5

        /// <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(ISegment segment, IModelClassFactory factory)
        {
            try
            {
                //get unqualified class name
                IPrimitive obx2 = (IPrimitive)segment.GetField(2, 0);
                Varies v = (Varies)segment.GetField(5, 0);

                if (obx2.Value == null)
                {
                    if (v.Data != null)
                    {
                        if (!(v.Data is IPrimitive) || ((IPrimitive)v.Data).Value != null)
                        {
                            throw new HL7Exception("OBX-5 is valued, but OBX-2 is not.  A datatype for OBX-5 must be specified using OBX-2.", HL7Exception.REQUIRED_FIELD_MISSING);
                        }
                    }
                }
                else
                {
                    //set class
                    System.Type c = factory.GetTypeClass(obx2.Value, segment.Message.Version);
                    //                Class c = NHapi.Base.Parser.ParserBase.findClass(obx2.getValue(),
                    //                                                segment.getMessage().getVersion(),
                    //                                                "datatype");
                    v.Data = (IType)c.GetConstructor(new System.Type[] { typeof(IMessage) }).Invoke(new System.Object[] { v.Message });
                }
            }
            catch (HL7Exception e)
            {
                throw e;
            }
            catch (System.Exception e)
            {
                throw new HL7Exception(e.GetType().FullName + " trying to set data type of OBX-5", HL7Exception.APPLICATION_INTERNAL_ERROR, e);
            }
        }
开发者ID:snosrap,项目名称:nhapi,代码行数:40,代码来源:Varies.cs


注:本文中的IModelClassFactory.GetTypeClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。