public void ConvertSignalComments() { List <Models.MetricComment> comments = new List <Models.MetricComment>(); foreach (var row in CommentsTable) { if (row.EntityType == 1) { Models.MetricComment comment = new Models.MetricComment(); if (comment.MetricTypeIDs == null) { comment.MetricTypeIDs = new List <int>(); } comment.CommentText = row.Comment; comment.SignalID = row.Entity; comment.MetricTypeIDs.Add(1); comment.MetricTypeIDs.Add(2); comment.TimeStamp = row.TimeStamp; comments.Add(comment); } } db.MetricComments.AddRange(comments); }
public void ConvertSignalComments() { Console.WriteLine("Starting Signal Comment converison."); List <Models.MetricComment> comments = new List <Models.MetricComment>(); foreach (var row in CommentsTable) { if (row.EntityType == 1) { Models.MetricComment comment = new Models.MetricComment(); if (comment.MetricTypeIDs == null) { comment.MetricTypeIDs = new List <int>(); } comment.CommentText = row.Comment; comment.SignalID = row.Entity; comment.MetricTypeIDs.Add(1); comment.MetricTypeIDs.Add(2); comment.TimeStamp = row.TimeStamp; comments.Add(comment); } } db.MetricComments.AddRange(comments); Console.WriteLine("Saving signal comments"); db.SaveChanges(); }
public List <Models.MetricType> GetMetricTypesByMetricComment(Models.MetricComment metricComment) { var metricTypes = (from r in db.MetricTypes where metricComment.MetricTypeIDs.Contains(r.MetricID) select r).ToList(); return(metricTypes); }