public List <TransferAcceptance> GetByDateAcceptanceTypeBcoId(DateTime date, string acceptanceType, Guid bcoId, Guid?gatewayId) { List <TransferAcceptance> models = new List <TransferAcceptance>(); models = base.FilterBy(x => (x.AcceptanceDate.Year == date.Year && x.AcceptanceDate.Month == date.Month && x.AcceptanceDate.Day == date.Day)); BranchCorpOfficeBL bcoService = new BranchCorpOfficeBL(); switch (acceptanceType) { case AcceptanceTypeConstant.AreaToBco: AreaBL areaService = new AreaBL(); var bsos = areaService.FilterBy(x => x.Cluster.BranchCorpOffice.BranchCorpOfficeId == bcoId).Select(x => x.RevenueUnitId).ToList(); models = models.Where( x => x.TransferType.Equals(TransferTypeConstant.AreaToBco) && bsos.Contains(x.TransferFromId)) .ToList(); if (models != null) { foreach (var item in models) { item.TransferFrom = areaService.GetById(item.TransferFromId); item.TransferTo = bcoService.GetById(item.TransferToId); } } break; case AcceptanceTypeConstant.BcoToGateWay: GatewayBL gatewayService = new GatewayBL(); models = models.Where( x => x.TransferType.Equals(TransferTypeConstant.BcoToGateWay) && x.TransferFromId == bcoId && x.TransferToId == gatewayId) .ToList(); if (models != null) { foreach (var item in models) { item.TransferFrom = bcoService.GetById(item.TransferFromId); item.TransferTo = gatewayService.GetById(item.TransferToId); } } break; } return(models); }
public TruckAreaMappingBL() { _unitOfWork = GetUnitOfWork(); truckService = new TruckBL(_unitOfWork); areaService = new AreaBL(_unitOfWork); }