public virtual ActionResult WavePickslips(int bucketId) { var bucket = _service.GetBucket(bucketId); var pickslips = _service.GetBucketPickslip(bucketId); var model = new WavePickslipsViewModel { Bucket = new BucketModel(bucket), PickslipList = (from pickslip in pickslips let routePickslip = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPickslip1] let routePo = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPo3] select new ManageWavesPickslipModel(pickslip) { UrlInquiryPickslip = routePickslip == null ? null : Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPickslip1, new { id = pickslip.PickslipId }), UrlInquiryPurchaseOrder = routePo == null ? null : Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPo3, new { id = pickslip.PurchaseOrder, pk1 = pickslip.CustomerId, pk2 = pickslip.Iteration }) }).OrderBy(p => p.PercentCurrentPieces) .ThenByDescending(p => p.OrderedPieces).ToList(), }; return(PartialView(this.Views._wavePickslipsPartial, model)); }
public virtual ActionResult WavePickslips(int bucketId) { var bucket = _service.Value.GetBucket(bucketId); if (bucket == null) { // Unreasonable bucket id //ModelState.AddModelError("", string.Format("Pick Wave {0} is deleted", model.Bucket.BucketId)); return(RedirectToAction(MVC_PickWaves.PickWaves.Home.Customers())); } //model.Bucket = new BucketModel(bucket) //{ // CustomerName = _service.Value.GetCustomerName(bucket.MaxCustomerId) //}; var pickslips = _service.Value.GetBucketPickslip(bucketId); var model = new WavePickslipsViewModel { Bucket = new BucketModel(bucket, _service.Value.GetCustomerName(bucket.MaxCustomerId), BucketModelFlags.HideViewerLink), PickslipList = (from pickslip in pickslips let routePickslip = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPickslip1] let routePo = Url.RouteCollection[DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPo3] select new ManageWavesPickslipModel(pickslip) { UrlInquiryPickslip = routePickslip == null ? null : Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPickslip1, new { id = pickslip.PickslipId }), UrlInquiryPurchaseOrder = routePo == null ? null : Url.RouteUrl(DcmsLibrary.Mvc.PublicRoutes.DcmsConnect_SearchPo3, new { id = pickslip.PurchaseOrder, pk1 = pickslip.CustomerId, pk2 = pickslip.Iteration }) }).OrderBy(p => p.PercentCurrentPieces) .ThenByDescending(p => p.OrderedPieces).ToList(), }; //if (pickslips.Count > 0) //{ // var ps = pickslips.First(); // model.CustomerId = ps.CustomerId; // model.BucketId = ps.BucketId; // model.IsFrozenBucket = ps.IsFrozenBucket; //} return(View(this.Views.WavePickslips, model)); }