Beispiel #1
0
        private Dictionary <string, List <int> > GetCompositeIndexList()
        {
            Dictionary <string, List <int> > Dic = new Dictionary <string, List <int> >();

            foreach (var x in CompositeElementList.Where(x => x.Descendants(HL7v2Xsd.Elements.Sequence).Any()))
            {
                string Name = x.Attribute(HL7v2Xsd.Attributes.Name).Value;
                IEnumerable <XElement> ElementElementList = x.Element(HL7v2Xsd.Elements.Sequence).Elements(HL7v2Xsd.Elements.Element);
                List <int>             IntegerList        = new List <int>();
                bool HasRef = false;
                foreach (var Seq in ElementElementList)
                {
                    if (Seq.Attribute(HL7v2Xsd.Attributes.Ref) != null)
                    {
                        HasRef = true;
                        string sIndex = Seq.Attribute(HL7v2Xsd.Attributes.Ref).Value;
                        sIndex = sIndex.Split('.')[1];
                        int iIndex = 0;
                        try
                        {
                            iIndex = Convert.ToInt32(sIndex);
                        }
                        catch (Exception Exec)
                        {
                            throw new Exception("The index of a Composite data type was not a valid integer, found: " + sIndex + " in data type ref: " + sIndex, Exec);
                        }
                        IntegerList.Add(iIndex);
                    }
                }
                if (HasRef)
                {
                    Dic.Add(Name, IntegerList);
                }
            }
            return(Dic);
        }