private void CheckInPatient() { if (SelectedIndex == null) //shouldnt be able to happen but to prevent crash --> return. { return; } int index = int.Parse(SelectedIndex.ToString(), System.Globalization.CultureInfo.InvariantCulture); int appointmentID = int.Parse(FilteredAppointments.Rows[index][0].ToString(), System.Globalization.CultureInfo.InvariantCulture); PatientDBConverter.CheckInPatient(appointmentID); Success("Success!", "Patient has been checked-in."); InitialiseDataTable(); // To refresh table after adjustments --> triggering onpropertychange }
private void CheckIn() { if (RequiredNotComplete()) { Alert("Complete Required Fields!", "Please complete all fields to check in."); return; } DataTable patientRecords = PatientDBConverter.GetAwaitingCheckIn((DateTime)DOB, Firstname, DoorNo, Postcode); if (patientRecords.Rows.Count > 1) { Alert("Could not check in!", "More than one patient has an appointment with the same details provided. Please enter you patient ID or ask a recpetionist" + " for assistance with check-in."); string input = PatientIDBox(); if (string.IsNullOrWhiteSpace(input) || !input.All(char.IsDigit)) { Alert("Incorrect ID.", "Patient ID must be numerical. Please speak to a receptionist."); return; } DataRow[] foundPatient = patientRecords.Select("PatientID = '" + input + "'"); if (foundPatient.Length != 0) { foreach (DataRow row in foundPatient) { int appointmentID = int.Parse(row["AppointmentID"].ToString()); PatientDBConverter.CheckInPatient(appointmentID); } } else { Alert("Could not check in!", "Incorrect Patient ID has been inputted. Please speak to the receptions for assitance with check-in."); return; } } else if (patientRecords.Rows.Count == 0) { Alert("Could not check in!", "Unable to find appointment with details provided. Please confirm details or speak to receptionist. " + "If you are late another appointment may be required."); return; } else { int appointmentID = int.Parse(patientRecords.Rows[0][0].ToString()); PatientDBConverter.CheckInPatient(appointmentID); } Success("Checked-In Successfully", "Please take a seat. Your doctor will see you soon."); ShowHome(); }