public ActionResult AssignRoute(int id = 0, string Center = "") { AssignRouteChildren childern = new AssignRouteChildren(); childern.CenterId = 0; childern.CenterId = (Center == "" || Center == "0")?0:Convert.ToInt32(EncryptDecrypt.Decrypt64(Center)); List <AssignedRouteAll> allList = new List <AssignedRouteAll>(); try { Guid agencyId = new Guid(Session["AgencyId"].ToString()); switch (id) { case 1: { allList = new TransportationData().GetPickUpChildrenData(agencyId, childern.CenterId); break; } case 2: { allList = new TransportationData().GetDropUpChildrenData(agencyId, childern.CenterId); break; } default: { allList = new TransportationData().GetChildrenRouteAssigned(agencyId, childern.CenterId); break; } } string PickupRoute = "", DropRoute = ""; new TransportationData().GetRoutes(ref PickupRoute, ref DropRoute, agencyId.ToString(), childern.CenterId); // allList = GetLatLongAll(allList); childern.AssignRouteList = allList; JavaScriptSerializer js = new JavaScriptSerializer(); childern.TestString = js.Serialize(childern.AssignRouteList); childern.PickUpRotes = PickupRoute; childern.DropRotes = DropRoute; childern.SelectValue = id; } catch (Exception ex) { clsError.WriteException(ex); } return(View(childern)); //return View(); }
public JsonResult GetDropUpChildren() { AssignRouteChildren assignChild = new AssignRouteChildren(); List <AssignedRouteAll> dropChildrenList = new List <AssignedRouteAll>(); try { Guid agencyId = new Guid(Session["AgencyId"].ToString()); dropChildrenList = new TransportationData().GetDropUpChildrenData(agencyId, 0); dropChildrenList = GetLatLongAll(dropChildrenList); } catch (Exception ex) { clsError.WriteException(ex); } return(Json(dropChildrenList, JsonRequestBehavior.AllowGet)); }
public ActionResult CreateRoute() { AssignRouteChildren childern = new AssignRouteChildren(); List <AssignedRouteAll> allList = new List <AssignedRouteAll>(); try { Guid agencyId = new Guid(Session["AgencyId"].ToString()); allList = new TransportationData().GetChildrenRouteAssignedDetail(agencyId); List <CenterDetails> centerlist = new List <CenterDetails>(); string address = string.Empty; childern.BusStaffDetails = new TransportationData().GetBusStaffData(out address, out centerlist, agencyId); childern.CenterAddress = address; childern.CenterList = centerlist; // allList = GetLatLongAll(allList); childern.AssignRouteList = allList; JavaScriptSerializer js = new JavaScriptSerializer(); childern.TestString = js.Serialize(childern.AssignRouteList); List <AssignedRouteAll> pickupRouteNames = allList.Where(a => a.PickUpRouteName != null && a.PickUpRouteName != "Not Assigned").OrderBy(a => a.Latitude).OrderBy(a => a.Longitude).ToList(); List <AssignedRouteAll> dropRouteNames = allList.Where(a => a.DropRouteName != null && a.DropRouteName != "Not Assigned").OrderBy(a => a.Latitude).OrderBy(a => a.Longitude).ToList(); string[] listPickUp = pickupRouteNames.Where(a => a.PickUpRouteName != null && a.PickUpRouteName != "Not Assigned").Select(a => a.PickUpRouteName).ToArray(); string[] listPickDrop = dropRouteNames.Where(a => a.DropRouteName != null && a.DropRouteName != "Not Assigned").Select(a => a.DropRouteName).ToArray(); var listPickUp1 = listPickUp.Union(listPickDrop).ToList(); // var listDrop = allList.Select(a => new { RoputeName = a.DropRouteName }).ToList(); TempData["pickupRouteNames"] = js.Serialize(pickupRouteNames); TempData["dropRouteNames"] = js.Serialize(dropRouteNames); TempData["listPickUp1"] = listPickUp1; } catch (Exception ex) { clsError.WriteException(ex); } return(View(childern)); }