public IList <Appointment> GetAppointmentByPatientFullNameAndDob(string fName, string lName, string dob) { var appointmentList = new List <Appointment>(); var adapter = new appointmentTableAdapter(); var patientRepository = new PatientRepository(); try { using (adapter) { foreach (var row in adapter.GetData().Rows) { var appointment = this.GetAppointmentFromRow((cs3230f16bDataSet.appointmentRow)row); var patient = patientRepository.GetById(appointment.PatientId); if (patient.FirstName.ToLower().Equals(fName) && patient.LastName.ToLower().Equals(lName) && patient.Dob.ToShortDateString().Equals(dob)) { appointmentList.Add(appointment); } } } return(appointmentList); } catch (Exception e) { throw e; } }
public Appointment GetById(int id) { var adapter = new appointmentTableAdapter(); try { using (adapter) { var appointment = adapter.GetData().FirstOrDefault(apt => apt.appointmentID == id); return(this.GetAppointmentFromRow(appointment)); } } catch (Exception e) { throw e; } }
public IList <Appointment> GetAll() { var appointmentList = new List <Appointment>(); var adapter = new appointmentTableAdapter(); try { using (adapter) { foreach (var row in adapter.GetData().Rows) { var appointment = this.GetAppointmentFromRow((cs3230f16bDataSet.appointmentRow)row); appointmentList.Add(appointment); } } return(appointmentList); } catch (Exception e) { throw e; } }
public IList <Appointment> GetAppointmentByPatientId(int patientId) { var appointmentList = new List <Appointment>(); var adapter = new appointmentTableAdapter(); try { using (adapter) { foreach (var row in adapter.GetData().Where(apt => apt.patientID == patientId)) { var appointment = this.GetAppointmentFromRow(row); appointmentList.Add(appointment); } } return(appointmentList); } catch (Exception e) { throw e; } }
public void Update(Appointment appointment) { var adapter = new appointmentTableAdapter(); try { DataRow aptrow; using (adapter) { aptrow = adapter.GetData().FirstOrDefault(apt => apt.appointmentID == appointment.AppointmentId); } if (aptrow == null) { return; } aptrow[1] = appointment.ReasonForAppointment; aptrow[2] = appointment.Date; aptrow[3] = appointment.NureseId; aptrow[4] = appointment.DoctorId; aptrow[5] = appointment.PatientId; aptrow[6] = appointment.SystolicBp; aptrow[7] = appointment.DiastolicBp; aptrow[8] = appointment.Temperature; aptrow[9] = appointment.Pulse; aptrow[10] = appointment.Weight; aptrow[11] = appointment.Symptoms; using (adapter) { adapter.Update(aptrow); } } catch (Exception e) { throw e; } }