public History Save() { var db = new DataProcess(); if (Id == null) { Id = db.saveHistory(this); foreach (var sig in Signals) { sig.Delta = 0; var interval = sig.Timestamp - Signals[0].Timestamp; var delta = (int)interval.TotalMilliseconds; // Ignore time less tham 1ms. sig.Delta = delta; sig.History = this; sig.Save(); } } else { db.updateHistory(this); } return(this); }
public History Save() { var db = new DataProcess(); if (Id == null) { Id = db.saveHistory(this); foreach (var sig in Signals) { sig.Delta = 0; var interval = sig.Timestamp - Signals[0].Timestamp; var delta = (int)interval.TotalMilliseconds; // Ignore time less tham 1ms. sig.Delta = delta; sig.History = this; sig.Save(); } } else { db.updateHistory(this); } return this; }