private static void locate(PinAuthorizer tw) { System.Console.WriteLine("Please Type in how many DataLines should be taken (0 for all): "); int takeUserInput = Convert.ToInt32(Console.ReadLine()); System.Console.WriteLine("Please Type in how many Datalines should be skipped (0 for none): "); int skipUserInput = Convert.ToInt32(Console.ReadLine()); System.Console.WriteLine("Please type in the Information intervall: "); int informationIntervall = Convert.ToInt32(Console.ReadLine()); System.Console.WriteLine("Do you want to retrieve Tweets about the progress? (0 no 1 yes)"); int tweetInformation = Convert.ToInt32(Console.ReadLine()); using (knowledgeObjects DB = new knowledgeObjects()) { DB.Configuration.AutoDetectChangesEnabled = false; DB.Configuration.ValidateOnSaveEnabled = false; List<tweetRandomSample2> tweetsCollection = new List<tweetRandomSample2>(); if (takeUserInput == 0) { tweetsCollection = (List<tweetRandomSample2>)(from tweets in DB.tweetRandomSample2 orderby tweets.id select tweets).Skip(skipUserInput).ToList(); } else { tweetsCollection = (List<tweetRandomSample2>)(from tweets in DB.tweetRandomSample2 orderby tweets.id select tweets).Take(takeUserInput).Skip(skipUserInput).ToList(); } Stopwatch stopwatch = new Stopwatch(); TweetInformation ti = new TweetInformation(); TimeSpan timespan = new TimeSpan(); TimeSpan actualTime = new TimeSpan(); TweetLoc tl = new TweetLoc(0); int i = 0; GeoNames knowledgeResult = new GeoNames(); GeoNames tweetCountry = new GeoNames(); foreach (var item in tweetsCollection) { using (GeonamesDataEntities geonamesDB = new GeonamesDataEntities()) { tweetCountry = (from geonames in geonamesDB.GeoNames where geonames.geonameid == item.geoNames_geoNamesId select geonames).ToList().First(); } i++; stopwatch.Start(); ti = new TweetInformation(); ti.userlocation = item.userlocation; ti.timezone = item.timezone; ti.longitude = item.lon; ti.latitude = item.lat; ti.baseDataId = item.id; ti.coord = item.coord; ti.randomSampleId = item.id; tl.saveLocateResults(ti); stopwatch.Stop(); actualTime += stopwatch.Elapsed; timespan += stopwatch.Elapsed; stopwatch.Reset(); if (i % informationIntervall == 0) { string tweetTXT = i + " T " + new RoundedTimeSpan(timespan.Ticks, 2) + " avg " + new RoundedTimeSpan(timespan.Ticks / i, 2) + " avg5k " + new RoundedTimeSpan(actualTime.Ticks / informationIntervall, 2); System.Console.WriteLine(tweetTXT); if (tweetInformation == 1) { statusUpdate("@pide2001 " + tweetTXT, tw); } actualTime = TimeSpan.Zero; } } System.Console.WriteLine("Press any key to quit !"); System.Console.ReadLine(); } }