internal static ATL_Appointments getAppointmentDetails(int apptId) { var Appointments = new ATL_Appointments(); var Appointment = SqlHelper.ExecuteDataset(_myConnection, CommandType.StoredProcedure, "spATL_APPT_DETAILS", new SqlParameter("@ApptId", apptId)).Tables[0].AsEnumerable(); if (Appointment.Count() == 0) { var PersonalAppt = SqlHelper.ExecuteDataset(_myConnection, CommandType.StoredProcedure, "spATL_P_APPT_DETAILS", new SqlParameter("@ApptId", apptId)).Tables[0].AsEnumerable() .Select(r => new Personal_Appointment { SalApptId = r.Field <int>("SalApptId"), CommID = r.Field <string>("CommID"), SalApptStartDate = r.Field <DateTime>("SalApptStartDate").ToShortDateString(), SalApptStartTime = r.Field <string>("SalApptStartTime"), SalApptEndDate = r.Field <DateTime>("SalApptEndDate").ToShortDateString(), SalApptEndTime = r.Field <string>("SalApptEndTime"), ApptDesc = r.Field <string>("ApptDesc"), Notes = r.Field <string>("Notes"), SalApptUserEntered = r.Field <string>("SalApptUserEntered") }); return(new ATL_Appointments { PersonalAppointments = PersonalAppt.FirstOrDefault() }); } return(new ATL_Appointments { ScheduledAppointments = getAppointmentsCollection(Appointment)[0] }); }
public ActionResult ShowApptById(string id) { var appointments = new ATL_Appointments(); try { if (!string.IsNullOrWhiteSpace(id)) { appointments = AppointmentsDAL.getAppointmentDetails(int.Parse(id)); appointments.ScheduledAppointments.CommID = AppointmentsDAL.getCommissionName(appointments.ScheduledAppointments.CommID); appointments.ScheduledAppointments.SalApptUserEntered = AppointmentsDAL.getUsername(appointments.ScheduledAppointments.SalApptUserEntered); appointments.ScheduledAppointments.SalApptPhone = DataAccess.Entity.Common.FormatPhoneText(appointments.ScheduledAppointments.SalApptPhone); appointments.ScheduledAppointments.SalApptPhoneExt = DataAccess.Entity.Common.FormatPhoneText(appointments.ScheduledAppointments.SalApptPhoneExt); appointments.ScheduledAppointments.SalApptFax = DataAccess.Entity.Common.FormatPhoneText(appointments.ScheduledAppointments.SalApptFax); appointments.ScheduledAppointments.SalApptMobile = DataAccess.Entity.Common.FormatPhoneText(appointments.ScheduledAppointments.SalApptMobile); } } catch (Exception ex) { return(RedirectToAction("index")); } return(Json(appointments)); }