/// <summary> /// The save. /// </summary> /// <param name="highProfit"> /// The high profit. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task SaveAsync(IHighProfitJudgement highProfit) { this.logger?.LogInformation($"High profit judgement saving for rule run {highProfit.RuleRunId}"); if (highProfit == null) { this.logger?.LogError("High profit judgement was null"); return; } var dto = new HighProfitJudgementDto(highProfit); try { using (var databaseConnection = this.databaseConnectionFactory.BuildConn()) using (var connection = databaseConnection.ExecuteAsync(SaveHighProfit, dto)) { await connection; } } catch (Exception e) { this.logger?.LogError(e, $"Error in save insert for high profit"); } }
/// <summary> /// Initializes a new instance of the <see cref="HighProfitJudgementDto"/> class. /// </summary> /// <param name="judgement"> /// The judgement. /// </param> public HighProfitJudgementDto(IHighProfitJudgement judgement) : base( !judgement?.NoAnalysis ?? false, judgement?.ClientOrderId, judgement?.OrderId, judgement?.Parameters, judgement?.RuleRunCorrelationId, judgement?.RuleRunId) { if (judgement == null) { return; } this.AbsoluteHighProfit = judgement.AbsoluteHighProfit; this.AbsoluteHighProfitCurrency = judgement.AbsoluteHighProfitCurrency; this.PercentageHighProfit = judgement.PercentageHighProfit; }