public async Task <ActionResult> Stops(int id, int centerNumber, string routeNumber, string position) { var model = new RouteStopViewModel(await RouteService.GetByRouteIdAndCenterNumberAndRouteNumberAsync(id, centerNumber, routeNumber)); model.Position = position; return(PartialView("_stopList", model)); }
public async Task <ActionResult> Destination(int id, int centerNumber, string routeNumber, DateTime sourceStopPlannedDeliveryDateTime) { if (id != 0) { var model = new RouteViewModel(await RouteService.GetByRouteIdAndCenterNumberAndRouteNumberAsync(id, centerNumber, routeNumber)); return(Json(JsonConvert.SerializeObject(model), JsonRequestBehavior.AllowGet)); } else { if (string.IsNullOrEmpty(routeNumber)) { return(null); } var weekending = Dates.GetWeekending(sourceStopPlannedDeliveryDateTime.Date).AddHours(12); var startWeek = weekending.AddDays(-6); var criteria = new SearchRoute { CenterNumber = centerNumber, RouteNumber = routeNumber, FilterStartDate = startWeek, FilterEndDate = weekending }; var routes = await RouteService.SearchAsync(criteria); if (routes == null || !routes.Any() || routes.Count() == 0) { return(null); } var model = new RouteViewModel(routes.FirstOrDefault()); return(Json(JsonConvert.SerializeObject(model), JsonRequestBehavior.AllowGet)); } }
public async Task <JsonResult> Details(int id, int centerNumber, string routeNumber) { var raw = await RouteService.GetByRouteIdAndCenterNumberAndRouteNumberAsync(id, centerNumber, routeNumber); var model = new RouteForMapModel(raw); var result = JsonConvert.SerializeObject(model); return(Json(result, JsonRequestBehavior.AllowGet)); }
public async Task <JsonResult> RouteStops(int routeId, int centerNumber) { var route = await RouteService.GetByRouteIdAndCenterNumberAndRouteNumberAsync(routeId, centerNumber); List <BasicStopModel> model = new List <BasicStopModel>(); foreach (var stop in route.RouteStops.OrderBy(s => s.StopNumber)) { model.Add(new BasicStopModel { RoutePlanId = stop.RoutePlanId, BillTo = (int)stop.BillTo, ShipTo = (int)stop.ShipTo, CenterNumber = stop.SygmaCenterNo, StopNumber = (int)stop.StopNumber }); } return(Json(JsonConvert.SerializeObject(model), JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> ListByRouteId(int routeId, int centerNumber) { var route = await RouteService.GetByRouteIdAndCenterNumberAndRouteNumberAsync(routeId, centerNumber); var comments = await CommentService.GetCommentsByRoutePlanIds(route.RouteStops.Select(r => r.RoutePlanId).ToArray(), centerNumber); var routeComments = from comment in comments group comment by new { comment.SecondaryRecordId, comment.PrimaryRecordId, comment.CenterNumber } into groupcomments select new RouteAggregateCommentViewModel { RouteId = route.RouteId, RoutePlanId = int.Parse(groupcomments.Key.SecondaryRecordId), RouteNumber = route.RouteNumber, StopNumber = (int)(route.RouteStops.SingleOrDefault(s => s.RoutePlanId.ToString() == groupcomments.Key.SecondaryRecordId).StopNumber), Comments = ToRouteCommentViewModel(groupcomments.OrderByDescending(s => s.CreatedDate).ToList()) }; ViewBag.UserName = this.UserName; ViewBag.LastFirstName = this.LastFirstName; return(PartialView("_listByRoute", routeComments.OrderBy(r => r.StopNumber))); }
public async Task <JsonResult> StopsData(int id, int centerNumber) { var model = await RouteService.GetByRouteIdAndCenterNumberAndRouteNumberAsync(id, centerNumber); return(Json(JsonConvert.SerializeObject(model), JsonRequestBehavior.AllowGet)); }