/// <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); }
/// <summary> /// The Handle /// </summary> /// <param name="request">The request<see cref="ValidatedDisbsadCommand"/></param> /// <param name="cancellationToken">The cancellationToken<see cref="CancellationToken"/></param> /// <returns>The <see cref="Task{BusinessValidationProxy}"/></returns> public async Task <BusinessValidationProxy> Handle(ValidatedDisbsadCommand request, CancellationToken cancellationToken) { if (request?.Item != null) { var disbsads = await query.GetListAsync(request.Item.ItemPath, request.Item.ItemId); if (disbsads != null && disbsads.Any()) { var aggregate = new Aggregate <Disbsad>(request.Item, disbsads, null, null) { LongDay = DateTime.ParseExact(BusinessValidationConstants.CONFIG_LONGDAY, BusinessValidationConstants.CONFIG_DATEFORMAT, System.Globalization.CultureInfo.InvariantCulture), ShortDay = DateTime.ParseExact(BusinessValidationConstants.CONFIG_SHORTDAY, BusinessValidationConstants.CONFIG_DATEFORMAT, System.Globalization.CultureInfo.InvariantCulture), }; businessValidationProxy = await ValidateDisbsadAsync(aggregate); } } return(businessValidationProxy); }
/// <summary> /// The GetExistingBlobData /// </summary> /// <param name="path">The path<see cref="string"/></param> /// <returns>The <see cref="List{Boalf}"/></returns> private async Task <List <Boalf> > GetExistingBlobData(string path) { return(await query.GetListAsync(path, BusinessValidationConstants.FLOWS_BOALF)); }