private TimeSpan getBenchmarkTimeSpan(string benchmarkName) { TimingData benchmark = (from TimingData b in TimingData where b.Name == benchmarkName select b).FirstOrDefault(); if (benchmark == default(TimingData)) { return(TimeSpan.Zero); } TimeSpan output; if (!benchmark.Data.ContainsKey("TimeSpan") || !(benchmark.Data["TimeSpan"] is TimeSpan)) { if (TimeSpan.TryParse(benchmark.Data["TimeSpan"] as string, out output)) { return(output); } if (benchmark.Value == 0.0) { return(TimeSpan.Zero); } else { int valueAsMilliseconds = (int)benchmark.Value * 60 * 1000; output = new TimeSpan(0, 0, 0, 0, valueAsMilliseconds); return(output); } } return((TimeSpan)benchmark.Data["TimeSpan"]); }
public TimingData GetTimingDataByName(string name) { TimingData output = (from TimingData t in TimingData where t.Name == name select t).FirstOrDefault(); return(output); }
private void setBenchmarkTimeSpan(string benchmarkName, TimeSpan timeSpan) { TimingData benchmark = (from TimingData b in TimingData where b.Name == benchmarkName select b).FirstOrDefault(); if (benchmark == default(TimingData)) { benchmark = new TimingData(benchmarkName); } benchmark.Value = timeSpan.TotalMinutes; benchmark.Data["TimeSpan"] = timeSpan; }
private void setBenchmarkDateTime(string benchmarkName, DateTime time) { TimingData benchmark = (from TimingData b in TimingData where b.Name == benchmarkName select b).FirstOrDefault(); if (benchmark == default(TimingData)) { benchmark = new TimingData(benchmarkName); } FireEMSIncident incident = Parent as FireEMSIncident; if (incident != null) { if (incident.Time != DateTime.MinValue) { TimeSpan timeSpan = time - incident.Time; benchmark.Value = timeSpan.TotalMinutes; } } benchmark.Data["DateTime"] = time; }
private DateTime getBenchmarkDateTime(string benchmarkName) { TimingData benchmark = (from TimingData b in TimingData where b.Name == benchmarkName select b).FirstOrDefault(); if (benchmark == default(TimingData)) { return(DateTime.MinValue); } if (!benchmark.Data.ContainsKey("DateTime")) { FireEMSIncident parent = Parent as FireEMSIncident; if (parent != null && parent.Time != DateTime.MinValue && benchmark.Value != Double.NaN) { return(parent.Time.AddMinutes(benchmark.Value)); } } if (benchmark.Data["DateTime"] is DateTime) { return((DateTime)benchmark.Data["DateTime"]); } else { DateTime output; if (DateTime.TryParse(benchmark.Data["DateTime"] as string, out output)) { return(output); } } return(DateTime.MinValue); }