public static BindingList<NameValuePairRow> GetRowsFromTable(Table table) { BindingList<NameValuePairRow> list = new BindingList<NameValuePairRow>(); for (int r = 0; r < table.GetNumRows(); r++) { NameValuePairRow nv = new NameValuePairRow(); nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name); nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value); nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp); nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp); list.Add(nv); } return list; }
public static void LoadNameValuePairDataGridView(DataGridView gridView, Table table) { BindingList <NameValuePairRow> nvList = NameValuePairRow.GetRowsFromTable(table); if (gridView.Columns.Count == 0) { gridView.AutoGenerateColumns = false; AddTextBoxColumn(gridView, NameValuePairRow.NameColumnName); AddTextBoxColumn(gridView, NameValuePairRow.ValueColumnName); AddTextBoxColumn(gridView, NameValuePairRow.NotesColumnName); AddTextBoxColumn(gridView, NameValuePairRow.NameDateStampColumnName); AddTextBoxColumn(gridView, NameValuePairRow.ValueDateStampColumnName); AddTextBoxColumn(gridView, NameValuePairRow.NotesDateStampColumnName); ApplyCommonDataGridViewSettings <NameValuePairRow>(gridView, true); HideDateStampColumns(gridView); } gridView.DataSource = nvList; }
public static BindingList <NameValuePairRow> GetRowsFromTable(Table table) { BindingList <NameValuePairRow> list = new BindingList <NameValuePairRow>(); Boolean newStartStep = false; //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014 if (table.GetNumColumns() >= 5) { newStartStep = true; } if (newStartStep) { for (int r = 0; r < table.GetNumRows(); r++) { NameValuePairRow nv = new NameValuePairRow(); nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name); nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value); nv.Notes = table.GetData(r, (int)TableColumns.NameValuePairs.Notes); nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp); nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp); nv.NotesDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp); list.Add(nv); } } else { for (int r = 0; r < table.GetNumRows(); r++) { NameValuePairRow nv = new NameValuePairRow(); nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name); nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value); nv.Notes = ""; nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp); nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp); nv.NotesDateStamp = ""; list.Add(nv); } } return(list); }
public static BindingList<NameValuePairRow> GetRowsFromTable(Table table) { BindingList<NameValuePairRow> list = new BindingList<NameValuePairRow>(); Boolean newStartStep = false; //Version 1.6.1.13+ uses a new set of fields for init data NV pairs - Notes column was added JDK 08-25-2014 if (table.GetNumColumns() >= 5) { newStartStep = true; } if (newStartStep) { for (int r = 0; r < table.GetNumRows(); r++) { NameValuePairRow nv = new NameValuePairRow(); nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name); nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value); nv.Notes = table.GetData(r, (int)TableColumns.NameValuePairs.Notes); nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp); nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp); nv.NotesDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NotesDateStamp); list.Add(nv); } } else { for (int r = 0; r < table.GetNumRows(); r++) { NameValuePairRow nv = new NameValuePairRow(); nv.Name = table.GetData(r, (int)TableColumns.NameValuePairs.Name); nv.Value = table.GetData(r, (int)TableColumns.NameValuePairs.Value); nv.Notes = ""; nv.NameDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.NameDateStamp); nv.ValueDateStamp = table.GetData(r, (int)TableColumns.NameValuePairs.ValueDateStamp); nv.NotesDateStamp = ""; list.Add(nv); } } return list; }
internal static Table UnloadNameValuePairDataGridView(DataGridView gridView) { BindingList <NameValuePairRow> list = gridView.DataSource as BindingList <NameValuePairRow>; return(NameValuePairRow.GetTableFromRows(list)); }