private List <DomainKnowledge> GetDomainKnowledge(bool saveIncompleteRows = true) { List <int> incompleteRowIdx = new List <int>(); List <DomainKnowledge> listDk = new List <DomainKnowledge>(); foreach (DataGridViewRow row in dataGridViewEvents.Rows) { if (row.Index != dataGridViewEvents.NewRowIndex) { if ((saveIncompleteRows) || (bool.Parse(row.Cells[5].Value.ToString()))) { string ev_id = null; if (row.Cells[0].Value != DBNull.Value) { ev_id = (string)row.Cells[0].Value; } string ev_label = null; if (row.Cells[1].Value != DBNull.Value) { ev_label = (string)row.Cells[1].Value; } Event ev = new Event(ev_id, ev_label); RegulatoryRule rr = null; if (row.Cells[2].Value != DBNull.Value) { rr = new RegulatoryRule((string)row.Cells[2].Value); } if (row.Cells[3].Value is byte[]) { row.Cells[3].Value = ByteArrayToImage((byte[])row.Cells[3].Value); } Screenshot ss = null; if (row.Cells[3].Value != DBNull.Value) { ss = new Screenshot((Bitmap)row.Cells[3].Value); } SqlScript sql = null; if (row.Cells[4].Value != DBNull.Value) { sql = new SqlScript((string)row.Cells[4].Value); } listDk.Add(new DomainKnowledge(ss, rr, sql, ev)); } else { incompleteRowIdx.Add(row.Index); } } } return(listDk); }
public void AddDomainKownledge(Screenshot scr, RegulatoryRule rr, SqlScript sql, Event e) { eventInDk[e] = true; domainKnowldges.Add(new DomainKnowledge(scr, rr, sql, e)); }