/// <summary> /// ProcessLocalityDataforWards /// </summary> private static void ProcessLocalityDataforWards() { string[] files = Directory.GetFiles(@"C:\Users\nairs6\Downloads"); foreach (var file in files) { if (file.Contains(".csv")) { string path = file; WardData.Provider provider = new WardData.Provider(); provider.InsertWard(path); } } }
/// <summary> /// InsertWard Information from CSV /// </summary> private static void ProcessCordinateDataforWards() { string[] directories = Directory.GetDirectories(@"C:\Users\nairs6\Downloads"); //Retrieve the Zone Details WardData.Provider provider = new WardData.Provider(); foreach (var directory in directories) { if (!directory.Contains("Processed")) { string zoneNumber = directory.Substring(directory.LastIndexOf('\\')).Split('-')[0].Replace("\\", ""); string zoneName = directory.Substring(directory.LastIndexOf('\\')).Split('-')[1].Replace(".txt", ""); provider.InsertZone(Convert.ToInt32(zoneNumber), zoneName); Zone zone = provider.RetrieveZone(Convert.ToInt32(zoneNumber)); if (zone == null) { Environment.Exit(0); } Console.WriteLine("The zone selected is " + zone.Name); string[] files = Directory.GetFiles(@"C:\Users\nairs6\Downloads\" + zoneNumber + "-" + zoneName); foreach (var file in files) { if (file.Contains(".txt")) { string wardNumber = file.Substring(file.LastIndexOf('\\')).Split('-')[0].Replace("\\", ""); string wardName = file.Substring(file.LastIndexOf('\\')).Split('-')[1].Replace(".txt", ""); string path = file; provider.InsertWard(zone.Id, Convert.ToInt32(wardNumber), wardName, path); } } } } }