示例#1
0
        public ActionResult SuggestedSubstituteTransporters([DataSourceRequest] DataSourceRequest request, int changedTransportOrderID)
        {
            var changedTransportOrderObj     = _transportOrderService.FindById(changedTransportOrderID);
            var uniqueWoredas                = new List <int>();
            var changedTransportOrderDetails = changedTransportOrderObj.TransportOrderDetails;

            //substituteTransporterOrder.WoredaID = changedTransportOrderDetails.First().FDP.AdminUnitID;
            foreach (var changedTransportOrderDetail in changedTransportOrderDetails.Where(changedTransportOrderDetail =>
                                                                                           !uniqueWoredas.Contains(changedTransportOrderDetail.FDP.AdminUnitID)))
            {
                uniqueWoredas.Add(changedTransportOrderDetail.FDP.AdminUnitID);
            }

            var substituteTransportersStanding = (from uniqueWoreda in uniqueWoredas
                                                  let woreda = uniqueWoreda
                                                               let changedTransporterPostition = _bidQuotationService.Get(t => t.TransporterID == changedTransportOrderObj.TransporterID && t.DestinationID == woreda).Select(t => t.Position).FirstOrDefault()
                                                                                                 let woredaWinnersList = _bidQuotationService.Get(t => t.DestinationID == woreda && t.Position >= changedTransporterPostition && t.TransporterID != changedTransportOrderObj.TransporterID).ToList().OrderBy(t => t.Position)
                                                                                                                         let substituteTransportersStandingList = woredaWinnersList.ToList()
                                                                                                                                                                  select new SubstituteTransporterOrder
            {
                WoredaID = uniqueWoreda,
                Woreda = _adminUnitService.FindById(uniqueWoreda).Name,
                TransportersStandingList = TransportBidQuotationBinding.TransportBidQuotationListViewModelBinder(substituteTransportersStandingList)
            }).ToList();

            return(Json(substituteTransportersStanding.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult ShowBidByTransporter([DataSourceRequest] DataSourceRequest request, int transporterId)
        {
            var quotationResutlt =
                _bidQuotationService.GetAllTransportBidQuotation().Where(
                    t => t.TransporterID == transporterId && t.IsWinner == true).ToList();
            var qoutationViewModel =
                TransportBidQuotationBinding.TransportBidQuotationListViewModelBinder(quotationResutlt);

            return(Json(qoutationViewModel.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }