public bool DeleteTransportOrderDetail(TransportOrderDetail transportOrderDetail)
 {
     if (transportOrderDetail == null) return false;
     _unitOfWork.TransportOrderDetailRepository.Delete(transportOrderDetail);
     _unitOfWork.Save();
     return true;
 }
Ejemplo n.º 2
0
        //TODO:Factor Out  to single responiblity Principle
        public bool CreateTransportOrder(int transportRequisitionId)
        {
            //var requId=_unitOfWork.TransportRequisitionDetailRepository.FindBy(t=>t.TransportRequisitionID==)
            var transporterAssignedRequisionDetails = AssignTransporterForEachWoreda(transportRequisitionId);

            var transporters = (from item in transporterAssignedRequisionDetails select item.TransporterID).Distinct().ToList();

            //If we reached here all location got transporter
            var transportOrders = new List<TransportOrder>();

            foreach (var transporter in transporters)
            {
                //TODO:Check what all number should come from and implement
                var transportOrder = new TransportOrder();
                transportOrder.TransporterID = transporter;
                transportOrder.OrderDate = DateTime.Today;
                transportOrder.StartDate = DateTime.Today;
                transportOrder.EndDate = DateTime.Today;
                transportOrder.TransportOrderNo = Guid.NewGuid().ToString();
                transportOrder.OrderExpiryDate = DateTime.Today.AddDays(10);

                transportOrder.PerformanceBondReceiptNo = "PERFORMANCE-BOND-NO";
                //var transporterName = _unitOfWork.TransporterRepository.FindById(transporter).Name;
                transportOrder.ContractNumber = Guid.NewGuid().ToString();
                //string.Format("{0}/{1}/{2}/{3}", "LTCD", DateTime.Today.day, DateTime.Today.Year, transporterName.Substring(0, 1));
                transportOrder.TransporterSignedDate = DateTime.Today;
                transportOrder.RequestedDispatchDate = DateTime.Today;
                transportOrder.ConsignerDate = DateTime.Today;
                transportOrder.StartDate = DateTime.Today.AddDays(3);
                transportOrder.EndDate = DateTime.Today.AddDays(13);
                transportOrder.StatusID = (int)TransportOrderStatus.Draft;
                var transportLocations = transporterAssignedRequisionDetails.FindAll(t => t.TransporterID == transporter).Distinct();

                foreach (var transporterRequisition in transportLocations)
                {
                    //var currentBid = _unitOfWork.BidRepository.FindBy(t => t.StatusID == int.Parse(BidStatus.Active.ToString())).FirstOrDefault();
                    var transReq = transporterRequisition;
                    //var activeBidStatusID = int.Parse(BidStatus.Active.ToString());
                    var bidWinner =
                    _unitOfWork.BidWinnerRepository.Get(
                        t => t.SourceID == transReq.HubID && t.DestinationID == transReq.WoredaID && t.Position == 1 &&
                            t.Bid.StatusID == 5).FirstOrDefault();
                    if (bidWinner != null)
                    {
                        transportOrder.BidDocumentNo = _unitOfWork.BidRepository.FindById(bidWinner.BidID).BidNumber;
                    }
                    else
                    {
                        transportOrder.BidDocumentNo = "Bid-Number";
                        //_unitOfWork.BidWinnerRepository.FindById(transporter).Bid.BidNumber;
                    }

                    var requisionsDetails =
                        _unitOfWork.ReliefRequisitionDetailRepository.Get(
                            t =>
                            t.RequisitionID == transReq.RequisitionID &&
                            t.FDP.AdminUnitID == transReq.WoredaID, null, "ReliefRequisition").ToList();

                    foreach (var reliefRequisitionDetail in requisionsDetails)
                    {
                        var transportOrderDetail = new TransportOrderDetail();
                        //transportOrderDetail.ZoneID = reliefRequisitionDetail.ReliefRequisition.ZoneID;
                        transportOrderDetail.CommodityID = reliefRequisitionDetail.CommodityID;
                        transportOrderDetail.FdpID = reliefRequisitionDetail.FDPID;
                        transportOrderDetail.RequisitionID = reliefRequisitionDetail.RequisitionID;
                        transportOrderDetail.QuantityQtl = reliefRequisitionDetail.Amount;
                        transportOrderDetail.TariffPerQtl = transReq.TariffPerQtl;
                        transportOrderDetail.SourceWarehouseID = transReq.HubID;
                        transportOrder.TransportOrderDetails.Add(transportOrderDetail);
                    }

                }
                _unitOfWork.TransportOrderRepository.Add(transportOrder);
                transportOrders.Add(transportOrder);

            }

            var requisition = _unitOfWork.TransportRequisitionRepository.Get(t => t.TransportRequisitionID == transportRequisitionId).FirstOrDefault();

            requisition.Status = (int)TransportRequisitionStatus.Closed;

            var transportRequisitionDetails =
                _unitOfWork.TransportRequisitionDetailRepository.Get(t => t.TransportRequisitionID == transportRequisitionId).ToList();
            foreach (var transportRequisitionDetail in transportRequisitionDetails)
            {
                var reliefRequisition =
                    _unitOfWork.ReliefRequisitionRepository.Get(
                        t => t.RequisitionID == transportRequisitionDetail.RequisitionID).FirstOrDefault();
                reliefRequisition.Status = (int)ReliefRequisitionStatus.TransportOrderCreated;
            }

            _unitOfWork.Save();
            //TODO:Identity if Transport order number to be auto generated , and where to get contract number.

            foreach (var transportOrder in transportOrders)
            {
                var transporterName = _unitOfWork.TransporterRepository.FindById(transportOrder.TransporterID).Name;
                transportOrder.TransportOrderNo = string.Format("TRN-ORD-{0}", transportOrder.TransportOrderID);
                transportOrder.ContractNumber = string.Format("{0}/{1}/{2}/{3}", "LTCD", DateTime.Today.Day, DateTime.Today.Year, transporterName.Substring(0, 2));
            }

            _unitOfWork.Save();

            return true;
        }
Ejemplo n.º 3
0
        public bool ReAssignTransporter(IEnumerable<TransportRequisitionWithoutWinnerModel> transReqWithTransporter, int transporterID)
        {
            if (transReqWithTransporter != null && transporterID != 0)
            {

                var transportOrder = new TransportOrder();
                transportOrder.TransporterID = transporterID;
                transportOrder.OrderDate = DateTime.Today;
                transportOrder.StartDate = DateTime.Today;
                transportOrder.EndDate = DateTime.Today;
                transportOrder.TransportOrderNo = Guid.NewGuid().ToString();
                transportOrder.OrderExpiryDate = DateTime.Today.AddDays(10);
                var currentBid = _unitOfWork.ApplicationSettingRepository.FindBy(t => t.SettingName == "CurrentBid");
                var transporterName = _unitOfWork.TransporterRepository.FindById(transportOrder.TransporterID).Name;
                if (currentBid != null)
                {
                    var bidID = int.Parse(currentBid[0].SettingValue);
                    transportOrder.BidDocumentNo = _unitOfWork.BidRepository.FindById(bidID).BidNumber;
                }
                else
                {
                    transportOrder.BidDocumentNo = "Bid-Number";

                }
                transportOrder.PerformanceBondReceiptNo = "PERFORMANCE-BOND-NO";
                //var transporterName = _unitOfWork.TransporterRepository.FindById(transporter).Name;
                transportOrder.ContractNumber = Guid.NewGuid().ToString();
                //string.Format("{0}/{1}/{2}/{3}", "LTCD", DateTime.Today.day, DateTime.Today.Year, transporterName.Substring(0, 1));
                transportOrder.TransporterSignedDate = DateTime.Today;
                transportOrder.RequestedDispatchDate = DateTime.Today;
                transportOrder.ConsignerDate = DateTime.Today;
                transportOrder.StatusID = (int)TransportOrderStatus.Draft;
                var lastOrder = _unitOfWork.TransportOrderRepository.GetAll();
                if (lastOrder.Count!=0)
                {
                    transportOrder.TransportOrderNo = string.Format("TRN-ORD-{0}", lastOrder.Last().TransportOrderID + 1);
                }
                else
                {
                    transportOrder.TransportOrderNo = string.Format("TRN-ORD-{0}", 1);
                }
                transportOrder.ContractNumber = string.Format("{0}/{1}/{2}/{3}", "LTCD", DateTime.Today.Day,
                                                              DateTime.Today.Year, transporterName.Substring(0, 3));
                foreach (var detail in transReqWithTransporter)
                {
                    var transportOrderDetail = new TransportOrderDetail();
                    transportOrderDetail.CommodityID = detail.CommodityID;
                    transportOrderDetail.FdpID = detail.FdpID;
                    transportOrderDetail.RequisitionID = detail.RequisitionID;
                    transportOrderDetail.QuantityQtl = detail.QuantityQtl;
                    //since users don't specify tariff value
                    transportOrderDetail.TariffPerQtl = 0;
                    transportOrderDetail.SourceWarehouseID = detail.HubID;
                    transportOrder.TransportOrderDetails.Add(transportOrderDetail);
                }
                bool isSaved = _unitOfWork.TransportOrderRepository.Add(transportOrder);
                _unitOfWork.Save();
                if (isSaved)
                {
                    foreach (var item in transReqWithTransporter)
                    {
                        var withoutTransporter =
                            _unitOfWork.TransReqWithoutTransporterRepository.FindById(item.TransReqWithoutTransporterID);
                        withoutTransporter.IsAssigned = true;
                        _unitOfWork.TransReqWithoutTransporterRepository.Edit(withoutTransporter);
                        _unitOfWork.Save();
                    }

                }

                return true;
            }
            return false;
        }
 private TransportOrderDetailViewModel BindTransportOrderDetailViewModel(TransportOrderDetail transportOrderDetail)
 {
     TransportOrderDetailViewModel transportOrderDetailViewModel = null;
     if (transportOrderDetail != null)
     {
         transportOrderDetailViewModel = new TransportOrderDetailViewModel
         {
             FdpID = transportOrderDetail.FdpID,
             FDP = transportOrderDetail.FDP.Name,
             CommodityID = transportOrderDetail.CommodityID,
             Commodity = transportOrderDetail.Commodity.Name,
             DonorID = transportOrderDetail.DonorID,
             OriginWarehouse = transportOrderDetail.Hub.Name,
             QuantityQtl = transportOrderDetail.QuantityQtl,
             RequisitionID = transportOrderDetail.RequisitionID,
             RequisitionNo =
                 transportOrderDetail.ReliefRequisition.RequisitionNo,
             SourceWarehouseID = transportOrderDetail.SourceWarehouseID,
             TariffPerQtl = transportOrderDetail.TariffPerQtl,
             Woreda = transportOrderDetail.FDP.AdminUnit.Name
         };
     }
     return transportOrderDetailViewModel;
 }
Ejemplo n.º 5
0
        public ActionResult ChangeTransporters([DataSourceRequest] DataSourceRequest request, List<SubstituteTransporterOrder> listOfSubTransporterOrders, int changedTransportOrderID)
        {
            var changedTransportOrderObj = _transportOrderService.FindById(changedTransportOrderID);
            var returnedObj = new List<TransportOrder>();
            foreach (var subTransporterOrders in listOfSubTransporterOrders)
            {
                var transporterCount = subTransporterOrders.TransportersStandingList.Count();

                foreach (var transporter in subTransporterOrders.TransportersStandingList)
                {
                    changedTransportOrderObj = _transportOrderService.FindById(changedTransportOrderID);
                    var transporterObj = _transporterService.FindById(transporter.TransporterID);
                    var transportOrder =
                        _transportOrderService.Get(t => t.TransporterID == transporterObj.TransporterID &&
                                                        t.StatusID == (int)TransportOrderStatus.Draft).
                            FirstOrDefault();
                    if (transportOrder != null)
                    {
                        foreach (var transportOrderDetail in changedTransportOrderObj.TransportOrderDetails.ToList())
                        {
                            if (transportOrderDetail.FDP.AdminUnitID == subTransporterOrders.WoredaID)
                            {
                                var transportOrderDetailObj = new TransportOrderDetail
                                {
                                    CommodityID = transportOrderDetail.CommodityID,
                                    FdpID = transportOrderDetail.FdpID,
                                    RequisitionID = transportOrderDetail.RequisitionID,
                                    QuantityQtl = transportOrderDetail.QuantityQtl.ToPreferedWeightUnit() / transporterCount,
                                    TariffPerQtl = transportOrderDetail.TariffPerQtl,
                                    SourceWarehouseID = transportOrderDetail.Hub.HubID,
                                    //transportOrderDetailObj.ZoneID = transportOrderDetail.ReliefRequisition.ZoneID;
                                };
                                transportOrder.TransportOrderDetails.Add(transportOrderDetailObj);
                                _transportOrderService.EditTransportOrder(transportOrder);
                            }
                        }

                        returnedObj.Add(transportOrder);
                    }
                    else
                    {
                        var transportOrderObj = new TransportOrder
                        {
                            TransporterID = transporter.TransporterID,
                            OrderDate = DateTime.Today,
                            TransportOrderNo = Guid.NewGuid().ToString(),
                            OrderExpiryDate = DateTime.Today.AddDays(10),
                            BidDocumentNo = "BID-DOC-No",
                            PerformanceBondReceiptNo = "PERFORMANCE-BOND-NO",
                            ContractNumber = Guid.NewGuid().ToString(),
                            TransporterSignedDate = DateTime.Today,
                            RequestedDispatchDate = DateTime.Today,
                            ConsignerDate = DateTime.Today,
                            StatusID = (int)TransportOrderStatus.Draft,
                            StartDate = DateTime.Today,
                            EndDate = DateTime.Today.AddDays(10),
                        };
                        _transportOrderService.AddTransportOrder(transportOrderObj);
                        var transporterName = _transporterService.FindById(transportOrderObj.TransporterID).Name;
                        transportOrderObj.TransportOrderNo = string.Format("TRN-ORD-{0}", transportOrderObj.TransportOrderID);
                        transportOrderObj.ContractNumber = string.Format("{0}/{1}/{2}/{3}", "LTCD", DateTime.Today.Day, DateTime.Today.Year, transporterName.Substring(0, 2));
                        _transportOrderService.EditTransportOrder(transportOrderObj);
                        //var transportOrderDetailList = subTransporterOrders.TransportOrderDetails;
                        foreach (var transportOrderDetail in changedTransportOrderObj.TransportOrderDetails.ToList())
                        {
                            if (transportOrderDetail.FDP.AdminUnitID == subTransporterOrders.WoredaID)
                            {
                                var transportOrderDetailObj = new TransportOrderDetail
                                    {
                                        TransportOrderID = transportOrderObj.TransportOrderID,
                                        CommodityID = transportOrderDetail.CommodityID,
                                        FdpID = transportOrderDetail.FdpID,
                                        RequisitionID = transportOrderDetail.RequisitionID,
                                        QuantityQtl =
                                            transportOrderDetail.QuantityQtl.ToPreferedWeightUnit() / transporterCount,
                                        TariffPerQtl = transportOrderDetail.TariffPerQtl,
                                        SourceWarehouseID = transportOrderDetail.Hub.HubID
                                    };
                                //transportOrderDetail.ZoneID = reliefRequisitionDetail.ReliefRequisition.ZoneID;
                                _transportOrderDetailService.AddTransportOrderDetail(transportOrderDetailObj);
                            }
                        }

                        returnedObj.Add(transportOrderObj);

                    }
                }
            }
            changedTransportOrderObj.StatusID = (int)TransportOrderStatus.Failed;
            _transportOrderService.EditTransportOrder(changedTransportOrderObj);
            return RedirectToAction("Index", "TransportOrder", returnedObj);
            //return Json(returnedObj.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
 public bool EditTransportOrderDetail(TransportOrderDetail transportOrderDetail)
 {
     _unitOfWork.TransportOrderDetailRepository.Edit(transportOrderDetail);
     _unitOfWork.Save();
     return true;
 }
Ejemplo n.º 7
0
        private int AddToCurrentTransport(IEnumerable<TransportRequisitionWithoutWinnerModel> transReqWithTransporter, int transporterId)
        {
            try
               {

               var transportOrder =new TransportOrder();

               var transReq = transReqWithTransporter as List<TransportRequisitionWithoutWinnerModel> ?? transReqWithTransporter.ToList();
               foreach (var detail in transReq)
               {
                   var transportReq = _unitOfWork.TransReqWithoutTransporterRepository.FindById(detail.TransReqWithoutTransporterID);
                   //transportOrder =
                   //    _unitOfWork.TransportOrderDetailRepository.FindBy(
                   //        t => t.RequisitionID == transportReq.ReliefRequisitionDetail.RequisitionID && t.TransportOrder.TransporterID == transporterId &&
                   //    t.TransportOrder.StatusID == (int)TransportOrderStatus.Draft).Select(
                   //            t => t.TransportOrder).FirstOrDefault();
                   TransportRequisitionWithoutWinnerModel detail1 = detail;
                   transportOrder =
                     _unitOfWork.TransportOrderDetailRepository.FindBy(t=>t.TransportOrder.TransporterID == transporterId && t.TransportOrder.TransportRequiqsitionId == transportReq.TransportRequisitionDetail.TransportRequisitionID  &&
                     t.TransportOrder.StatusID == (int)TransportOrderStatus.Draft).Select(
                             t => t.TransportOrder).FirstOrDefault();

                   if (transportOrder == null) continue;
                   var transportOrderDetail = new TransportOrderDetail
                                                  {
                                                      CommodityID = detail.CommodityID,
                                                      FdpID = detail.FdpID,
                                                      RequisitionID = detail.RequisitionID,
                                                      QuantityQtl = detail.QuantityQtl,
                                                      TariffPerQtl = 0,
                                                      SourceWarehouseID = detail.HubID,
                                                      WinnerAssignedByLogistics = true
                                                  };
                   transportOrder.TransportOrderDetails.Add(transportOrderDetail);

               }

               bool isSaved = _unitOfWork.TransportOrderRepository.Edit(transportOrder);
               _unitOfWork.Save();
               if (isSaved)
               {

                   foreach (var item in transReq)

                   {
                       var withoutTransporter =
                           _unitOfWork.TransReqWithoutTransporterRepository.FindById(item.TransReqWithoutTransporterID);
                       withoutTransporter.IsAssigned = true;
                       _unitOfWork.TransReqWithoutTransporterRepository.Edit(withoutTransporter);
                       _unitOfWork.Save();
                   }

               }
               if (transportOrder != null) return transportOrder.TransportOrderID;
               return -1;
               }
               catch (Exception)
               {

               return -1;
               }
        }
Ejemplo n.º 8
0
        public ActionResult ChangeTransporters([DataSourceRequest] DataSourceRequest request, List<SubstituteTransporterOrder> listOfSubTransporterOrders, int changedTransportOrderID)
        {
            var orderDetails = new List<TransportOrderDetail>();
            var weightPref = UserAccountHelper.GetUser(User.Identity.Name).PreferedWeightMeasurment;
            var changedTransportOrderObj = _transportOrderService.FindById(changedTransportOrderID);
            var returnedObj = new List<TransportOrder>();
            var tempContratNo = string.Empty;
               foreach (var subTransporterOrders in listOfSubTransporterOrders)
            {
                if (subTransporterOrders.TransportersStandingList.All(t => t.IsChecked == false))
                    continue; // No transporter is checked
                var filteredTransporterList = from transporters in subTransporterOrders.TransportersStandingList
                                               where transporters.IsChecked
                                               select transporters;

                var transportBidQuotationViewModels = filteredTransporterList as List<TransportBidQuotationViewModel> ?? filteredTransporterList.ToList();
                var transporterCount = transportBidQuotationViewModels.Count();

                foreach (var transporter in transportBidQuotationViewModels)
                {
                    changedTransportOrderObj = _transportOrderService.FindById(changedTransportOrderID);
                    var transporterObj = _transporterService.FindById(transporter.TransporterID);
                    //var transportOrder =
                    //    _transportOrderService.Get(t => t.TransporterID == transporterObj.TransporterID &&
                    //                                    t.StatusID == (int)TransportOrderStatus.Draft).
                    //        FirstOrDefault();

                    SubstituteTransporterOrder orders = subTransporterOrders;
                    TransportOrder transportOrderOld = null;

                    var transportOrder = _transportOrderService.FindBy(t=>t.TransporterID == transporterObj.TransporterID && t.StatusID == (int) TransportOrderStatus.Draft).Distinct();
                    var transportOrders = transportOrder as List<TransportOrder> ?? transportOrder.ToList();
                    foreach (var order in transportOrders)
                    {
                        if (tempContratNo!=string.Empty)
                        {
                            if (_transportOrderService.GetTransportRequisitionNo(order.ContractNumber) == _transportOrderService.GetTransportRequisitionNo(tempContratNo))
                          {
                              transportOrderOld = order;
                          }
                        }
                        //else if (_transportOrderService.GetTransportRequisitionNo(order.ContractNumber) == _transportOrderService.GetTransportRequisitionNo(changedTransportOrderObj.ContractNumber))
                        //{
                        //    transportOrderOld = order;
                        //}
                    }
                    if (transportOrderOld != null)
                    {
                        foreach (var transportOrderDetail in changedTransportOrderObj.TransportOrderDetails.ToList())
                        {
                            if (transportOrderDetail.FDP.AdminUnitID == subTransporterOrders.WoredaID)
                            {
                                //var qty = weightPref == "QTL"
                                //                  ? transportOrderDetail.QuantityQtl.ToMetricTone()/transporterCount
                                //                  : transportOrderDetail.QuantityQtl/transporterCount;

                                var transportOrderDetailObj = new TransportOrderDetail
                                {
                                    CommodityID = transportOrderDetail.CommodityID,
                                    FdpID = transportOrderDetail.FdpID,
                                    RequisitionID = transportOrderDetail.RequisitionID,
                                    QuantityQtl = transportOrderDetail.QuantityQtl / transporterCount,
                                    TariffPerQtl = transportOrderDetail.TariffPerQtl,
                                    SourceWarehouseID = transportOrderDetail.Hub.HubID,
                                    BidID = transportOrderDetail.BidID
                                    //transportOrderDetailObj.ZoneID = transportOrderDetail.ReliefRequisition.ZoneID;
                                };
                                _transportOrderService.UpdateTransporterOrder(transportOrderDetail.TransportOrderID,subTransporterOrders.WoredaID);
                                transportOrderOld.TransportOrderDetails.Add(transportOrderDetailObj);
                                _transportOrderService.EditTransportOrder(transportOrderOld);
                                orderDetails.Add(transportOrderDetailObj);
                            }
                        }
                        //_transportOrderService.DeleteTransportOrderDetails(orderDetails); // Delete details from the previous TO
                        returnedObj.Add(transportOrderOld);
                    }
                    else
                    {

                        var transportOrderObj = new TransportOrder
                        {
                            TransporterID = transporter.TransporterID,
                            OrderDate = DateTime.Today,
                            TransportOrderNo = Guid.NewGuid().ToString(),
                            OrderExpiryDate = DateTime.Today.AddDays(10),
                            BidDocumentNo = "BID-DOC-No",
                            PerformanceBondReceiptNo = "PERFORMANCE-BOND-NO",
                            ContractNumber = Guid.NewGuid().ToString(),
                            TransporterSignedDate = DateTime.Today,
                            RequestedDispatchDate = DateTime.Today,
                            ConsignerDate = DateTime.Today,
                            StatusID = (int)TransportOrderStatus.Draft,
                            StartDate = DateTime.Today,
                            EndDate = DateTime.Today.AddDays(10),
                        };
                        _transportOrderService.AddTransportOrder(transportOrderObj);
                        //var transporterName = _transporterService.FindById(transportOrderObj.TransporterID).Name;
                        transportOrderObj.TransportOrderNo = string.Format("TRN-ORD-{0}", transportOrderObj.TransportOrderID);
                        transportOrderObj.ContractNumber = string.Format("{0}/{1}",changedTransportOrderObj.ContractNumber,"N");
                        tempContratNo = transportOrderObj.ContractNumber;
                        _transportOrderService.EditTransportOrder(transportOrderObj);
                        //var transportOrderDetailList = subTransporterOrders.TransportOrderDetails;
                        foreach (var transportOrderDetail in changedTransportOrderObj.TransportOrderDetails.ToList())
                        {
                            if (transportOrderDetail.FDP.AdminUnitID == subTransporterOrders.WoredaID)
                            {
                                var qty =
                                    _transportOrderService.CheckIfCommodityIsDipatchedToThisFdp(
                                        transportOrderDetail.FdpID, transportOrderDetail.TransportOrder.BidDocumentNo,
                                        transportOrderDetail.TransportOrder.TransporterID,
                                        transportOrderDetail.TransportOrderID,transportOrderDetail.CommodityID);
                                if (qty == null)
                                {
                                    var transportOrderDetailObj = new TransportOrderDetail
                                    {
                                        TransportOrderID = transportOrderObj.TransportOrderID,
                                        CommodityID = transportOrderDetail.CommodityID,
                                        FdpID = transportOrderDetail.FdpID,
                                        RequisitionID = transportOrderDetail.RequisitionID,
                                        QuantityQtl = transportOrderDetail.QuantityQtl,
                                        TariffPerQtl = transportOrderDetail.TariffPerQtl,
                                        SourceWarehouseID = transportOrderDetail.Hub.HubID,
                                        BidID = transportOrderDetail.BidID,
                                        WinnerAssignedByLogistics = true
                                    };
                                    _transportOrderService.UpdateTransporterOrder(transportOrderDetail.TransportOrderID, subTransporterOrders.WoredaID);
                                    //transportOrderDetail.ZoneID = reliefRequisitionDetail.ReliefRequisition.ZoneID;
                                    _transportOrderDetailService.AddTransportOrderDetail(transportOrderDetailObj);
                                }
                                else if (qty <= 0)
                                {
                                    continue;
                                }

                                //var qty = weightPref == "QTL"
                                //                 ? transportOrderDetail.QuantityQtl.ToMetricTone() / transporterCount
                                //                 : transportOrderDetail.QuantityQtl / transporterCount;

                            }
                        }

                        returnedObj.Add(transportOrderObj);

                    }
                }
            }
            //changedTransportOrderObj.StatusID = (int)TransportOrderStatus.Failed;
            _transportOrderService.EditTransportOrder(changedTransportOrderObj);
            return RedirectToAction("Index", "TransportOrder", returnedObj);
            //return Json(returnedObj.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }