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); }