private void UpdateTableView() { updater.UpdateCurrentGroupNo(currGroup); UpdateGroupCaptions(); Scrolling = true; tsbPrevGroup.Enabled = true; tsbNextGroup.Enabled = true; }
public frmTables(Form host, Form panelhost, string table, int curgroup) { string grdesc; InitializeComponent(); currGroup = curgroup; viewTable = table; DataHost = host; PanelHost = panelhost; updater = panelhost as IUpdatePanel; bool anyGroupExists = false; int j = 1; int n = 20; int GroupsCount = Properties.Settings.Default.TableGroupsCount; using (ServerSQL mySQL = new ServerSQL(DatabaseFrom.Database, false)) // чтение удалённо { if (mySQL.Connected) { for (int i = 1; i <= GroupsCount / n; i++) { ToolStripDropDownItem item = (ToolStripDropDownItem)tsbGroupSelect.DropDownItems.Add( String.Format("Группы с {0} по {1}", j, j + n - 1)); for (int k = j; k < j + n; k++) { if (!Data.GroupIsEmpty(k, mySQL, ParamGroup.Table)) { grdesc = Data.GetGroupDesc(k, mySQL, ParamGroup.Table); ToolStripItem groupItem = item.DropDownItems.Add( String.Format("Группа {0}{1}", k, String.IsNullOrWhiteSpace(grdesc) ? String.Empty : " - " + grdesc), null, miGroup_Click); groupItem.ImageIndex = k; anyGroupExists = true; } } j += n; } tsbNextGroup.Enabled = anyGroupExists; for (int i = 1; i <= Data.PlaceCount(ParamGroup.Table); i++) { ColumnHeader header = new ColumnHeader(); headers.Add(header); header.TextAlign = HorizontalAlignment.Right; header.Width = 80; header.Text = String.Empty; lvTableView.Columns.Add(header); } grdesc = Data.GetGroupDesc(currGroup, mySQL, ParamGroup.Table); lbGroupCaption.Text = String.Format("Группа {0} {1}", currGroup, String.IsNullOrWhiteSpace(grdesc) ? "(без названия)" : " - " + grdesc); } } if (!Data.GroupIsEmpty(currGroup, ParamGroup.Table)) { updater.UpdateCurrentGroupNo(currGroup); UpdateGroupCaptions(); } tsbPrevGroup.Enabled = currGroup > 1; }