public ReportStatisticDetail(Process process) { this.ProcessId = process.ProcessId; this.ProcessName = process.ProcessName; this.Description = process.Description; this.CreatedBy = process.CreatedBy; if (process.ProcessExecutions != null) { this.NumberExecution = process.ProcessExecutions.Count; var numberDone = process.ProcessExecutions.Count(x => x.Status == 2); var numberUnDone = process.ProcessExecutions.Count(x => x.Status != 1); this.CompletionRate = numberUnDone != 0 ? numberDone * 100 / numberUnDone : 0; this.NumberReject = process.ProcessExecutions.Count(x => x.Status == 3); this.NumberExprire = process.ProcessExecutions.Count(x => x.Status == 4); var doneProcessExe = process.ProcessExecutions.Where(x => x.Status == 2); TotalTimeExecution = 0; if (doneProcessExe != null) { foreach (var doneProcess in doneProcessExe) { TotalTimeExecution += GetDiffDayMinute.Calculate(doneProcess.CreatedDate, doneProcess.CompletedDate); } } } if (process.ProcessSteps != null) { foreach (var step in process.ProcessSteps) { var stepStat = new StepStatistic(step); if (ListStep == null) { ListStep = new List <StepStatistic>(); } ListStep.Add(stepStat); } } }
public ReportStatistic(Process process) { this.ProcessId = process.ProcessId; this.ProcessName = process.ProcessName; this.Description = process.Description; this.CreatedBy = process.CreatedBy; if (process.ProcessExecutions != null) { this.NumberExecution = process.ProcessExecutions.Count; var numberDone = process.ProcessExecutions.Count(x => x.Status == 2); this.CompletionRate = this.NumberExecution != 0 ? numberDone * 100 / this.NumberExecution : 0; var doneProcessExe = process.ProcessExecutions.Where(x => x.Status == 2); TotalTimeExecution = 0; if (doneProcessExe != null) { foreach (var doneProcess in doneProcessExe) { TotalTimeExecution += GetDiffDayMinute.Calculate(doneProcess.CreatedDate, doneProcess.CompletedDate); } } } }