Esempio n. 1
0
 private static void PersonalInformation(Physician physician)
 {
     Console.WriteLine("-----------------------------------------------------");
     Console.WriteLine("                Personal Information                 ");
     Console.WriteLine("Employee ID  : " + physician.Id);
     Console.WriteLine("First Name   : " + physician.FirstName);
     Console.WriteLine("Middle Name  : " + physician.MiddleName);
     Console.WriteLine("Last Name    : " + physician.LastName);
     Console.WriteLine("Birthdate    : " + physician.BirthDate.ToShortDateString());
     Console.WriteLine("Gender       : " + physician.Gender);
     Console.WriteLine("Weight       : " + physician.Weight);
     Console.WriteLine("Height       : " + physician.Height);
 }
Esempio n. 2
0
        public static void AddRecord(Physician physician)

        {
            Physician phys = new Physician();

            phys.Id         = physician.Id;
            phys.FirstName  = physician.FirstName;
            phys.MiddleName = physician.MiddleName;
            phys.LastName   = physician.LastName;
            phys.BirthDate  = physician.BirthDate;
            phys.Gender     = physician.Gender;
            phys.Height     = physician.Height;
            phys.Weight     = physician.Weight;

            physicians.Add(phys);
        }
Esempio n. 3
0
 private static void ContactInformation(Physician physician)
 {
     Console.WriteLine("                Contact Information                  ");
     if (physician.ContactInfo != null)
     {
         Console.WriteLine("Home Address     : " + physician.ContactInfo.HomeAddress);
         Console.WriteLine("Home Phone       : " + physician.ContactInfo.HomePhone);
         Console.WriteLine("Office Address   : " + physician.ContactInfo.OfficeAddress);
         Console.WriteLine("Office Phone     : " + physician.ContactInfo.OfficePhone);
         Console.WriteLine("E-mail Address   : " + physician.ContactInfo.EmailAddress);
         Console.WriteLine("Cellphone Number : " + physician.ContactInfo.CellphoneNumber);
     }
     else
     {
         Console.WriteLine("No contact information available.");
     }
 }
Esempio n. 4
0
        private static void AddPhysician()
        {
            Console.Clear();
            Console.WriteLine("______________________________Add Physician_____________________________");

            Console.WriteLine("________________________________________________________________________");


            Physician input = new Physician();


            if (physicians.Count > 0)
            {
                input.Id = physicians.Last().Id + 1;
            }
            else
            {
                input.Id = 1;
            }

            Console.Write("First Name: ");
            input.FirstName = Console.ReadLine();

            Console.Write("Middle Name: ");
            input.MiddleName = Console.ReadLine();

            Console.Write("Last Name: ");
            input.LastName = Console.ReadLine();

            Console.Write("Birth Date: ");
            input.BirthDate = Convert.ToDateTime(Console.ReadLine());

            Console.Write("Gender:");
            input.Gender = Console.ReadLine();

            Console.Write("Weight:");
            input.Weight = Convert.ToInt32(Console.ReadLine());

            Console.Write("Height:");
            input.Height = Convert.ToInt32(Console.ReadLine());


            AddRecord(input);
            ViewAllPhysician();
        }
Esempio n. 5
0
        private static void AddPhysicianRecord()
        {
            try
            {
                Console.Clear();
                HospitalMenuHeader();
                Console.WriteLine("|              Add Physician Form                   |");
                Console.WriteLine("=====================================================");

                Physician physician = new Physician();
                physician.ContactInfo    = new ContactInfo();
                physician.Specialization = new List <Specialization>();

                Specialization specialization = new Specialization();

                if (physicians.Count > 0)
                {
                    physician.Id = physicians.Last().Id + 1;
                }
                else
                {
                    physician.Id = 1;
                }

                Console.WriteLine("|              Personal Information                 |");
                Console.WriteLine("-----------------------------------------------------");
                physician.FirstName = HospitalFormField("First Name ", "", false);
                while (!allowLettersOnly(physician.FirstName))
                {
                    physician.FirstName = HospitalFormField("First Name ", "", false);
                }
                physician.MiddleName = HospitalFormField("Middle Name ", "", false);
                while (!allowLettersOnly(physician.MiddleName))
                {
                    physician.MiddleName = HospitalFormField("Middle Name ", "", false);
                }
                physician.LastName = HospitalFormField("Last Name ", "", false);
                while (!allowLettersOnly(physician.LastName))
                {
                    physician.LastName = HospitalFormField("Last Name ", "", false);
                }
                physician.BirthDate = HospitalFormDateTimeField("Birthdate ", default(DateTime), false);
                physician.Gender    = HospitalFormField("Gender ", "", false);
                while (!allowLettersOnly(physician.Gender))
                {
                    physician.Gender = HospitalFormField("Gender ", "", false);
                }
                physician.Weight = HospitalFormDecimalField("Weight ", 0.00, false);
                physician.Height = HospitalFormDecimalField("Height ", 0.00, false);
                Console.WriteLine("-----------------------------------------------------");
                Console.WriteLine("|              Contact Information                  |");
                Console.WriteLine("-----------------------------------------------------");
                physician.ContactInfo.HomeAddress = HospitalFormField("Home Address ", "", false);
                physician.ContactInfo.HomePhone   = HospitalFormField("Home Phone ", "", false);
                while (!allowNumbersOnly(physician.ContactInfo.HomePhone, false))
                {
                    physician.ContactInfo.HomePhone = HospitalFormField("Home Phone ", "", false);
                }
                physician.ContactInfo.OfficeAddress = HospitalFormField("Office Address ", "", false);
                physician.ContactInfo.OfficePhone   = HospitalFormField("Office Phone ", "", false);
                while (!allowNumbersOnly(physician.ContactInfo.OfficePhone, false))
                {
                    physician.ContactInfo.OfficePhone = HospitalFormField("Office Phone ", "", false);
                }
                physician.ContactInfo.EmailAddress    = HospitalFormField("E-mail Address ", "", false);
                physician.ContactInfo.CellphoneNumber = HospitalFormField("Cellphone Number ", "", false);
                while (!allowNumbersOnly(physician.ContactInfo.CellphoneNumber, false))
                {
                    physician.ContactInfo.CellphoneNumber = HospitalFormField("Cellphone Number ", "", false);
                }
                Console.WriteLine("-----------------------------------------------------");
                Console.WriteLine("|              Specializations                      |");
                Console.WriteLine("-----------------------------------------------------");
                Console.Write("How many specializations? ");
                int specializationCount = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("");
                for (int i = 0; i < specializationCount; i++)
                {
                    specialization         = new Specialization();
                    specialization.Name    = HospitalFormField("Name ", "", false);
                    specialization.Remarks = HospitalFormField("Remarks ", "", false);
                    Console.WriteLine();
                    physician.Specialization.Add(specialization);
                }

                physicians.Add(physician);
                HospitalMenu();
            }
            catch (Exception e)
            {
                defaultError();
                goBackToMainMenu();
            }
        }
Esempio n. 6
0
        private static void UpdatePhysicianRecordById()
        {
            try
            {
                Console.Clear();
                HospitalMenuHeader();
                Console.Write("Please enter employee ID to update records : ");
                int id = Convert.ToInt32(Console.ReadLine());

                List <Physician> physicianRecords = new List <Physician>();
                physicianRecords = physicians.Where(x => x.Id == id).ToList();
                Physician newPhysicianRecord = new Physician();

                if (physicianRecords.Count > 0)
                {
                    foreach (var physician in physicianRecords)
                    {
                        Console.WriteLine("-----------------------------------------------------");
                        Console.WriteLine("                Personal Information                 ");
                        newPhysicianRecord.Id        = physician.Id;
                        newPhysicianRecord.FirstName = HospitalFormField("First Name ", physician.FirstName, true);
                        while (!allowLettersOnly(newPhysicianRecord.FirstName))
                        {
                            newPhysicianRecord.FirstName = HospitalFormField("First Name ", physician.FirstName, true);
                        }
                        newPhysicianRecord.MiddleName = HospitalFormField("Middle Name ", physician.MiddleName, true);
                        while (!allowLettersOnly(newPhysicianRecord.MiddleName))
                        {
                            newPhysicianRecord.MiddleName = HospitalFormField("Middle Name ", physician.MiddleName, true);
                        }
                        newPhysicianRecord.LastName = HospitalFormField("Last Name ", physician.LastName, true);
                        while (!allowLettersOnly(newPhysicianRecord.LastName))
                        {
                            newPhysicianRecord.LastName = HospitalFormField("Last Name ", physician.LastName, true);
                        }
                        newPhysicianRecord.BirthDate = HospitalFormDateTimeField("Birthdate ", physician.BirthDate, true);
                        newPhysicianRecord.Gender    = HospitalFormField("Gender ", physician.Gender, true);
                        while (!allowLettersOnly(newPhysicianRecord.Gender))
                        {
                            newPhysicianRecord.Gender = HospitalFormField("Gender ", physician.Gender, true);
                        }
                        newPhysicianRecord.Weight = HospitalFormDecimalField("Weight ", physician.Weight, true);
                        newPhysicianRecord.Height = HospitalFormDecimalField("Height ", physician.Height, true);
                        Console.WriteLine("                Contact Information                  ");
                        newPhysicianRecord.ContactInfo             = new ContactInfo();
                        newPhysicianRecord.ContactInfo.HomeAddress = HospitalFormField("Home Address ", physician.ContactInfo.HomeAddress, true);
                        newPhysicianRecord.ContactInfo.HomePhone   = HospitalFormField("Home Phone ", physician.ContactInfo.HomePhone, true);
                        while (!allowNumbersOnly(newPhysicianRecord.ContactInfo.HomePhone, false))
                        {
                            newPhysicianRecord.ContactInfo.HomePhone = HospitalFormField("Home Phone ", physician.ContactInfo.HomePhone, true);
                        }
                        newPhysicianRecord.ContactInfo.OfficeAddress = HospitalFormField("Office Address ", physician.ContactInfo.OfficeAddress, true);
                        newPhysicianRecord.ContactInfo.OfficePhone   = HospitalFormField("Office Phone ", physician.ContactInfo.OfficePhone, true);
                        while (!allowNumbersOnly(newPhysicianRecord.ContactInfo.OfficePhone, false))
                        {
                            newPhysicianRecord.ContactInfo.OfficePhone = HospitalFormField("Office Phone ", physician.ContactInfo.OfficePhone, true);
                        }
                        newPhysicianRecord.ContactInfo.EmailAddress    = HospitalFormField("E-mail Address ", physician.ContactInfo.EmailAddress, true);
                        newPhysicianRecord.ContactInfo.CellphoneNumber = HospitalFormField("Cellphone Number ", physician.ContactInfo.CellphoneNumber, true);
                        while (!allowNumbersOnly(newPhysicianRecord.ContactInfo.CellphoneNumber, false))
                        {
                            newPhysicianRecord.ContactInfo.CellphoneNumber = HospitalFormField("Cellphone Number ", physician.ContactInfo.CellphoneNumber, true);
                        }

                        Specialization newSpecializationRecord = new Specialization();
                        newPhysicianRecord.Specialization = new List <Specialization>();

                        Console.WriteLine("                Specializations                      ");
                        foreach (var specialization in physician.Specialization)
                        {
                            newSpecializationRecord         = new Specialization();
                            newSpecializationRecord.Name    = HospitalFormField("Name ", specialization.Name, true);
                            newSpecializationRecord.Remarks = HospitalFormField("Remarks ", specialization.Remarks, true);
                            newPhysicianRecord.Specialization.Add(newSpecializationRecord);
                        }

                        Console.Write("Are you sure you want to update employee records (Yes/No)? ");
                        var response = Console.ReadLine();
                        if (response.Trim().Equals("Yes", StringComparison.InvariantCultureIgnoreCase))
                        {
                            var  prevRecordToBeDeleted = physicians.Single(r => r.Id == id);
                            bool result = physicians.Remove(prevRecordToBeDeleted);

                            if (result)
                            {
                                physicians.Add(newPhysicianRecord);
                            }
                            Console.ForegroundColor = ConsoleColor.Green;
                            Console.WriteLine("Employee records successfully updated.");
                            Console.ResetColor();
                        }
                        else if (response.Trim().Equals("No", StringComparison.InvariantCultureIgnoreCase))
                        {
                            Console.ForegroundColor = ConsoleColor.Blue;
                            Console.WriteLine("Employee records not updated.");
                            Console.ResetColor();
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.DarkRed;
                            Console.WriteLine("Invalid input, record not updated.");
                            Console.ResetColor();
                        }
                        Console.WriteLine("-----------------------------------------------------");
                    }
                }
                else
                {
                    Console.WriteLine("|             No Available Records                  |");
                }
                HospitalMenuFooter();
            }
            catch (Exception)
            {
                defaultError();
                goBackToMainMenu();
            }
        }