static void TransferPatient(List <Patient> pList, List <Bed> bList) { DisplayPatientsM(pList); Console.Write("Enter patientID number: "); string p_ID = Console.ReadLine(); DisplayBeds(bList); Console.Write("Select bed to transfer: "); int num = Convert.ToInt32(Console.ReadLine()); BedStay bedStay = new BedStay(); Console.Write("Date of Transfer (DD/MM/YYYY): "); string d = Console.ReadLine(); string[] d2 = d.Split('/'); DateTime Transfer = new DateTime(Convert.ToInt32(d2[2]), Convert.ToInt32(d2[1]), Convert.ToInt32(d2[0])); Bed N = bList[num - 1]; if (N.Available != false) { if (N is ClassABed) { ClassABed ba = (ClassABed)N; Console.Write("Any accompanying guest?(Additional $100 per day)[Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { ba.AccompanyingPerson = true; bedStay = new BedStay(Transfer, ba); } else if (answer == "N") { ba.AccompanyingPerson = false; bedStay = new BedStay(Transfer, ba); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } else if (N is ClassBBed) { ClassBBed bb = (ClassBBed)N; Console.Write("Is AirCon needed (Additional $50 per week)? [Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bb.AirCon = true; bedStay = new BedStay(Transfer, bb); } else if (answer == "N") { bb.AirCon = false; bedStay = new BedStay(Transfer, bb); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } else { ClassCBed bc = (ClassCBed)N; Console.Write("Is a portable TV required (Additional $30 one time cost) [Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bc.PortableTv = true; bedStay = new BedStay(Transfer, bc); } else if (answer == "N") { bc.PortableTv = false; bedStay = new BedStay(Transfer, bc); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } foreach (Patient p in pList) { if (p.Id == p_ID) { p.Stay.BedstayList[p.Stay.BedstayList.Count - 1].EndBedstay = Transfer; p.Stay.BedstayList[p.Stay.BedstayList.Count - 1].Bed.Available = true; Console.WriteLine("{0} will be transferred to Ward {1} Bed {2} on {3}", p.Name, N.WardNo, N.BedNo, Transfer.ToString("dd/MM/yyyy")); p.Stay.AddBedstay(bedStay); } } N.Available = false; } }
public void AddBedstay(BedStay bs) { BedstayList.Add(bs); }
static void RegisterHospitalStay(List <Patient> pList, List <Bed> bList) { DisplayPatientsRetrieve(pList); Console.Write("Enter patient ID number: "); string Patientid = Console.ReadLine().ToUpper(); DisplayBeds(bList); Console.Write("\nSelect bed to stay: "); int bednum = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter Date of Admission (DD/MM/YYYY): "); string d = Console.ReadLine(); string[] d2 = d.Split('/'); DateTime Dates = new DateTime(Convert.ToInt32(d2[2]), Convert.ToInt32(d2[1]), Convert.ToInt32(d2[0])); BedStay newbedStay = new BedStay(); Bed b = bList[bednum - 1]; if (b.Available != false) { if (b is ClassABed) { ClassABed bl = (ClassABed)b; Console.Write("Any accompanying guest?(Additional $100 per day)[Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bl.AccompanyingPerson = true; newbedStay = new BedStay(Dates, bl); } else if (answer == "N") { bl.AccompanyingPerson = false; newbedStay = new BedStay(Dates, bl); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } else if (b is ClassBBed) { ClassBBed bb = (ClassBBed)b; Console.Write("Is AirCon needed? [Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bb.AirCon = true; newbedStay = new BedStay(Dates, bb); } else if (answer == "N") { bb.AirCon = false; newbedStay = new BedStay(Dates, bb); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } else { ClassCBed bc = (ClassCBed)b; Console.Write("Is a portable TV required? [Y/N]: "); string answer = Console.ReadLine().ToUpper(); if (answer == "Y") { bc.PortableTv = true; newbedStay = new BedStay(Dates, bc); } else if (answer == "N") { bc.PortableTv = false; newbedStay = new BedStay(Dates, bc); } else { Console.WriteLine("Incorrect Input, Please Try again..."); } } foreach (Patient p in pList) { if (p.Id == Patientid) { Stay NewStay = new Stay(Dates, p); NewStay.AddBedstay(newbedStay); p.Stay = NewStay; p.Status = "Admitted"; } } b.Available = false; Console.WriteLine("\n\nStay registration successful!\n"); } else { Console.WriteLine("Bed does not exist. ."); Console.WriteLine("Stay registration unsucessful\n"); } }