public ActionResult BidAdminDraft_Read([DataSourceRequest] DataSourceRequest request, int?BIDID) { int bidID = BIDID ?? 0; var bids = _bidWinnerService.FindBy(m => m.BidID == bidID && m.Position == 1); var bidsToDisplay = GetBidWinners(bids).ToList(); return(Json(bidsToDisplay.ToDataSourceResult(request))); }
public JsonResult GetListOfBidWinners(string id) { var selectedBidWinners = new List <TransporterViewModel>(); var bid = _bidService.FindBy(t => t.BidNumber == id).FirstOrDefault(); var bidWinner = _bidWinnerService.FindBy(m => m.BidID == bid.BidID); if (bidWinner != null) { selectedBidWinners = GetBidWinners(bidWinner).ToList(); } return(Json(selectedBidWinners.Take(10), JsonRequestBehavior.AllowGet)); }
public void ClearBidWinners() { int bidNumber = 15; int regionID = 2; var oldWinners = _bidWinnerService.FindBy( b => b.BidID == bidNumber && b.AdminUnit.AdminUnit2.AdminUnit2.AdminUnitID == regionID); foreach (var oldWinner in oldWinners) { _bidWinnerService.DeleteBidWinner(oldWinner); } }
public ActionResult LoadCheque(int transporterId, string refNo) { var user = UserAccountHelper.GetUser(User.Identity.Name); var approvedPaymentRequests = _transporterPaymentRequestService.Get(t => t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo == 3 && t.TransportOrder.TransporterID == transporterId); if (refNo != "") { approvedPaymentRequests = _transporterPaymentRequestService.Get(t => t.BusinessProcess.CurrentState.BaseStateTemplate.StateNo == 3 && t.TransportOrder.TransporterID == transporterId && t.ReferenceNo == refNo); } //var transporterChequeObj = _transporterChequeService.Get(t => t.TransporterPaymentRequestID == paymentRequestID, null, "UserProfile").FirstOrDefault(); var transporterChequeViewModel = new Models.TransporterChequeViewModel(); foreach (var approvedPaymentRequest in approvedPaymentRequests) { var request = approvedPaymentRequest; var dispatch = _dispatchService.Get(t => t.DispatchID == request.Delivery.DispatchID, null, "Hub, FDP").FirstOrDefault(); var bidId = _bidWinnerService.FindBy(b => b.Bid.BidNumber == dispatch.BidNumber).Select(d => d.BidID).FirstOrDefault(); var firstOrDefault = _transportOrderDetailService.Get(t => t.SourceWarehouseID == dispatch.HubID && t.FdpID == dispatch.FDPID && t.TransportOrder.TransporterID == request.TransportOrder.TransporterID && t.BidID == bidId).FirstOrDefault(); //var firstOrDefault = _bidWinnerService.Get(t => t.SourceID == dispatch.HubID && t.DestinationID == dispatch.FDPID // && t.TransporterID == request.TransportOrder.TransporterID && t.Bid.BidNumber == dispatch.BidNumber).FirstOrDefault(); var tarrif = (decimal)0.00; var deliveryDetail = request.Delivery.DeliveryDetails.FirstOrDefault() ?? new DeliveryDetail(); if (request.LabourCost == null) { request.LabourCost = (decimal)0.00; } if (request.RejectedAmount == null) { request.RejectedAmount = (decimal)0.00; } if (firstOrDefault != null) { tarrif = (decimal)firstOrDefault.TariffPerQtl; } transporterChequeViewModel.Transporter = request.TransportOrder.Transporter.Name; transporterChequeViewModel.PaymentRequestsList = transporterChequeViewModel.PaymentRequestsList + " [" + approvedPaymentRequest.ReferenceNo + "] "; transporterChequeViewModel.Amount = transporterChequeViewModel.Amount + (decimal) (approvedPaymentRequest.ShortageBirr != null ? (deliveryDetail.ReceivedQuantity.ToQuintal() * tarrif) - approvedPaymentRequest.ShortageBirr + approvedPaymentRequest.LabourCost - approvedPaymentRequest.RejectedAmount : (deliveryDetail.ReceivedQuantity.ToQuintal() * tarrif) + approvedPaymentRequest.LabourCost - approvedPaymentRequest.RejectedAmount); } transporterChequeViewModel.PreparedByID = user.UserProfileID; transporterChequeViewModel.PreparedBy = user.FullName; return(Json(transporterChequeViewModel, JsonRequestBehavior.AllowGet)); }
public ActionResult GetList([DataSourceRequest] DataSourceRequest request, int id) { IList <UnContractedTransportersListViewModel> selectedUnSignedBidWinners = new List <UnContractedTransportersListViewModel>(); Bid selectedBid = _bidService.FindBy(t => t.BidID == id).FirstOrDefault(); var unSignedbidWinner = _bidWinnerService.FindBy(m => m.BidID == selectedBid.BidID && m.ExpiryDate > DateTime.Now && m.Status != (int)BidWinnerStatus.Signed); if (unSignedbidWinner != null && unSignedbidWinner.Any()) { selectedUnSignedBidWinners = GetBidWinners(unSignedbidWinner).ToList(); } return(Json(selectedUnSignedBidWinners.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));//,JsonRequestBehavior.AllowGet }
public JsonResult GroupedWinners(int bidid, int rank) { var winners = _bidWinnerService.FindBy(t => t.BidID == bidid && t.Position == rank); //var recentBidViewModels = BindBidViewModels(recentBids); var list = winners.Select(winner => new { transporter = winner.Transporter.Name, //offers = firstwinners.Count }).ToList(); var grouped = ( from r in winners group r by new { r.BidID, r.TransporterID } into g select g ); var groupedwinners = new List <Object>(); foreach (var transporter in grouped) { var detail = new { Name = transporter.First().Transporter.Name, Count = transporter.Count(), minoffer = transporter.Min(t => t.Tariff), maxoffer = transporter.Max(t => t.Tariff) }; groupedwinners.Add(detail); } return(Json(groupedwinners, JsonRequestBehavior.AllowGet)); }
public ActionResult Details(int id, int transporterID) { var bidWinners = _bidWinnerService.FindBy(m => m.BidID == id && m.TransporterID == transporterID); ViewBag.BidNumber = bidWinners.First().Bid.BidNumber; ViewBag.BidWinners = bidWinners.ToList(); if (bidWinners == null) { return(HttpNotFound()); } var bidWinnersViewModel = new WinnersByBidViewModel { BidID = id, TransporterID = transporterID, BidWinners = GetBidWinner(bidWinners) }; return(View(bidWinnersViewModel)); }