示例#1
0
        private static void GeneralTest()
        {
            var service = new GovernmentService();

            var munis = service.GetMunicipalities();
            var adds  = service.GetAddresses();
            var offs  = service.GetOfficials();

            service.DisplayText("MUNICIPALITIES");

            foreach (var item in munis)
            {
                Console.WriteLine($"#{item.MunicipalNumber} Name: {item.MunicipalName}");
            }

            service.DisplayText("OFFICIALS");

            foreach (var item in offs)
            {
                Console.WriteLine($"Position: {item.Position} Name: {item.FullName}");
            }

            service.DisplayText("ADDRESSES");

            foreach (var item in adds)
            {
                Console.WriteLine($"{item.MailingAddressLine1} {item.MailingAddressLine2}, {item.City}, {item.State} {item.Zip}");
            }

            Console.ReadLine();
        }
示例#2
0
        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);
        }
示例#3
0
        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();
        }
示例#4
0
        private static void GetGovernmentFiles(string name)
        {
            var service = new GovernmentService();
            var muni    = service.GetMunicipalByName(name);
            var files   = service.GetGovFilesByMunicipalNumber(muni.MunicipalNumber);

            service.DisplayText("GovernmentFiles");

            if (files.Count() == 0)
            {
                Console.WriteLine("Files Not Found");
            }
            else
            {
                var index = 1;

                files.ForEach(f =>
                {
                    Console.WriteLine($"{index}) {f.Name} {f.Description}");
                    index++;
                });
            }

            Console.WriteLine();
        }
示例#5
0
        private static void MunicipalLookUp(string name = null)
        {
            var service = new GovernmentService();

            var check = true;

            while (check)
            {
                if (string.IsNullOrWhiteSpace(name))
                {
                    RequestName(service, out name);
                }
                Console.WriteLine("Processing...");
                GetFullMinicipalInfoByNameTest(name);

                //Exit
                var contCheck = true;
                while (contCheck)
                {
                    service.DisplayText("Menu");
                    Console.WriteLine("1) GovernmentFiles");
                    Console.WriteLine("2) GovernmentFiles By Official");
                    Console.WriteLine("3) Another Municipality");
                    Console.WriteLine("4) Exit");
                    Console.WriteLine();
                    var answer = Console.ReadLine().Trim();

                    switch (answer)
                    {
                    case "1":
                        contCheck = false;
                        GetGovernmentFiles(name);
                        break;

                    case "2":
                        contCheck = false;
                        GetOfficial(name);
                        break;

                    case "3":
                        contCheck = false;
                        break;

                    case "4":
                        Console.WriteLine("Goodbye");
                        contCheck = false;
                        check     = false;
                        break;

                    default:
                        contCheck = true;
                        Console.WriteLine();
                        break;
                    }
                    name   = string.Empty;
                    answer = string.Empty;
                }
            }
        }
示例#6
0
        private static void GetMunicipalByAddressTest(AddressRequest address = null)
        {
            var service = new GovernmentService();

            if (address == null)
            {
                RequestAddress(out address);
            }

            var muni = service.GetMunicipalByAddress(address);

            if (muni == null)
            {
                service.DisplayText("Municipal Not Found");
            }

            service.DisplayText($"Municipal: {muni.MunicipalName}");

            Console.ReadLine();
        }
示例#7
0
        private static void GovernmentFilesByOfficial(GovernmentService service, int id)
        {
            service.DisplayText("Government Files");
            var files = service.GetGovernmentFilesByOfficialId(id);

            if (files.Count() == 0)
            {
                Console.WriteLine("Files Not Found");
                return;
            }
            else
            {
                var index = 1;
                files.ForEach(f =>
                {
                    Console.WriteLine($"{index}) {f.Name} {f.Description}");
                    index++;
                });
            }
        }
示例#8
0
        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);
                }
            }
        }