private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (this.tabControl1.SelectedIndex == 0) { dt = BorrowAdmin.GetBorrow(user.ID); dataGridView1.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dataGridView1.Columns[dc.ColumnName].HeaderText = Borrow.ColumnTitle(dc.ColumnName); } } else if (this.tabControl1.SelectedIndex == 1) { BookCatalogUpdate(treeView1); } else if (this.tabControl1.SelectedIndex == 3) { BookTypeUpdate(); BookCatalogUpdate(treeView2); Clear_4(); Clear_44(); } else if (this.tabControl1.SelectedIndex == 4) { dt = UserAdmin.GetUser(); dataGridView2.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dataGridView2.Columns[dc.ColumnName].HeaderText = User.ColumnTitle(dc.ColumnName); } } }
private void tabControl2_SelectedIndexChanged(object sender, EventArgs e) { if (this.tabControl2.SelectedIndex == 0) { dt = UserAdmin.GetUser(); dataGridView2.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dataGridView2.Columns[dc.ColumnName].HeaderText = User.ColumnTitle(dc.ColumnName); } } else if (this.tabControl2.SelectedIndex == 1) { dt = BookAdmin.GetBook(); dataGridView3.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dataGridView3.Columns[dc.ColumnName].HeaderText = Book.ColumnTitle(dc.ColumnName); } } else if (this.tabControl2.SelectedIndex == 2) { dt = BorrowAdmin.GetBorrow(); dataGridView4.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dataGridView4.Columns[dc.ColumnName].HeaderText = Borrow.ColumnTitle(dc.ColumnName); } } }
//显示dgvBorrow数据 private void ShowBorrowData() { dgvBorrow.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dgvBorrow.Columns[dc.ColumnName].HeaderText = Borrow.ColumnTitle(dc.ColumnName); } }
public void InitMenu() { #region 分配权限 if (!user.IsAdmin()) { tabPage3.Parent = null; tabPage4.Parent = null; tabPage5.Parent = null; } else { tabPage3.Parent = this.tabControl1; tabPage4.Parent = this.tabControl1; tabPage5.Parent = this.tabControl1; } #endregion #region 获取读者信息 lab1_1.Text = user.ID.ToString(); lab1_2.Text = user.Name; lab1_3.Text = user.Sex; lab1_4.Text = user.CertType; lab1_5.Text = user.Cert; lab1_6.Text = user.Phone; #endregion #region 初始化界面 tabControl1.SelectedIndex = 0; dt = BorrowAdmin.GetBorrow(user.ID); dataGridView1.DataSource = dt; foreach (DataColumn dc in dt.Columns) { dataGridView1.Columns[dc.ColumnName].HeaderText = Borrow.ColumnTitle(dc.ColumnName); } #endregion }