Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var deliveries = DateFilter.getDeliveriesWithinDays(company.Deliveries.ToList(), 2);
            var depots     = company.PickUpLocations.ToList();
            List <ShipperSingleDeliveryMapViewModel> delsWithAddress = new List <ShipperSingleDeliveryMapViewModel>();

            foreach (Delivery delivery in deliveries)
            {
                ShipperSingleDeliveryMapViewModel model = new ShipperSingleDeliveryMapViewModel();
                model.Client        = delivery.Client;
                model.addressString = DirectionsService.getStringFromAddress(delivery.Client.Address);
                model.ID            = delivery.ID;

                string clientName      = delivery.Client.FirstName + " " + delivery.Client.LastName;
                string currentStatus   = StatusExtension.DisplayName(delivery.DeliveryStatus.Status);
                string deliverByDate   = delivery.DeliverBy.Value.Date.ToString();
                string deliverByString = deliverByDate.Substring(0, deliverByDate.IndexOf(" "));

                model.clientName    = clientName;
                model.currentStatus = currentStatus;
                model.deliverBy     = deliverByString;
                delsWithAddress.Add(model);
            }
            MapObjects objects = new MapObjects(deliveries, depots, company.Routes.ToList(), delsWithAddress, company);

            return(View(objects));
        }
Ejemplo n.º 2
0
        public JsonResult DeliverWithinDays(string days)
        {
            var deliveries = DateFilter.getDeliveriesWithinDays(company.Deliveries.ToList(), Convert.ToInt32(days));
            var routes     = DateFilter.getRoutesWithinDays(company.Routes.ToList(), Convert.ToInt32(days));

            Response.StatusCode = (int)HttpStatusCode.OK;
            List <ShipperSingleDeliveryMapViewModel> delsWithAddress = new List <ShipperSingleDeliveryMapViewModel>();

            foreach (Delivery delivery in deliveries)
            {
                ShipperSingleDeliveryMapViewModel model = new ShipperSingleDeliveryMapViewModel();
                model.Client        = delivery.Client;
                model.addressString = DirectionsService.getStringFromAddress(delivery.Client.Address);
                model.ID            = delivery.ID;

                string clientName      = delivery.Client.FirstName + " " + delivery.Client.LastName;
                string currentStatus   = StatusExtension.DisplayName(delivery.DeliveryStatus.Status);
                string deliverByDate   = delivery.DeliverBy.Value.Date.ToString();
                string deliverByString = deliverByDate.Substring(0, deliverByDate.IndexOf(" "));

                model.clientName    = clientName;
                model.currentStatus = currentStatus;
                model.deliverBy     = deliverByString;
                delsWithAddress.Add(model);
            }
            MapObjects result = new MapObjects(deliveries, routes, delsWithAddress, company);

            return(Json(result));
        }
Ejemplo n.º 3
0
        public IActionResult MapDelivery(int?id)
        {
            var delivery = _context.Deliveries
                           .Include(d => d.Client)
                           .Include(d => d.Client.Address)
                           .Include(d => d.DeliveryStatus)
                           .SingleOrDefault(d => d.ID == id);
            double locationLat = delivery.Client.Address.Lat;
            double locationLng = delivery.Client.Address.Lng;
            string clientName  = delivery.Client.FirstName + " " + delivery.Client.LastName;

            string deliverytatusString = StatusExtension.DisplayName(delivery.DeliveryStatus.Status);

            if (delivery.DeliveryStatus.Status.Equals(Status.Delivered))
            {
                DateTime deliveredDate = delivery.DeliveryStatus.DeliveredDate.Value;
                deliverytatusString += " " + deliveredDate.ToString("MM/dd/yyyy HH:mm", CultureInfo.InvariantCulture);
            }

            string addressString              = DirectionsService.getStringFromAddress(delivery.Client.Address);
            string deliverByDate              = delivery.DeliverBy.Value.Date.ToString();
            string deliverByString            = deliverByDate.Substring(0, deliverByDate.IndexOf(" "));
            DriverSingleDeliveryMapView model = new DriverSingleDeliveryMapView(locationLat, locationLng, clientName, deliverByString, deliverytatusString, addressString);

            return(View(model));
        }