// GET: Service
        public ActionResult RequestService(int SRID = 0)
        {
            DBModels.BeeServiceEntities2 context = new DBModels.BeeServiceEntities2();
            ServiceRequest objClientSR = new ServiceRequest();
            SRClientModel srClient = new SRClientModel();
            int BeeUserID = 0;
            string strClientSR = "{}";

            if (Session["CustomerID"] != null)
            {
                BeeUserID = Convert.ToInt32(Session["CustomerID"]);
                DBModels.BeeUser objBeeUser = context.BeeUsers.Where(a => a.Id == BeeUserID).FirstOrDefault();

                objClientSR.BeeUser = new BeeUser();
                objClientSR.BeeUser.Id = objBeeUser.Id;
                objClientSR.BeeUser.Address = objBeeUser.Address;
                objClientSR.BeeUser.ContactPreference = objBeeUser.ContactPreference;
                objClientSR.BeeUser.Email = objBeeUser.Email;
                objClientSR.BeeUser.FullName = objBeeUser.FullName;
                objClientSR.BeeUser.LandmarkID = (int)objBeeUser.LandmarkID.GetValueOrDefault(0);
                objClientSR.BeeUser.Message = objBeeUser.Message;
                objClientSR.BeeUser.PaymentMode = objBeeUser.PaymentMode;
                objClientSR.BeeUser.Phone = objBeeUser.Phone;
                objClientSR.BeeUser.TextNotifications = objBeeUser.TextNotifications;
            }

            if (SRID != 0)
            {

                Data.ServiceRequest objDBSR = context.ServiceRequests.Where(a => a.ID == SRID).FirstOrDefault();

                objClientSR.ID = SRID;
                objClientSR.CustomerID = objDBSR.CustomerID;
                objClientSR.StartTime = objDBSR.ServiceStartTime;
                objClientSR.ServiceDuration = (int)objDBSR.ServiceDuration;
                objClientSR.EndTime = objDBSR.ServiceStartTime.AddMinutes((int)objClientSR.ServiceDuration);
                objClientSR.Status = objDBSR.Status;

                objClientSR.ServiceRequestVehicles = new List<ServiceRequestVehicle>();

                foreach (Data.ServiceRequestVehicle objDBSRVehicle in objDBSR.ServiceRequestVehicles)
                {
                    ServiceRequestVehicle objClientSRVehicle = new ServiceRequestVehicle();
                    objClientSRVehicle.VehicleTypeID = objDBSRVehicle.VehicleTypeID;
                    objClientSRVehicle.VehicleClassID = objDBSRVehicle.VehicleClassID;
                    objClientSRVehicle.ServiceTypeID = objDBSRVehicle.ServiceTypeID;

                    int addonCounter = 0;
                    objClientSRVehicle.VehicleAddonIDs = new int[objDBSRVehicle.ServiceAddOns.Count];
                    foreach (Data.ServiceAddOn objDBSRAddon in objDBSRVehicle.ServiceAddOns)
                    {
                        objClientSRVehicle.VehicleAddonIDs[addonCounter] = (int)objDBSRAddon.AddOnID;
                        addonCounter++;
                    }

                    objClientSR.ServiceRequestVehicles.Add(objClientSRVehicle);
                }

            }

            if (BeeUserID != 0 || SRID != 0)
            {
                JsonSerializerSettings settings = new JsonSerializerSettings()
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                };

                strClientSR = JsonConvert.SerializeObject(objClientSR, settings);
            }

            srClient.ClientSR = strClientSR;
            srClient.MasterData = GetMasterData();
            srClient.Landmarks = GetLandmarks();
            srClient.CalendarEvents = GetCalendarEventsJSON();

            return View("RequestService", "", srClient);
        }
        public JsonResult GetServiceRequest(int SRID = 0)
        {
            DBModels.BeeServiceEntities2 context = new DBModels.BeeServiceEntities2();
            ServiceRequest objClientSR = new ServiceRequest();
            SRClientModel srClient = new SRClientModel();
            decimal SRCost = 0;
            var serviceRequests = from ServiceRequest in context.ServiceRequests select ServiceRequest;

            if (SRID != 0)
            {

                Data.ServiceRequest objDBSR = context.ServiceRequests.Where(a => a.ID == SRID).FirstOrDefault();

                objClientSR.BeeUser = new BeeUser();
                objClientSR.BeeUser.Id = objDBSR.BeeUser.Id;
                objClientSR.BeeUser.Address = objDBSR.BeeUser.Address;
                objClientSR.BeeUser.ContactPreference = objDBSR.BeeUser.ContactPreference;
                objClientSR.BeeUser.Email = objDBSR.BeeUser.Email;
                objClientSR.BeeUser.FullName = objDBSR.BeeUser.FullName;
                objClientSR.BeeUser.LandmarkID = (int)objDBSR.BeeUser.LandmarkID.GetValueOrDefault(0);
                objClientSR.BeeUser.Message = objDBSR.BeeUser.Message;
                objClientSR.BeeUser.PaymentMode = objDBSR.BeeUser.PaymentMode;
                objClientSR.BeeUser.Phone = objDBSR.BeeUser.Phone;
                objClientSR.BeeUser.TextNotifications = objDBSR.BeeUser.TextNotifications;

                objClientSR.ID = SRID;
                objClientSR.CustomerID = objDBSR.CustomerID;
                objClientSR.StartTime = objDBSR.ServiceStartTime;
                objClientSR.ServiceDuration = (int)objDBSR.ServiceDuration;
                objClientSR.EndTime = objDBSR.ServiceStartTime.AddMinutes((int)objClientSR.ServiceDuration);
                objClientSR.Status = objDBSR.Status;

                objClientSR.ServiceRequestVehicles = new List<ServiceRequestVehicle>();

                foreach (Data.ServiceRequestVehicle objDBSRVehicle in objDBSR.ServiceRequestVehicles)
                {
                    decimal vehicleCost = 0;
                    ServiceRequestVehicle objClientSRVehicle = new ServiceRequestVehicle();
                    objClientSRVehicle.VehicleTypeID = objDBSRVehicle.VehicleTypeID;
                    objClientSRVehicle.VehicleClassID = objDBSRVehicle.VehicleClassID;
                    objClientSRVehicle.ServiceTypeID = objDBSRVehicle.ServiceTypeID;
                    vehicleCost = objDBSRVehicle.ServiceType.Cost.Value;
                    int addonCounter = 0;
                    objClientSRVehicle.VehicleAddonIDs = new int[objDBSRVehicle.ServiceAddOns.Count];
                    foreach (Data.ServiceAddOn objDBSRAddon in objDBSRVehicle.ServiceAddOns)
                    {
                        vehicleCost = vehicleCost + objDBSRAddon.AddOn.Cost.Value;
                        objClientSRVehicle.VehicleAddonIDs[addonCounter] = (int)objDBSRAddon.AddOnID;
                        addonCounter++;
                    }
                    objClientSRVehicle.Cost = vehicleCost;
                    SRCost = SRCost + vehicleCost;
                    objClientSR.ServiceRequestVehicles.Add(objClientSRVehicle);
                }
                objClientSR.Cost = SRCost;
            }

            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
            string SRJson = JsonConvert.SerializeObject(objClientSR, settings);
            return Json(SRJson, JsonRequestBehavior.AllowGet);
        }