/// <summary> /// This method will update the Appointments table /// when the checked in status is changed to true. /// </summary> public void UpdateAppointments(int appointmentId) { healthcareDBContext = new HealthcareDBDataContext(); // Retrieve the appointment equal to the Id parameter passed into the method. var appointment = (from a in healthcareDBContext.Appointments where a.AppointmentId == appointmentId select a).First(); try { // Check if status is not true meaning the patient // is not yet checked in, in the Appointments table if (!appointment.Status) { // Set status to true appointment.Status = true; healthcareDBContext.SubmitChanges(); } } catch (Exception) { throw; } }
/// <summary> /// Use this method to change the patients check in /// status to false. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void UncheckInPatients() { healthcareDBContext = new HealthcareDBDataContext(); var appointments = from a in healthcareDBContext.Appointments select a; foreach (var appointment in appointments) { appointment.Status = false; healthcareDBContext.SubmitChanges(); } }