Beispiel #1
0
    void PrintGeography(XmlElement currentNode, Geography geo, int level)
    {
        BasicGeographyDesignation[] officialdesignations = geo.GetGeographyDesignations();
        XmlElement thisNode = currentNode;

        if (officialdesignations.Length == 0)
        {
            thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY");
        }
        else if (officialdesignations[0].GeographyLevel == GeographyLevel.Municipality)
        {
            thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY");
        }
        else if (officialdesignations[0].GeographyLevel == GeographyLevel.ElectoralCircuit)
        {
            thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY");
        }

        if (thisNode != currentNode)
        {
            currentNode.AppendChild(thisNode);

            RoleLookup officers = RoleLookup.FromGeographyAndOrganization(geo.Identity, 1);
            thisNode.SetAttribute("name", geo.Name);
            thisNode.SetAttribute("hierlevel", level.ToString());
            thisNode.SetAttribute("geographyid", geo.Identity.ToString());
            if (officialdesignations.Length > 0)
            {
                thisNode.SetAttribute("level", ((int)officialdesignations[0].GeographyLevel).ToString());
                if (valkretsbyte.ContainsKey(officialdesignations[0].Designation))
                {
                    thisNode.SetAttribute("key", valkretsbyte[officialdesignations[0].Designation]);
                }
            }


            if (officers[RoleType.LocalLead].Count > 0)
            {
                foreach (PersonRole r in officers[RoleType.LocalLead])
                {
                    GeneratePerson(thisNode, RoleType.LocalLead, r.Person);
                }
            }
            if (officers[RoleType.LocalDeputy].Count > 0)
            {
                foreach (PersonRole r in officers[RoleType.LocalDeputy])
                {
                    GeneratePerson(thisNode, RoleType.LocalDeputy, r.Person);
                }
            }
        }

        foreach (Geography subGeo in geo.Children)
        {
            PrintGeography(thisNode, subGeo, level + 1);
        }
    }
Beispiel #2
0
    void PrintGeography (XmlElement currentNode, Geography geo, int level)
    {

        BasicGeographyDesignation[] officialdesignations = geo.GetGeographyDesignations();
        XmlElement thisNode = currentNode;
        if (officialdesignations.Length == 0)
        {
            thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY");
        }
        else if (officialdesignations[0].GeographyLevel == GeographyLevel.Municipality)
        {
            thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY");
        }
        else if (officialdesignations[0].GeographyLevel == GeographyLevel.ElectoralCircuit)
        {
            thisNode = currentNode.OwnerDocument.CreateElement("GEOGRAPHY");
        }

        if (thisNode != currentNode)
        {
            currentNode.AppendChild(thisNode);

            RoleLookup officers = RoleLookup.FromGeographyAndOrganization(geo.Identity, 1);
            thisNode.SetAttribute("name", geo.Name);
            thisNode.SetAttribute("hierlevel", level.ToString());
            thisNode.SetAttribute("geographyid", geo.Identity.ToString());
            if (officialdesignations.Length > 0)
            {
                thisNode.SetAttribute("level", ((int)officialdesignations[0].GeographyLevel).ToString());
                if (valkretsbyte.ContainsKey(officialdesignations[0].Designation))
                    thisNode.SetAttribute("key", valkretsbyte[officialdesignations[0].Designation]);
            }


            if (officers[RoleType.LocalLead].Count > 0)
            {
                foreach (PersonRole r in officers[RoleType.LocalLead])
                {
                    GeneratePerson(thisNode, RoleType.LocalLead, r.Person);
                }

            }
            if (officers[RoleType.LocalDeputy].Count > 0)
            {
                foreach (PersonRole r in officers[RoleType.LocalDeputy])
                {
                    GeneratePerson(thisNode, RoleType.LocalDeputy, r.Person);
                }
            }
        }

        foreach (Geography subGeo in geo.Children)
        {
            PrintGeography(thisNode, subGeo, level+1);
        }

    }