ImportStatistics
using kCura.EDDS.WebAPI.BulkImportManagerBase;
using Monitoring;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace kCura.WinEDDS
{
public class ImportStatistics : Statistics
{
public const string DocsCreatedKey = "DocsCreated";
public const string DocsUpdatedKey = "DocsUpdated";
public const string FilesProcessedKey = "MassImportFilesProcessed";
public const string ImportObjectTypeKey = "ImportObjectType";
[CompilerGenerated]
private int _DocumentsCreated;
[CompilerGenerated]
private int _DocumentsUpdated;
[CompilerGenerated]
private int _FilesProcessed;
[CompilerGenerated]
private TelemetryConstants.ImportObjectType _ImportObjectType;
public int DocumentsCreated { get; set; }
public int DocumentsUpdated { get; set; }
public int FilesProcessed { get; set; }
public TelemetryConstants.ImportObjectType ImportObjectType { get; set; }
public ImportStatistics()
{
DocumentsCreated = 0;
DocumentsUpdated = 0;
FilesProcessed = 0;
ImportObjectType = TelemetryConstants.ImportObjectType.NotApplicable;
}
public void ProcessMassImportResults(MassImportResults results)
{
checked {
DocumentsCreated += results.ArtifactsCreated;
DocumentsUpdated += results.ArtifactsUpdated;
FilesProcessed += results.FilesProcessed;
}
}
public override IDictionary<string, object> ToDictionaryForLogs()
{
IDictionary<string, object> dictionary = base.ToDictionaryForLogs();
dictionary.Add("DocsCreated", DocumentsCreated);
dictionary.Add("DocsUpdated", DocumentsUpdated);
dictionary.Add("MassImportFilesProcessed", FilesProcessed);
dictionary.Add("ImportObjectType", ImportObjectType);
IDictionaryEnumerator enumerator = ToDictionaryForProgress().GetEnumerator();
while (enumerator.MoveNext()) {
object current = enumerator.Current;
DictionaryEntry dictionaryEntry = (current != null) ? ((DictionaryEntry)current) : default(DictionaryEntry);
dictionary.Add(dictionaryEntry.Key.ToString(), RuntimeHelpers.GetObjectValue(dictionaryEntry.Value));
}
return dictionary;
}
public override double GetSqlProcessRate()
{
TimeSpan massImportDuration = base.MassImportDuration;
if (massImportDuration.Ticks <= 0)
return 0;
double num = (double)checked(DocumentsCreated + DocumentsUpdated + base.DocsErrorsCount);
massImportDuration = base.MassImportDuration;
return Convert.ToDouble(num / massImportDuration.TotalSeconds);
}
}
}