public ActionResult MergeBidWinners(WoredaBidWinnerViewModel woredaBidWinnerViewModel) { var bidWinnerObj =_bidWinnerService.Get(t => t.SourceID == woredaBidWinnerViewModel.SourceId && t.DestinationID == woredaBidWinnerViewModel.DestinationId && t.BidID == woredaBidWinnerViewModel.BidID && t.TransporterID == woredaBidWinnerViewModel.LeavingTransporterID && t.Position == 1 && t.Status == 1).FirstOrDefault(); if (bidWinnerObj !=null) { bidWinnerObj.Status = (int)BIDWINNER.Left; _bidWinnerService.EditBidWinner(bidWinnerObj); } var regionObj = _adminUnitService.FindById(woredaBidWinnerViewModel.DestinationId).AdminUnit2.AdminUnit2; //var filter = new PriceQuotationFilterOfferlessViewModel() // { // BidID = woredaBidWinnerViewModel.BidID, // HubID = woredaBidWinnerViewModel.SourceId, // RegionID = regionObj.AdminUnitID // }; return RedirectToAction("WoredasBidStatus"); }
public ActionResult LoadBidWinnerLeave(WoredaBidWinnerViewModel woredaBidWinnerViewModel) { if (woredaBidWinnerViewModel == null || woredaBidWinnerViewModel.SourceId <= 0 || woredaBidWinnerViewModel.DestinationId <= 0 || woredaBidWinnerViewModel.BidID <= 0) { return Json(new SelectList(Enumerable.Empty<SelectListItem>()), JsonRequestBehavior.AllowGet); } woredaBidWinnerViewModel.Woreda = _adminUnitService.FindById(woredaBidWinnerViewModel.DestinationId).Name; woredaBidWinnerViewModel.SourceWarehouse = _hubService.FindById(woredaBidWinnerViewModel.SourceId).Name; woredaBidWinnerViewModel.BidNumber = _bidService.FindById(woredaBidWinnerViewModel.BidID).BidNumber; var bidWinners = _bidWinnerService.Get( t => t.SourceID == woredaBidWinnerViewModel.SourceId && t.DestinationID == woredaBidWinnerViewModel.DestinationId && t.BidID == woredaBidWinnerViewModel.BidID && t.Position == 1 && t.Status == 1).Select( t => t.Transporter).ToList(); var transporters = bidWinners.Select(i => new SelectListItemModel {Name = i.Name, Id = i.TransporterID.ToString()}). ToList(); //transporters.Add(new SelectListItemModel { Name = "N/A", Id = "0" }); //TODO just a hack for now for unknown stacks woredaBidWinnerViewModel.Transporters = new SelectList(transporters, "Id", "Name"); return Json(woredaBidWinnerViewModel, JsonRequestBehavior.AllowGet); }