internal static void LoadChangeLogDataGridView(DataGridView gridView, Table table) { BindingList <ChangeLogRow> clList = ChangeLogRow.GetRowsFromTable(table); if (gridView.Columns.Count == 0) { gridView.AutoGenerateColumns = false; AddTextBoxColumn(gridView, ChangeLogRow.DateColumnName); AddTextBoxColumn(gridView, ChangeLogRow.VersionColumnName); AddTextBoxColumn(gridView, ChangeLogRow.DetailsColumnName); AddTextBoxColumn(gridView, ChangeLogRow.AuthorColumnName); AddStringComboBoxColumn(gridView, ChangeLogRow.HighlightColumnName); gridView.DefaultValuesNeeded -= new DataGridViewRowEventHandler(OnChangeLogDefaultValuesNeeded); gridView.DefaultValuesNeeded += new DataGridViewRowEventHandler(OnChangeLogDefaultValuesNeeded); gridView.CellValidating -= new DataGridViewCellValidatingEventHandler(OnChangeLogCellValidating); gridView.CellValidating += new DataGridViewCellValidatingEventHandler(OnChangeLogCellValidating); gridView.CellEndEdit -= new DataGridViewCellEventHandler(OnChangeLogCellEndEdit); gridView.CellEndEdit += new DataGridViewCellEventHandler(OnChangeLogCellEndEdit); LoadComboBoxColumn(gridView, ChangeLogRow.HighlightColumnName, highlightValues); ApplyCommonDataGridViewSettings <ChangeLogRow>(gridView, true); } gridView.DataSource = clList; }
public static BindingList<ChangeLogRow> GetRowsFromTable(Table table) { BindingList<ChangeLogRow> list = new BindingList<ChangeLogRow>(); for (int row = 0; row < table.GetNumRows(); row++) { ChangeLogRow cl = new ChangeLogRow(); cl.Date = table.GetData(row, (int)TableColumns.ChangeLog.Date); cl.Version = table.GetData(row, (int)TableColumns.ChangeLog.Version); cl.Details = table.GetData(row, (int)TableColumns.ChangeLog.Details); cl.Author = table.GetData(row, (int)TableColumns.ChangeLog.Author); cl.Highlight = table.GetData(row, (int)TableColumns.ChangeLog.Highlight); list.Add(cl); } return list; }
public static BindingList <ChangeLogRow> GetRowsFromTable(Table table) { BindingList <ChangeLogRow> list = new BindingList <ChangeLogRow>(); for (int row = 0; row < table.GetNumRows(); row++) { ChangeLogRow cl = new ChangeLogRow(); cl.Date = table.GetData(row, (int)TableColumns.ChangeLog.Date); cl.Version = table.GetData(row, (int)TableColumns.ChangeLog.Version); cl.Details = table.GetData(row, (int)TableColumns.ChangeLog.Details); cl.Author = table.GetData(row, (int)TableColumns.ChangeLog.Author); cl.Highlight = table.GetData(row, (int)TableColumns.ChangeLog.Highlight); list.Add(cl); } return(list); }
internal static Table UnloadChangeLogDataGridView(DataGridView gridView) { BindingList <ChangeLogRow> list = gridView.DataSource as BindingList <ChangeLogRow>; return(ChangeLogRow.GetTableFromRows(list)); }