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


C# IGroup.GetAll方法代码示例

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


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

示例1: Encode

		/// <summary> Copies data from a group object into the corresponding group element, creating any 
		/// necessary child nodes.  
		/// </summary>
		private void Encode(IGroup groupObject, XmlElement groupElement)
		{
			String[] childNames = groupObject.Names;
			String messageName = groupObject.Message.GetStructureName();

			try
			{
				for (int i = 0; i < childNames.Length; i++)
				{
					IStructure[] reps = groupObject.GetAll(childNames[i]);
					for (int j = 0; j < reps.Length; j++)
					{
						XmlElement childElement =
							groupElement.OwnerDocument.CreateElement(MakeGroupElementName(messageName, childNames[i]));
						bool hasValue = false;

						if (reps[j] is IGroup)
						{
							hasValue = true;
							Encode((IGroup) reps[j], childElement);
						}
						else if (reps[j] is ISegment)
						{
							hasValue = Encode((ISegment) reps[j], childElement);
						}

						if (hasValue)
						{
							groupElement.AppendChild(childElement);
						}
					}
				}
			}
			catch (Exception e)
			{
				throw new HL7Exception("Can't encode group " + groupObject.GetType().FullName,
					HL7Exception.APPLICATION_INTERNAL_ERROR, e);
			}
		}
开发者ID:RickIsWright,项目名称:nHapi,代码行数:42,代码来源:DefaultXMLParser.cs

示例2: Encode

		/// <summary> Returns given group serialized as a pipe-encoded string - this method is called
		/// by encode(Message source, String encoding).
		/// </summary>
		public static String Encode(IGroup source, EncodingCharacters encodingChars)
		{
			StringBuilder result = new StringBuilder();

			String[] names = source.Names;
			for (int i = 0; i < names.Length; i++)
			{
				IStructure[] reps = source.GetAll(names[i]);
				for (int rep = 0; rep < reps.Length; rep++)
				{
					if (reps[rep] is IGroup)
					{
						result.Append(Encode((IGroup) reps[rep], encodingChars));
					}
					else
					{
						String segString = Encode((ISegment) reps[rep], encodingChars);
						if (segString.Length >= 4)
						{
							result.Append(segString);
							result.Append('\r');
						}
					}
				}
			}
			return result.ToString();
		}
开发者ID:RickIsWright,项目名称:nHapi,代码行数:30,代码来源:PipeParser.cs

示例3: getIndex

 /// <summary> Returns the index of the given structure as a child of the 
 /// given parent.  Returns null if the child isn't found. 
 /// </summary>
 public static Index getIndex(IGroup parent, IStructure child)
 {
     Index index = null;
     System.String[] names = parent.Names;
     for (int i = 0; i < names.Length; i++)
     {
         if (names[i].StartsWith(child.GetStructureName()))
         {
             try
             {
                 IStructure[] reps = parent.GetAll(names[i]);
                 for (int j = 0; j < reps.Length; j++)
                 {
                     if (child == reps[j])
                     {
                         index = new Index(names[i], j);
                         break;
                     }
                 }
             }
             catch (HL7Exception e)
             {
                 log.Error("", e);
                 throw new System.ApplicationException("Internal HL7Exception finding structure index: " + e.Message);
             }
         }
     }
     return index;
 }
开发者ID:snosrap,项目名称:nhapi,代码行数:32,代码来源:MessageIterator.cs


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