public CalculationStateReport(Calculation calculation, CalculationProgress progress, IReadOnlyList <string> messages) { this.calculation = calculation; if (messages != null) { this.messages = messages; } else { if (calculation.CalculationResult != null) { this.messages = calculation.CalculationResult.Messages; } } if (progress != null) { this.progress = progress; } else { this.progress = new CalculationProgress(); if (calculation.CalculationResult != null) { this.progress.SetProgress(calculation.CalculationResult.TotalEmployeesCount, calculation.CalculationResult.EmployeesCalculatedCount); if (calculation.CalculationResult.LastCalculatedPath.HasValue) { this.progress.SetLastCalculatedEmployee(calculation.CalculationResult.LastCalculatedEmployeeId, calculation.CalculationResult.LastCalculatedPath.Value); } } } }
public void UpdateCalculationResult(Calculation calculation, CalculationProgress progress, IJobIndexPointCalculator calculator, List <string> messages) { using (var transaction = new TransactionScope()) { var calc = calcRep.GetById(calculation.Id); if (progress.LastCalculatedEmployeeId != null) { calc.UpdateCalculationResult(progress.TotalItem, progress.ItemsCalculated, messages, progress.LastCalculatedPath.Value, empRep.GetBy(progress.LastCalculatedEmployeeId)); } else { calc.UpdateCalculationResult(progress.TotalItem, progress.ItemsCalculated, messages); } calc.Finish(calculator); transaction.Complete(); } }
private void CalibrationOnDetectProgress(float progress) { CalculationProgress?.Invoke(progress); }