private void SetViewBagForCombos(SAL03_ResAppointments appointments)
 {
     ViewBag.StartTime = AppointmentsDAL.getComboLookupValue("Setup40_Time", "Setup40TimeID", "Setup40Time", appointments.SalApptStartTime);
     ViewBag.EndTime   = AppointmentsDAL.getComboLookupValue("Setup40_Time", "Setup40TimeID", "Setup40Time", appointments.SalApptEndTime);
     ViewBag.FenceType = AppointmentsDAL.getComboLookupValue("Setup25_FenceTypes", "FenceTypeID", "FenceType", Convert.ToString(appointments.FenceTypeID));
     ViewBag.SalesType = AppointmentsDAL.getComboLookupValue("SAL10_SalesTypes", "SalTypeId", "SalType", Convert.ToString(appointments.SalTypeId));
 }
        //
        // 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"));
            }
        }