コード例 #1
0
ファイル: GeographyCache.cs プロジェクト: SwarmCorp/Swarmops
        static public BasicGeography[] GetGeographyLine (int leafGeographyId)
        {
            List<BasicGeography> result = new List<BasicGeography>();


            BasicGeography currentNode = GeographyCache.GetGeography(leafGeographyId);

            // This iterates until the zero-parentid root node is found

            while (currentNode.GeographyId != 0)
            {
                result.Add(currentNode);

                if (currentNode.ParentGeographyId != 0)
                {
                    currentNode = GeographyCache.GetGeography(currentNode.ParentGeographyId);
                }
                else
                {
                    currentNode = new BasicGeography(0, 0, string.Empty);
                }
            }

            result.Reverse();

            return result.ToArray();
        }
コード例 #2
0
        public BasicGeography[] GetGeographyLine (int leafGeographyId)
        {
            List<BasicGeography> result = new List<BasicGeography>();

            Dictionary<int, List<BasicGeography>> nodes = GetHashedGeographies();

            BasicGeography currentNode = nodes[leafGeographyId][0];

            // This iterates until the zero-parentid root node is found

            while (currentNode.GeographyId != 0)
            {
                result.Add(currentNode);

                if (currentNode.ParentGeographyId != 0)
                {
                    currentNode = nodes[currentNode.ParentGeographyId][0];
                }
                else
                {
                    currentNode = new BasicGeography(0, 0, string.Empty);
                }
            }

            result.Reverse();

            return result.ToArray();
        }
コード例 #3
0
        public int[] GetOrganizationsIdsInGeographies (BasicGeography[] nodes)
        {
            if (nodes == null || nodes.Length == 0)
            {
                return new int[0];
            }

            List<int> nodeIdList = new List<int>();

            foreach (BasicGeography node in nodes)
            {
                nodeIdList.Add(node.GeographyId);
            }

            return GetOrganizationIdsInGeographies(nodeIdList.ToArray());
        }
コード例 #4
0
ファイル: Geography.cs プロジェクト: SwarmCorp/Swarmops
 public static Geography FromBasic (BasicGeography basic)
 {
     return new Geography(basic);
 }
コード例 #5
0
ファイル: Geography.cs プロジェクト: SwarmCorp/Swarmops
 private Geography (BasicGeography basic)
     : base(basic)
 {
     // construction from basic
 }
コード例 #6
0
ファイル: BasicGeography.cs プロジェクト: SwarmCorp/Swarmops
 public BasicGeography (BasicGeography original)
     : this(original.GeographyId, original.ParentGeographyId, original.Name, original.Generation)
 {
 }
コード例 #7
0
 public BasicGeography(BasicGeography original)
     : this(original.GeographyId, original.ParentGeographyId, original.Name, original.Generation)
 {
 }