private PalletDispatchInfoViewModel GetPalletModel(int palletId)
        {
            ViewBag.PalletId = palletId;
            ViewBag.setName  = "gvPalletDispatchDetails" + palletId;
            ViewBag.route    = new { Controller = "Pallets", Action = "_PalletDispatchInfo", palletId = palletId };

            var pallet = _palletingService.GetFulfillmentPalletById(palletId);
            var model  = new PalletDispatchInfoViewModel()
            {
                PalletID = palletId
            };

            if (pallet.DateCompleted.HasValue)
            {
                model = _palletingService.GetPalletDispatchDetailByPallet(palletId);
                model.IsDispatched = true;
            }
            return(model);
        }
Exemplo n.º 2
0
        public PalletDispatchInfoViewModel GetPalletDispatchDetailByPallet(int palletId)
        {
            var pallet = GetFulfillmentPalletById(palletId);
            var model  = new PalletDispatchInfoViewModel();

            if (pallet == null || pallet.DateCompleted == null || pallet.PalletsDispatch == null)
            {
                return(null);
            }
            model.PalletID          = palletId;
            model.SentMethod        = pallet.PalletsDispatch.SentMethod != null ? pallet.PalletsDispatch.SentMethod.Name : "";
            model.TrackingReference = pallet.PalletsDispatch.TrackingReference;
            if (pallet.PalletsDispatch.VehicleDriverResource != null)
            {
                model.DriverName = pallet.PalletsDispatch.VehicleDriverResource.Name;
            }
            model.VehicleNumber          = pallet.PalletsDispatch.VehicleIdentifier;
            model.DispatchNotes          = pallet.PalletsDispatch.DispatchNotes;
            model.DispatchEvidenceImages = pallet.PalletsDispatch.ProofOfDeliveryImageFilenames;
            model.DispatchDate           = pallet.PalletsDispatch.DateCompleted.Value.ToString("dd/MM/yyyy HH:mm");
            return(model);
        }