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));
        }
        //
        // GET: /Appointment/Details/5

        public ActionResult Details(string id)
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(id))
                {
                    ViewBag.Title = BusinessConstants.titleAppointments;
                    var appointments = AppointmentsDAL.getAppointmentDetails(int.Parse(id));

                    if (appointments.PersonalAppointments != null)
                    {
                        ViewBag.Title = BusinessConstants.titleEditPersonalAppointments;
                        LoadPersonalAppointmentCombos();
                        ViewBag.StartTime = AppointmentsDAL.getComboLookupValue("Setup40_Time", "Setup40TimeID", "Setup40Time", appointments.PersonalAppointments.SalApptStartTime);
                        ViewBag.EndTime   = AppointmentsDAL.getComboLookupValue("Setup40_Time", "Setup40TimeID", "Setup40Time", appointments.PersonalAppointments.SalApptEndTime);
                        return(View("personal", appointments.PersonalAppointments));
                    }
                    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);
                    SetViewBagForCombos(appointments.ScheduledAppointments);
                    return(View(appointments.ScheduledAppointments));
                }
                else
                {
                    return(RedirectToAction("index"));
                }
            }
            catch (Exception ex)
            {
                return(RedirectToAction("index"));
            }
        }