public static TransportRequisitionDetailViewModel BindTransportRequisitionDetailViewModel(RequisitionToDispatch requisitionToDispatch)
 {
     TransportRequisitionDetailViewModel transportRequisitionDetailViewModel = null;
     if (requisitionToDispatch != null)
     {
         transportRequisitionDetailViewModel = new TransportRequisitionDetailViewModel();
         transportRequisitionDetailViewModel.CommodityID = requisitionToDispatch.CommodityID;
         transportRequisitionDetailViewModel.CommodityName = requisitionToDispatch.CommodityName;
         transportRequisitionDetailViewModel.HubID = requisitionToDispatch.HubID;
         transportRequisitionDetailViewModel.OrignWarehouse = requisitionToDispatch.OrignWarehouse;
         transportRequisitionDetailViewModel.QuanityInQtl = requisitionToDispatch.QuanityInQtl.ToPreferedWeightUnit();
         transportRequisitionDetailViewModel.Region = requisitionToDispatch.RegionName;
         transportRequisitionDetailViewModel.Zone = requisitionToDispatch.Zone;
         transportRequisitionDetailViewModel.RequisitionNo = requisitionToDispatch.RequisitionNo;
         transportRequisitionDetailViewModel.RequisitionID = requisitionToDispatch.RequisitionID;
         //transportRequisitionDetailViewModel.DonorID = requisitionToDispatch.DonorID;
         //transportRequisitionDetailViewModel.Donor = requisitionToDispatch.Donor;
     }
     return transportRequisitionDetailViewModel;
 }
Пример #2
0
        public List<RequisitionToDispatch> GetTransportRequisitionDetail(List<int> requIds)
        {
            var result = new List<RequisitionToDispatch>();
            foreach (var requId in requIds)
            {
                var requisition = _unitOfWork.ReliefRequisitionRepository.FindById(requId);
                var requisitionToDispatch = new RequisitionToDispatch();
                var hubAllocation =
                    _unitOfWork.HubAllocationRepository.Get(t => t.RequisitionID == requisition.RequisitionID, null,
                                                            "Hub").FirstOrDefault();
                var status = _unitOfWork.WorkflowStatusRepository.Get(
                    t => t.StatusID == requisition.Status && t.WorkflowID == (int)WORKFLOW.RELIEF_REQUISITION).FirstOrDefault();

                if (hubAllocation != null) requisitionToDispatch.HubID = hubAllocation.HubID;
                requisitionToDispatch.RequisitionID = requisition.RequisitionID;
                requisitionToDispatch.RequisitionNo = requisition.RequisitionNo;
                if (requisition.Status != null) requisitionToDispatch.RequisitionStatus = requisition.Status.Value;
                if (requisition.ZoneID != null) requisitionToDispatch.ZoneID = requisition.ZoneID.Value;
                requisitionToDispatch.QuanityInQtl = requisition.ReliefRequisitionDetails.Sum(m => m.Amount);
                if (hubAllocation != null) requisitionToDispatch.OrignWarehouse = hubAllocation.Hub.Name;
                if (requisition.CommodityID != null) requisitionToDispatch.CommodityID = requisition.CommodityID.Value;
                requisitionToDispatch.CommodityName = requisition.Commodity.Name;
                requisitionToDispatch.Zone = requisition.AdminUnit1.Name;
                if (requisition.RegionID != null) requisitionToDispatch.RegionID = requisition.RegionID.Value;

                requisitionToDispatch.RegionName = requisition.AdminUnit.Name;
                if (status != null) requisitionToDispatch.RequisitionStatusName = status.Description;
                result.Add(requisitionToDispatch);
            }
            return result;
        }
Пример #3
0
        public IEnumerable<RequisitionToDispatch> GetRequisitionToDispatch()
        {
            var requisitions = GetProjectCodeAssignedRequisitions();
            var result = new List<RequisitionToDispatch>();
            foreach (var requisition in requisitions)
            {
                var requisitionToDispatch = new RequisitionToDispatch();
                var hubAllocation =
                    _unitOfWork.HubAllocationRepository.Get(t => t.RequisitionID == requisition.RequisitionID,null,"Hub").FirstOrDefault();
                var status = _unitOfWork.WorkflowStatusRepository.Get(
                    t => t.StatusID == requisition.Status && t.WorkflowID == (int)WORKFLOW.RELIEF_REQUISITION).FirstOrDefault();

                requisitionToDispatch.HubID = hubAllocation.HubID;
                requisitionToDispatch.RequisitionID = requisition.RequisitionID;
                requisitionToDispatch.RequisitionNo = requisition.RequisitionNo;
                requisitionToDispatch.RequisitionStatus = requisition.Status.Value;
                requisitionToDispatch.ZoneID = requisition.ZoneID.Value;
                requisitionToDispatch.QuanityInQtl = requisition.ReliefRequisitionDetails.Sum(m => m.Amount);
                requisitionToDispatch.OrignWarehouse = hubAllocation.Hub.Name;
                requisitionToDispatch.CommodityID = requisition.CommodityID.Value;
                requisitionToDispatch.CommodityName = requisition.Commodity.Name;
                requisitionToDispatch.Zone = requisition.AdminUnit.Name;
                requisitionToDispatch.RegionID = requisition.RegionID.Value;

                requisitionToDispatch.RegionName = requisition.AdminUnit1.Name;
                requisitionToDispatch.RequisitionStatusName = status.Description;
               result.Add(requisitionToDispatch);
            }

            return result;
        }