private static void GetFullMinicipalInfoByAddressTest(AddressRequest address = null) { var service = new GovernmentService(); if (address == null) { RequestAddress(out address); } //Get Municipal Info var muni = service.GetMunicipalByAddress(address); if (muni == null) { service.DisplayText("Municipal Not Found"); } service.DisplayText($"Municipal: {muni.MunicipalName}"); service.DisplayText("Officials"); //Get Officials var officials = service.GetOfficialsByMunicipalNumber(muni.MunicipalNumber).OrderBy(o => o.FullName).ToList(); officials.ForEach(o => { Console.WriteLine($"{o.Position}: {o.FullName}"); }); Console.ReadLine(); }
private static bool GetFullMinicipalInfoByNameTest(string name) { var service = new GovernmentService(); //Get Municipal Info var muni = service.GetMunicipalByName(name); if (muni == null) { service.DisplayText("Municipal Not Found"); return(false); } Console.SetCursorPosition(Console.CursorLeft, Console.CursorTop - 1); Console.WriteLine(" "); service.DisplayText($"Municipal: {muni.MunicipalName}"); service.DisplayText("Officials"); //Get Officials var officials = service.GetOfficialsByMunicipalNumber(muni.MunicipalNumber).OrderBy(o => o.Position).ToList(); officials.ForEach(o => { Console.WriteLine($"{o.Position}: {o.FullName}"); }); //Get GovernmentFiles //service.DisplayText("Government Files"); //var files = service.GetGovFilesByMunicipalNumber(muni.MunicipalNumber); //files.ForEach(f => { Console.WriteLine($"{f.Name}, {f.Description}"); }); return(true); }
private static void GetOfficialsByMunicipalTest(string number) { var service = new GovernmentService(); var officials = service.GetOfficialsByMunicipalNumber(number).OrderBy(o => o.FullName).ToList(); officials.ForEach(o => { Console.WriteLine($"{o.Position}: {o.FullName}"); }); Console.ReadLine(); }
private static void GetOfficial(string name) { var service = new GovernmentService(); var result = 0; var check = true; var initial = true; //Get Municipal Info var muni = service.GetMunicipalByName(name); var officials = service.GetOfficialsByMunicipalNumber(muni.MunicipalNumber); while (check) { if (initial) { service.DisplayText("Choose an official"); for (int i = 0; i < officials.Count(); i++) { Console.WriteLine($"{i+1}) {officials[i].Position} {officials[i].FullName}"); } Console.WriteLine(); initial = false; } else { Console.Write("Choose an official: "); } var answer = Console.ReadLine().Trim(); if (int.TryParse(answer, out result) && result <= officials.Count() - 1) { check = false; GovernmentFilesByOfficial(service, officials[result - 1].Id); } } }