public List <Appointment> GetAppointmentsByEnd(DateTime endDate) { DataTable dt = new DataTable(); List <Appointment> arrAppointments = new List <Appointment>(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(AppointmentStrings.GetAppointmentsByEnd(endDate)); } foreach (DataRow ms in dt.Rows) { arrAppointments.Add(Appointment.ToObject(ms)); } return(arrAppointments); }
public Appointment UpdateAppointment(Appointment tmpAppointment) { bool avaliable; bool hours; bool days; avaliable = CheckIfAppointmentAvaliable(tmpAppointment.appointmentDate, tmpAppointment.startTime, tmpAppointment.endTime, tmpAppointment.appointmentId); if (avaliable) { //hours = CheckAppointmentTime(tmpAppointment); //if (hours) //{ // days = CheckAppointmentDay(tmpAppointment); // if (days) // { DataTable dt = new DataTable(); Appointment appointment = new Appointment(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(AppointmentStrings.UpdateAppointment(tmpAppointment)); } foreach (DataRow ms in dt.Rows) { appointment = Appointment.ToObject(ms); } return(appointment); } // else // { // throw new DayNotAvaliableException("The Day Is Not Avaliable"); // } // } // else // { // throw new DurationNotAvaliableException("The Duration Is Not Avaliable"); // } //} else { throw new DateNotAvaliableException("The Time Is Not Avaliable"); } }
public Appointment GetOneAppointment(int appointmentId) { if (appointmentId < 0) { throw new ArgumentOutOfRangeException(); } DataTable dt = new DataTable(); Appointment appointment = new Appointment(); using (SqlCommand command = new SqlCommand()) { dt = GetMultipleQuery(AppointmentStrings.GetOneAppointment(appointmentId)); } foreach (DataRow ms in dt.Rows) { appointment = Appointment.ToObject(ms); } return(appointment); }