Esempio n. 1
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);
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        private static void RequestName(GovernmentService service, out string name)
        {
            var check = true;

            name = string.Empty;

            while (check)
            {
                Console.Write("\nCity Name? ");
                name = Console.ReadLine().Trim();
                var muni = service.GetMunicipalByName(name);
                if (muni != null)
                {
                    check = false;
                }
            }
        }
Esempio n. 4
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);
                }
            }
        }