public static void PatientPrescriptionMenu(Prescription prescription) { while (true) { Console.WriteLine($"Menu Options for Prescription {prescription.PrescriptionName}"); Console.WriteLine("\t0 - Exit Prescription Menu"); Console.WriteLine("\t1 - Add Refill"); Console.WriteLine("\t2 - List Refills"); Console.WriteLine("\t3 - Modify Refill"); Console.WriteLine("\t4 - Take Prescription Dose"); switch (ConsoleIntProcessing($"Enter Menu Option: ")) { case 0: return; case 1: Processing.AddRefill(prescription.PrescriptionID, prescription.PrescriptionPatientID); break; case 2: Console.WriteLine("\tListing Patient Refills"); var refillList = Processing.ListRefillsByPatientID(prescription.PrescriptionPatientID); if (refillList.Count() > 0) { ListRefillOutput(refillList); } else { Console.WriteLine("\t[~] No Prescriptions Eligible For Refill"); } break; case 3: break; case 4: //TODO: Patient Menu - Take Prescription Dose int doseAmmount = Processing.db.Prescriptions.First(a => a.PrescriptionID == prescription.PrescriptionID).PrescriptionPillDose; int currentQuantity = Processing.db.Prescriptions.First(a => a.PrescriptionID == prescription.PrescriptionID).PrescriptionPillQuantityRemaining; if (currentQuantity > doseAmmount) { int remainingQuantity = currentQuantity - doseAmmount; Console.WriteLine($"\t\tPatient {Processing.ReturnIndividualPatient(prescription.PrescriptionPatientID).PatientFullName} taking {prescription.PrescriptionPillDose} pills of {prescription.PrescriptionName}"); Processing.TakeDose(prescription.PrescriptionID, doseAmmount); Console.WriteLine($"\t\tRemaining Prescription Quantity: {prescription.PrescriptionPillQuantityRemaining}"); } else { if ((Processing.db.Prescriptions.First(a => a.PrescriptionID == prescription.PrescriptionID).PrescriptionRefillRemaining <= 0) || (currentQuantity > 0 && currentQuantity < doseAmmount)) { Console.WriteLine($"[~] Patient Needs To Apply For A Refill To Take Dose"); } else { Console.WriteLine($"[!] Patient Has No More Refills - Not Enough Prescription Quantity For Full Dose - Contact Doctor"); } } break; } } }
public static void AdminMenu() { while (true) { Console.WriteLine("~ Admin Menu Options ~"); Console.WriteLine("\t\tAdmin listing also displays disabled entries"); Console.WriteLine("\t0 - Exit Admin Menu"); Console.WriteLine("\t1 - List All Transactions"); Console.WriteLine("\t2 - List All Patients"); Console.WriteLine("\t3 - List ALl Prescriptions"); Console.WriteLine("\t4 - List All Refills"); Console.WriteLine("\t5 - Fill Patient Refill"); Console.WriteLine("\t6 - Disable Patient"); Console.WriteLine("\t7 - Delete Patient"); Console.WriteLine("\t8 - Disable Prescription"); Console.WriteLine("\t9 - Delete Prescription"); Console.WriteLine("\t10 - Delete Refill"); switch (ConsoleIntProcessing("Enter Menu Option: ")) { case 0: return; case 1: //TODO: Admin Menu - Create List All Transaction var transaction = Processing.ListAllTransactions(); if (transaction.Count() > 0) { Console.WriteLine($"ID | Patient ID | Logged Action | Log Date Time"); foreach (var trans in transaction) { Console.WriteLine($"{trans.TransactionID} | {trans.TransactionPatientID} | {trans.TransactionAction} | {trans.TransactionEntryDateTime}"); } } break; case 2: //DONE: Admin Menu - Create List All Patients var patientsList = Processing.ListAllPatients(); if (patientsList.Count() > 0) { ListPatientOutput(patientsList); } else { Console.WriteLine("[!] No Patients to List"); } break; case 3: //DONE: Admin Menu - Create List All Precriptions var rxList = Processing.ListPrescriptions(); if (rxList.Count() > 0) { Console.WriteLine("\nListing All Entered Prescriptions"); ListPrescriptionOutput(rxList); } else { Console.WriteLine("[!] No Prescriptions to List"); } break; case 4: //DONE: Admin Menu - Create List All Refills var refillList = Processing.ListRefillsAll(); if (refillList.Count() > 0) { Console.WriteLine("\nListing All Entered Refills"); } else { Console.WriteLine("[!] No Refills to List"); } break; case 5: //HIGH: Admin Menu - Create Fill Patient Refill //List refills with filled = false //Select refill based on ID //Set filled to true //Decrement prescription refillRemaining countm var adminRefillList = Processing.AdminListRefillNeedFilled(); if (adminRefillList.Count() > 0) { Console.WriteLine("ID | Patient ID | RX ID | Refill Entry Date"); foreach (var item in adminRefillList) { Console.WriteLine($"{item.RefillID} | {item.RefillPatientID} | {item.RefillRxID} | {item.RefillEntryDate.ToString("d")}"); } int selection = ConsoleIntProcessing("Enter Refill ID: "); } else { Console.WriteLine("[!] No Refills to Fill"); } break; case 6: //TODO: Admin Menu - Create Disable Patient break; case 7: //TODO: Admin Menu - Create Delete Patient break; case 8: //TODO: Admin Menu - Create Disable Precription break; case 9: //TODO: Admin Menu - Create Delete Prescription break; case 10: //TODO: Admin Menu - Create Delete Refill break; } } }
public static void PatientMenu(Patient selectedPatient) { while (true) { int refillCount = Processing.ListPrescriptionRefillActiveByPatientID(selectedPatient.PatientID).Count(); Console.WriteLine($"Patient Menu Options for {selectedPatient.PatientFullName}"); Console.WriteLine("\t0 - Exit Patient Menu"); Console.WriteLine("\t1 - Add Prescriptions"); Console.WriteLine("\t2 - List Active Prescription"); Console.WriteLine("\t3 - Select Prescription"); Console.WriteLine("\t4 - Modify Patient Information"); Console.WriteLine($"\t5 - List Available Refills - {refillCount} Prescription(s)"); Console.WriteLine("\t8 - Disable Patient"); Console.WriteLine("\t9 - List Patient Transactions"); switch (ConsoleIntProcessing("Enter Menu Option: ")) { case 0: return; case 1: //TODO: Patient Menu - Add Prescription Console.Write("Prescription Name: "); string rxName = Console.ReadLine(); int refillQuantity = ConsoleIntProcessing("Prescription Refill Count: "); int pillQuantity = ConsoleIntProcessing("Prescription Quantity: "); int indivDose = ConsoleIntProcessing("Prescription Dose (Ex. \"2\" for 2Pills): "); DateTime expireDate = ConsoleDateProcessing("Prescription Expire Date: ", "Expire"); Processing.AddPrescription(selectedPatient.PatientID, rxName, refillQuantity, pillQuantity, indivDose, expireDate); break; case 2: //TODO: Patient Menu - List Prescriptions ListPrescriptionOutput(Processing.ListPrescriptionsByPatientID(selectedPatient.PatientID)); break; case 3: //TODO: Patient Menu - Select Prescriptions //foreach(var rx in Processing.db.Prescriptions) //{ // Console.WriteLine($"Rx ID: {rx.PrescriptionID} | Rx Name: {rx.PrescriptionName} | Rx Quantity: {rx.PrescriptionPillQuanity} | Rx Expire Date: {rx.PrescriptionExpireDate.ToString("d")}"); //} ListPrescriptionOutput(Processing.ListPrescriptionsByPatientID(selectedPatient.PatientID)); int selection = ConsoleIntProcessing("Select Prescription ID: "); if (selection != 0) { PatientPrescriptionMenu(Processing.SelectPrescription(selection)); } break; case 4: //TODO: Patient Menu - Modify Patient Console.WriteLine("\nModify Patient - Press enter to skip"); Patient updatedPatient = selectedPatient; bool nameChange = false; Console.WriteLine($"\tCurrent First Name: {selectedPatient.PatientFirstName}"); Console.Write("\tUpdated First Name: "); string firstName = Console.ReadLine(); if ((firstName != "") && (firstName != selectedPatient.PatientFirstName)) { updatedPatient.PatientFirstName = firstName; nameChange = true; } else { updatedPatient.PatientFirstName = selectedPatient.PatientFirstName; } Console.WriteLine($"\tCurrent Last Name: {selectedPatient.PatientLastName}"); Console.Write("\tUpdate Last Name: "); string lastName = Console.ReadLine(); if ((lastName != "") && (lastName != selectedPatient.PatientLastName)) { updatedPatient.PatientLastName = lastName; nameChange = true; } else { updatedPatient.PatientLastName = selectedPatient.PatientLastName; } if (nameChange) { updatedPatient.PatientFullName = $"{lastName}, {firstName}"; } Console.WriteLine($"\tCurrent Birth Date: {selectedPatient.PatientBirthDate.ToString("d")}"); char response = ConsoleYesNoProcessing("Modify Birthdate (Y/N): "); if (response == 'y' || response == 'Y') { DateTime birthDate = ConsoleDateProcessing("\tUpdate Birthdate: ", "Birth"); updatedPatient.PatientBirthDate = birthDate; } else { updatedPatient.PatientBirthDate = selectedPatient.PatientBirthDate; } Processing.ModifyPatient(updatedPatient); break; case 8: //TODO: Patient Menu - Disable Patient break; case 9: //TODO: Patient Menu - List Patient Transactions break; } } }
public static void MainMenu() { while (true) { Console.WriteLine("~ Main Menu Options ~"); Console.WriteLine("\t0 - Exit Application"); Console.WriteLine("\t1 - Add Patient"); Console.WriteLine("\t2 - List Patient"); Console.WriteLine("\t3 - Select Patients"); Console.WriteLine("\t4 - "); Console.WriteLine("\t10 ~ Patient Admin Menu ~"); switch (ConsoleIntProcessing("Enter Menu Option: ")) { case 0: return; case 1: try { //Done: Menu - Add Patient with brithdate Console.WriteLine("~ Add Patient ~"); Console.Write("\tPatient First Name: "); string firstName = Console.ReadLine(); Console.Write("\tPatient Last Name: "); string lastName = Console.ReadLine(); string email = ConsoleEmailProcessing("Enter Email: "); DateTime birthDate = ConsoleDateProcessing("\tPatient Birth Date: ", "Birth"); Processing.AddPatient(firstName, lastName, email, birthDate); Console.WriteLine("Patient Added to Database"); } catch (FormatException) { } break; case 2: //DONE: Menu - List Patients Console.WriteLine(); ListPatientOutput(Processing.ListAllPatients()); break; case 3: //DONE: Menu - Select Patients if (Processing.db.Patients.Count() > 0) { Console.WriteLine(); ListPatientOutput(Processing.ListAllPatients()); } Patient selectedPatient = Processing.SelectPatient(ConsoleIntProcessing("Select Patient ID: ")); PatientMenu(selectedPatient); break; case 4: //LOW: Menu - break; case 10: //TODO: Menu - Admin Menu AdminMenu(); break; } Console.WriteLine(); } }