public static DataGridViewFilterTypeColumn GetFilterTypeColumn(string columnName) { DataGridViewFilterTypeColumn column = null; if (columnName != null && columnName != string.Empty) { // add in DB SpendFilterType filterType = new SpendFilterType(columnName); DBManager.CreateOrUpdateItem(filterType); DBManager.SpendFilters.Add(filterType, new List <SpendFilter>()); column = GetFilterTypeColumn(filterType); } return(column); }
private static void UpdateSpendFiltersTable(DataGridView SFG) { UpdatingSFG = true; SFG.Rows.Clear(); SFG.Columns.Clear(); foreach (var filter in DBManager.SpendFilters) { var column = new DataGridViewFilterTypeColumn(filter.Key); SFG.Columns.Add(column); int iRow = filter.Value.Count - SFG.Rows.Count + 1; if (iRow > 0) { SFG.Rows.Add(iRow); } for (iRow = 0; iRow < filter.Value.Count; iRow++) { var row = SFG.Rows[iRow]; var cell = row.Cells[column.Name]; cell.Value = filter.Value[iRow]; } } UpdatingSFG = false; }