/// <summary> /// Creates new AppointmentInfo /// </summary> /// <returns>True if appointment was successfully created, false otherwise</returns> private void InsertNewAppointment() { try { // prepare appointment var appointment = new AppointmentInfo() { AppointmentPatientFirstName = FirstName.Value, AppointmentPatientLastName = LastName.Value, AppointmentPatientEmail = Email.Value, AppointmentPatientBirthDate = DateTime.ParseExact(DateOfBirth.Value, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture), AppointmentDate = DateTime.ParseExact(DateOfAppointment.Value, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture), AppointmentDoctorID = ValidationHelper.GetInteger(SelectDoctor.SelectedValue, 0), AppointmentPatientPhoneNumber = TelephoneNumber.Value }; // insert appointment AppointmentInfoProvider.SetAppointmentInfo(appointment); // or appointment.Insert(); // Shows successful message to user ShowSuccessMessage(); // Hide form plcAppointmentForm.Visible = false; } catch (Exception ex) { // log exception to Event log EventLogProvider.LogException("DoctorsAppointment", "CREATE", ex); // show error message to user ShowErrors(ex.Message); } }
/// <summary> /// Loads the apppointments joined with doctor at given date /// </summary> /// <param name="appointmentsDate">Appointments will be loaded on this date</param> /// <returns>List of appointments joined with doctor</returns> private List <AppointmentDoctorModel> LoadAppointments(DateTime appointmentsDate) { // join DoctorAppointments_Appointment with DoctorAppointments_Doctor var appointmentsWithDoctors = AppointmentInfoProvider.GetAppointments() .Columns(FilterColumns) .Source(m => m.LeftJoin <DoctorInfo>("AppointmentDoctorID", "DoctorID")) .Where("AppointmentDoctorID", QueryOperator.Equals, FilterDoctor); // execute query and get data set var ds = appointmentsWithDoctors.Execute(); // convert DataSet int AppointmentDoctorModel object return(ConvertDataSet(ds)); }