/// <summary> /// The Handle /// </summary> /// <param name="request">The request<see cref="ValidatedBoalfCommand"/></param> /// <param name="cancellationToken">The cancellationToken<see cref="CancellationToken"/></param> /// <returns>The <see cref="Task{BusinessValidationProxy}"/></returns> public async Task <BusinessValidationProxy> Handle(ValidatedBoalfCommand request, CancellationToken cancellationToken) { if (request != null && request.Items != null) { var boalfList = await query.GetListAsync(request.Items.ItemPath, request.Items.ItemId); var boalfGroups = boalfList.GroupBy(g => new { g.BmuName, g.BidOfferAcceptanceNumber, g.AcceptanceTime }); List <ParticipantEnergyAsset> participantEnergyAsset = new List <ParticipantEnergyAsset>(); List <BoalfIndexTable> boalfIndexTables = new List <BoalfIndexTable>(); foreach (var boalfGroup in boalfGroups) { participantEnergyAsset.AddRange(await query.GetBmuParticipationAsync(boalfGroup.FirstOrDefault().TimeFrom, boalfGroup.FirstOrDefault().TimeTo)); boalfIndexTables.AddRange(await query.GetListBoalfIndexTable(boalfGroup.FirstOrDefault().BmuName, boalfGroup.FirstOrDefault().BidOfferAcceptanceNumber.ToString() , boalfGroup.FirstOrDefault().AcceptanceTime.ToString("yyyy-MM-dd HH:mm"))); } var aggregate = new Aggregate <Boalf>(request.Items, boalfList, participantEnergyAsset, boalfIndexTables); if (aggregate.BusinessValidationFlow.Count > 0) { await GetConfigurationDataFromKeyVault(aggregate); businessValidationProxy = await BoalfValidationProcessAsync(aggregate); } } return(businessValidationProxy); }
/// <summary> /// The Handle /// </summary> /// <param name="request">The request<see cref="ValidatedFpnCommand"/></param> /// <param name="cancellationToken">The cancellationToken<see cref="CancellationToken"/></param> /// <returns>The <see cref="Task{BusinessValidationProxy}"/></returns> public async Task <BusinessValidationProxy> Handle(ValidatedFpnCommand request, CancellationToken cancellationToken) { if (request?.Items != null) { var fpnList = await _query.GetListAsync(request.Items.ItemPath, request.Items.ItemId); var bmuParticipationList = await _query.GetBmuParticipationAsync(fpnList.FirstOrDefault().TimeFrom, fpnList.FirstOrDefault().TimeTo); var aggregate = new Aggregate <Fpn>(request.Items, fpnList, bmuParticipationList, null); if (aggregate.BusinessValidationFlow.Count > 0) { await GetConfigurationDataFromKeyVault(aggregate); businessValidationProxy = await FpnValidationProcessAsync(aggregate); } } return(businessValidationProxy); }