/// <summary> /// /// </summary> /// <param name="qrs"></param> public ComplexoQRS(QRS qrs) { this.Id = qrs.id; this.Vetor = Utils.StringToDouble(qrs.vetor); this.Diagnostico = Utils.StringToDouble(qrs.diag); }
/// <summary> /// /// </summary> /// <param name="ondaId"></param> public void Salvar(long ondaId) { DatabaseEntities entities = new DatabaseEntities(); ComplexoQRS qrs = this; QRS q; var query = from f in entities.QRS where f.id == qrs.Id select f; if (query.Count(t => t.id == qrs.Id) != 0) { q = query.FirstOrDefault<QRS>(); } else { q = new QRS(); entities.AddToQRS(q); } string vetor = ""; foreach (double d in qrs.Vetor) { vetor += d + ";"; } q.onda = ondaId; q.vetor = vetor; q.length = qrs.Length; q.diag = Utils.DoubleToString(qrs.Diagnostico); try { entities.SaveChanges(); Console.WriteLine("Complexo QRS inserido/atualizado com o id {0}", q.id); } catch (Exception ex) { Console.WriteLine(ex.Message); throw (ex); } }