/// <summary> /// The ProcessFileForValidRecords /// </summary> /// <param name="aggregate">The aggregate<see cref="Aggregate{Boalf}"/></param> /// <returns>The <see cref="Task"/></returns> private async Task ProcessFileForValidRecords(Aggregate <Boalf> aggregate) { var boalfModels = GetBoalfModelsWithSp(aggregate.ValidFlow, aggregate.SettlementDuration); try { if (boalfModels != null && boalfModels.Count > 0) { aggregate.SettlementPeriodsForFile.AddRange(boalfModels.SelectMany(g => g.Settlements.Select(s => s.SettlementPeriod)).Distinct().ToList()); foreach (var settlementPeriod in aggregate.SettlementPeriodsForFile) { var settlements = boalfModels.SelectMany(g => g.Settlements).Distinct().ToList(); var settlement = settlements.Where(g => g.SettlementPeriod == settlementPeriod); string path = await GetPath(settlement.FirstOrDefault().SettlementDay, settlementPeriod); var ExistingboalfList = await GetExistingBlobData(path); await UpdateOrInsertAcceptance(aggregate, ExistingboalfList, path); aggregate.ValidPath.Add(path); } await RemoveAcceptancesForSettlementPeriodUpdateNotReceived(boalfModels, aggregate); await InsertIntoBoalfIndexTable(boalfModels); await writer.UpdateFileStatus(Common.GetStatusOfBusinessValidation(aggregate.ValidPath.FirstOrDefault())); Log.Information(BusinessValidationConstants.LOGMESSAGES_BOALFSUCCESSMESSAGE); } } catch (Exception ex) { Log.Error(ex.Message); throw; } }
private async Task UploadFileAndFileStatusForRejected(Aggregate <Disbsad> aggregate, string outputPath) { await writer.UpLoadFile(aggregate.InValidFlow, outputPath); await writer.UpdateFileStatus(Common.GetStatusOfRejectedFile(outputPath, BusinessValidationConstants.REJECTED)); businessValidationProxy.InValid = true; }
/// <summary> /// The FileProcessAsync /// </summary> /// <param name="fpns">The fpns<see cref="List{Fpn}"/></param> /// <param name="path">The path<see cref="string"/></param> /// <param name="isValid">The isValid<see cref="bool"/></param> /// <param name="warningResult">The warningResult<see cref="ValidationResult"/></param> /// <param name="folderName">The folderName<see cref="string"/></param> /// <returns>The <see cref="Task"/></returns> private async Task FileProcessAsync(List <Fpn> fpns, string path, bool isValid, ValidationResult warningResult, string folderName) { path = Common.GetOutputFolderPath(fpns.Select(x => x.SettlementDay).FirstOrDefault(), Convert.ToInt32(fpns.Select(x => x.SettlementPeriod).FirstOrDefault()), path, folderName); await _writer.UpLoadFile(fpns, path); if (isValid) { businessValidationProxy.Valid = true; businessValidationProxy.ValidPaths.Add(path); businessValidationProxy.ValidationResult = warningResult.IsValid; await _writer.UpdateFileStatus(Common.GetStatusOfBusinessValidation(path)); } else { businessValidationProxy.InValid = true; businessValidationProxy.InValidPaths.Add(path); await _writer.UpdateFileStatus(Common.GetStatusOfRejectedFile(path, BusinessValidationConstants.WARNING)); } }