Example #1
0
    private static void InitDatabaseThreadCreateGeographyChildren(Swarmops.Site.Automation.Geography[] children,
                                                                  int parentGeographyId,
                                                                  ref Dictionary<int, int> geographyIdTranslation, string countryCode, ref int count, int total)
    {
        count++;

        foreach (Swarmops.Site.Automation.Geography geography in children)
        {
            int newGeographyId = SwarmDb.GetDatabaseForWriting().CreateGeography(geography.Name, parentGeographyId);
            geographyIdTranslation[geography.GeographyId] = newGeographyId;

            InitDatabaseThreadCreateGeographyChildren(geography.Children, newGeographyId, ref geographyIdTranslation, countryCode, ref count, total);
        }

        if (total != 0)
        {
            _initMessage = String.Format("Setting up geography for {0}... ({1}%)", countryCode, count*100/total);
                // shouldn't be here but wtf
        }
        Thread.Sleep(50);
    }
Example #2
0
    private static int InitDatabaseThreadCountGeographyChildren(Swarmops.Site.Automation.Geography[] children)
    {
        int count = 0;

        foreach (Swarmops.Site.Automation.Geography child in children)
        {
            count++;
            count += InitDatabaseThreadCountGeographyChildren(child.Children);
        }

        return count;
    }