public static void LoadMaxHandlingGridView(DataGridView gridView, Table table) { BindingList <MaxHandlingRow> mhList = MaxHandlingRow.GetRowsFromTable(table); if (gridView.Columns.Count == 0) { gridView.AutoGenerateColumns = false; AddTextBoxColumn(gridView, MaxHandlingRow.ConditionColumnName); AddTextBoxColumn(gridView, MaxHandlingRow.CountColumnName); AddTextBoxColumn(gridView, MaxHandlingRow.ActionColumnName); AddItemComboBoxColumn(gridView, MaxHandlingRow.GotoColumnName); AddTextBoxColumn(gridView, MaxHandlingRow.CountDateStampColumnName); AddTextBoxColumn(gridView, MaxHandlingRow.ActionDateStampColumnName); AddTextBoxColumn(gridView, MaxHandlingRow.GotoDateStampColumnName); ApplyCommonDataGridViewSettings <MaxHandlingRow>(gridView, false); HideDateStampColumns(gridView); gridView.Columns[MaxHandlingRow.ConditionColumnName].ReadOnly = true; } // loaded each time to get an updated list of gotos LoadItemComboBoxColumn(gridView, MaxHandlingRow.GotoColumnName, GetAllPossibleGotos()); gridView.DataSource = mhList; }
public static BindingList<MaxHandlingRow> GetRowsFromTable(Table table) { BindingList<MaxHandlingRow> list = new BindingList<MaxHandlingRow>(); for (int row = 0; row < table.GetNumRows(); row++) { MaxHandlingRow mh = new MaxHandlingRow(); mh.Condition = table.GetData(row, (int)TableColumns.MaxHandling.Condition); mh.Count = table.GetData(row, (int)TableColumns.MaxHandling.Count); mh.Action = table.GetData(row, (int)TableColumns.MaxHandling.Action); mh.Goto = table.GetData(row, (int)TableColumns.MaxHandling.Goto); mh.CountDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.CountDateStamp); mh.ActionDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.ActionDateStamp); mh.GotoDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.GotoDateStamp); list.Add(mh); } return list; }
public static BindingList <MaxHandlingRow> GetRowsFromTable(Table table) { BindingList <MaxHandlingRow> list = new BindingList <MaxHandlingRow>(); for (int row = 0; row < table.GetNumRows(); row++) { MaxHandlingRow mh = new MaxHandlingRow(); mh.Condition = table.GetData(row, (int)TableColumns.MaxHandling.Condition); mh.Count = table.GetData(row, (int)TableColumns.MaxHandling.Count); mh.Action = table.GetData(row, (int)TableColumns.MaxHandling.Action); mh.Goto = table.GetData(row, (int)TableColumns.MaxHandling.Goto); mh.CountDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.CountDateStamp); mh.ActionDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.ActionDateStamp); mh.GotoDateStamp = table.GetData(row, (int)TableColumns.MaxHandling.GotoDateStamp); list.Add(mh); } return(list); }
internal static Table UnloadMaxHandlingGridView(DataGridView gridView) { BindingList <MaxHandlingRow> list = gridView.DataSource as BindingList <MaxHandlingRow>; return(MaxHandlingRow.GetTableFromRows(list)); }