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 List <PackageTransfer> GetByDateTransferTypeBcoId(DateTime date, string transferType, Guid bcoId) { List <PackageTransfer> models = new List <PackageTransfer>(); models = base.FilterBy(x => (x.TransferDate.Year == date.Year && x.TransferDate.Month == date.Month && x.TransferDate.Day == date.Day)); BranchCorpOfficeBL bcoService = new BranchCorpOfficeBL(); switch (transferType) { case TransferTypeConstant.BsoToBco: BranchSatOfficeBL bsoService = new BranchSatOfficeBL(); var bsos = bsoService.FilterBy(x => x.RevenueUnitType.RevenueUnitTypeName.Equals(RevenueUnitTypes.BSO) && x.City.BranchCorpOffice.BranchCorpOfficeId == bcoId).Select(x => x.RevenueUnitId).ToList(); models = models.Where( x => x.TransferType.Equals(TransferTypeConstant.BsoToBco) && bsos.Contains(x.TransferFromId)) .ToList(); if (models != null) { foreach (var item in models) { item.TransferFrom = bsoService.GetById(item.TransferFromId); item.TransferTo = bcoService.GetById(item.TransferToId); } } break; case TransferTypeConstant.BcoToGateWay: var bcos = bcoService.FilterBy(x => x.BranchCorpOfficeId == bcoId).Select(x => x.BranchCorpOfficeId).ToList(); models = models.Where( x => x.TransferType.Equals(TransferTypeConstant.BsoToBco) && bcos.Contains(x.TransferFromId)) .ToList(); break; } return(models); }