Beispiel #1
0
        protected void ProcessPhysician(Event evt)
        {
            PhysicianRepo    _repo    = new PhysicianRepo();
            List <Physician> _doctors = _repo.GetAll().Cast <Physician>().ToList();
            int _count = _doctors.Count();

            Console.WriteLine();

            if (_count > 0)
            {
                for (int i = 0; i < _count; i++)
                {
                    Console.WriteLine($"{i + 1} {_doctors[i]}");
                }

                Console.WriteLine($"{_count + 1} Add a physician");
                Console.WriteLine();

                int _option = GetOption("Please enter your selection: ", _count + 1);

                if (_option == _count + 1)
                {
                    PhysicianView _pv = new PhysicianView();
                    _pv.Add(evt.Physician);
                }
                else
                {
                    --_option;                                      // Decrement _option to accommodate zero-based indexing
                    evt.Physician = _doctors[_option];
                }
            }
            else
            {
                PhysicianView _pv = new PhysicianView();
                _pv.Add(evt.Physician);
            }
        }
        internal void Add(Physician physician)
        {
            PopulatePersonData(physician);
            PopulateAddressData(physician.Address);
            PopulatePhoneData(physician.phoneNumbers);

            Console.Write("Web address: ");
            physician.WebAddress = Console.ReadLine();
            Console.Write("Organization: ");
            physician.Organization = Console.ReadLine();
            Console.Write("Specialty: ");
            physician.Specialty = Console.ReadLine();

            Console.Write("Is this physician the primary care physician: ");
            string answer = Console.ReadLine();

            if (answer.Substring(0, 1).ToLower().Equals("y"))
            {
                physician.PriCarePhy = true;
            }
            else
            {
                physician.PriCarePhy = false;
            }

            Console.Write("Is this physician a surgeon: ");
            answer = Console.ReadLine();

            if (answer.Substring(0, 1).ToLower().Equals("y"))
            {
                physician.Surgeon = true;
            }
            else
            {
                physician.Surgeon = false;
            }

            Console.Write("Education: ");
            physician.Education = Console.ReadLine();
            Console.Write("Residency: ");
            physician.Residency = Console.ReadLine();
            Console.Write("Fellowship: ");
            physician.Fellowship = Console.ReadLine();

            string _option = null;

            do
            {
                Console.Write("Enter the languages this physician is fluent in (enter end for none or no more): ");
                _option = Console.ReadLine();

                if (!_option.Equals("end"))
                {
                    physician.languagesSpoken.Add(_option);
                }
            } while (_option != "end");

            do
            {
                Console.Write("Enter the name of a hospital this physician is a member of (enter end for none or no more): ");
                _option = Console.ReadLine();

                if (!_option.Equals("end"))
                {
                    physician.hospitalMemberships.Add(_option);
                }
            } while (_option != "end");

            do
            {
                Console.Write("Enter a board certification for this physician (enter end for none or no more): ");
                _option = Console.ReadLine();

                if (!_option.Equals("end"))
                {
                    physician.boardCertifications.Add(_option);
                }
            } while (_option != "end");

            do
            {
                Console.Write("Enter a special interest of this physician (enter end for none or no more): ");
                _option = Console.ReadLine();

                if (!_option.Equals("end"))
                {
                    physician.specialInterests.Add(_option);
                }
            } while (_option != "end");

            PhysicianRepo repo = new PhysicianRepo();

            repo.Add(physician);

            Console.WriteLine("\nAdded new physician.");
        }