Exemplo n.º 1
0
        // GET: /TConnectRequest/
        public ActionResult Index()
        {
            int hours = 1;
            TConnRequestViewModel model = LoadModelData(hours);

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Index(TConnRequestViewModel mod)
        {
            int hoursToDisp = Convert.ToInt32(mod.SelectedItemId);


            TConnRequestViewModel model = LoadModelData(hoursToDisp);

            //set selected hour drop down correctly.
            model.SelectedItemId = mod.SelectedItemId;
            return(View(model));
        }
Exemplo n.º 3
0
        private TConnRequestViewModel LoadModelData(int hours)
        {
            hours *= -1;//make negative.
            DateTime datefrom         = DateTime.UtcNow.AddHours(hours);
            var      tconnectrequests = Uow.Repository <TConnectRequest>().Query().Include(t => t.TConnect)
                                        .Include(t => t.TConnectedVehicle).Include(t => t.TConnectStatus).Get()
                                        .Where(t => t.EstimatedTimeArrival > datefrom)
                                        .OrderByDescending(t => t.EstimatedTimeArrival).Select(t => new TConnRequestViewModel.Rows
            {
                EstimatedTimeArrival = t.EstimatedTimeArrival,
                InboundVehicle       = t.TConnect.InboundVehicle,
                RequestedHoldMinutes = t.RequestedHoldMinutes,
                TConnectStopCode     = t.TConnectedVehicle.TConnectStopCode,
                AcceptedWaitTime     = t.TConnectedVehicle.CurrentAcceptedHoldMinutes,
                //Status = t.TConnectStatus.Name
                Status = (t.TConnect.EndWindow < DateTime.UtcNow && t.TConnectStatusId == (int)TConnectStatuses.New) ? "Expired" : t.TConnectStatus.Name
            });

            TConnRequestViewModel model = new TConnRequestViewModel();

            model.RequestRows = tconnectrequests.ToList();

            model.HourListItems = new[]
            {
                new SelectListItem()
                {
                    Text = "1 Hr", Value = "1"
                },
                new SelectListItem()
                {
                    Text = "2 Hr", Value = "2"
                },
                new SelectListItem()
                {
                    Text = "3 Hr", Value = "3"
                },
                new SelectListItem()
                {
                    Text = "12 Hr", Value = "12"
                },
                new SelectListItem()
                {
                    Text = "1 Day", Value = "24"
                }
            };
            return(model);
        }