private void BookInfoManager_UI_Load(object sender, EventArgs e) { #region DataGridView1绑定 // 需要添加列的列标题字符串 string arraysHeaderText = @"图书编号,图书名称,登记时间,图书类型,作者,拼音码,翻译,语言,页数,价格,印刷版面,存放位置,ISBN码,版本,描述"; // 需要绑定数据库列名称的字符串 string arraysName = @"BookId,BookName,TimeIn,BookTypeName,Author,PinYinCode,Translator,Language,BookNumber,Price,Layout,Address,ISBS,Versions,BookRemark"; // 自动生成columns autocoumns.AutoColumn(arraysHeaderText, arraysName, dataGridView1); dataGridView1.DataSource = bookInfo_bll.selectBookInfo1().Tables[0]; autocoumns.AddColumn("修改", dataGridView1); autocoumns.AddColumn("删除", dataGridView1); // DataGridView1数据集绑定 this.dataGridView1.DataSource = bookInfo_bll.selectBookInfo1().Tables[0]; // 窗体加载时默认隐藏的列 this.dataGridView1.Columns[14].Visible = false; this.dataGridView1.Columns[13].Visible = false; this.dataGridView1.Columns[12].Visible = false; this.dataGridView1.Columns[11].Visible = false; this.dataGridView1.Columns[10].Visible = false; this.dataGridView1.Columns[6].Visible = false; this.dataGridView1.Columns[5].Visible = false; #endregion #region 拉框绑定 DataGridViewColumnCollection columns = dataGridView1.Columns; for (int i = 0; i < columns.Count - 2; i++) { comboBox1.Items.Add(columns[i].HeaderText); } comboBox1.Items.Insert(0, "全部"); comboBox1.SelectedIndex = 0; #endregion #region 树状图的绑定 TreeViewBand(); #endregion #region DgvHostory绑定 string Header1 = @"图书编号,图书名称,读者编号,读者名称,借出时间,书应归还时间,实际归还时间,应付罚金,续借次数,借还描述"; string PropertyNames1 = @"BookId,BookName,ReaderId,ReaderName,BorrowTime,ReturnTime,FactReturnTime,Fine,RenewCount,BorrowRemark"; // 自动生成columns autocoumns.AutoColumn(Header1, PropertyNames1, dgvHostory); #endregion }
private void Info_UI_Load(object sender, EventArgs e) { if (txtName.Equals("读者信息")) { this.Text = "读者信息类表"; //需要添加列的列标题字符串 string arraysHeaderText = @"读者编号,读者名称,登记时间,有效时间,图书类型,所在院系,所在班级,身份证号,性别"; //需要绑定数据库列名称的字符串 string arraysName = @"ReaderId,ReaderName,TimeIn,TimeOut,ReaderTypeName,DepartmentName,ClassName,IdentityCard,Gender"; //自动生成columns com.AutoColumn(arraysHeaderText, arraysName, dgvInfo); for (int i = 0; i < dgvInfo.Columns.Count; i++) { if (i > 5) { dgvInfo.Columns[i].Visible = false; } } dgvInfo.DataSource = reader_bll.selectReader().Tables[0]; dgvInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } else if (txtName == "图书信息") { this.Text = "图书信系列表"; //需要添加列的列标题字符串 string arraysHeaderText = @"图书编号,图书名称,登记时间,图书类型,作者,页数,价格,ISBS码"; //需要绑定数据库列名称的字符串 string arraysName = @"BookId,BookName,TimeIn,BookTypeName,Author,BookNumber,Price,ISBS"; //自动生成columns com.AutoColumn(arraysHeaderText, arraysName, dgvInfo); for (int i = 0; i < dgvInfo.Columns.Count; i++) { if (i > 5) { dgvInfo.Columns[i].Visible = false; } } if (BorrowHostory != null) { dgvInfo.DataSource = bookInfo_bll.selectBookInfo1().Tables[0]; } else if (borrowManager != null) { dgvInfo.DataSource = bookInfo_bll.selectBookInfo2("").Tables[0]; } dgvInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } com.AddColumn("选取", dgvInfo); }
private void Info_UI_Load(object sender, EventArgs e) { if (txtName.Equals("读者信息")) { this.Text = "读者信息类表"; // 需要添加列的列标题字符串 string arraysHeaderText = @"读者编号,读者名称,登记时间,有效时间,图书类型,所在院系,所在班级,省份证号,性别,电话,手机,Email,联系地址,描述信息"; // 需要绑定数据库列名称的字符串 string arraysName = @"ReaderId,ReaderName,TimeIn,TimeOut,ReaderTypeName,DepartmentName,ClassName,IdentityCard,Gender,Special,Phone,Email,Address,ReaderRemark"; // 自动生成columns com.AutoColumn(arraysHeaderText, arraysName, dgvInfo); for (int i = 0; i < dgvInfo.Columns.Count; i++) { if (i > 5) { dgvInfo.Columns[i].Visible = false; } } dgvInfo.DataSource = reader_bll.selectReader().Tables[0]; dgvInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } else if (txtName == "图书信息") { this.Text = "图书信系列表"; // 需要添加列的列标题字符串 string arraysHeaderText = @"图书编号,图书名称,登记时间,图书类型,作者,拼音码,翻译,语言,页数,价格,印刷版面,存放位置,ISBS码,版本,描述"; // 需要绑定数据库列名称的字符串 string arraysName = @"BookId,BookName,TimeIn,BookTypeName,Author,PinYinCode,Translator,Language,BookNumber,Price,Layout,Address,ISBS,Versions,BookRemark"; // 自动生成columns com.AutoColumn(arraysHeaderText, arraysName, dgvInfo); for (int i = 0; i < dgvInfo.Columns.Count; i++) { if (i > 5) { dgvInfo.Columns[i].Visible = false; } } if (BorrowHostory != null) { dgvInfo.DataSource = bookInfo_bll.selectBookInfo1().Tables[0]; } else if (borrowManager != null) { dgvInfo.DataSource = bookInfo_bll.selectBookInfo2("").Tables[0]; } dgvInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; } com.AddColumn("选取", dgvInfo); }
//人员管理窗体的加载事件 public void UserInfoManager_UI_Load(object sender, EventArgs e) { ShowLayout_dgv_UserInfo(); ShowData_dgv_PersonInfo(); #region 拉框绑定 DataGridViewColumnCollection columns = dgv_UserInfo.Columns; for (int i = 0; i < columns.Count - 2; i++) { comboBox1.Items.Add(columns[i].HeaderText); } comboBox1.Items.Insert(0, "全部"); comboBox1.SelectedIndex = 0; #endregion //树状图的绑定 //TreeViewBand(); #region DataGridView3的绑定 已借阅的图书信息表 //dataGridView3.AutoGenerateColumns = false; //需要添加列的列标题字符串 string arraysHeaderText1 = @"读者编号,读者名称,图书编号,图书名称,借出时间,书应归还时间,实际归还时间,应付罚金,续借次数,借还描述"; //需要绑定数据库列名称的字符串 string arraysName1 = @"ReaderId,ReaderName,BookId,BookName,BorrowTime,ReturnTime,FactReturnTime,Fine,RenewCount,BorrowRemark"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText1, arraysName1, dgvReaderBorrowBook); //string index = dgvHeaderInfo.Rows[0].Cells[0].Value.ToString(); //DataGridView1数据集绑定 //this.dgvReaderBorrowBook.DataSource = borrowReturn_bll.ReaderBorrowReturn(index).Tables[0]; #endregion }
private void BorrowHostory_UI_Load(object sender, EventArgs e) { cboBorrowTimeType.SelectedIndex = 0; #region dgvHostory列表生成 string ColumnHeaderText = "图书编号,读者编号,图书名称,读者名称,图书类型,读者类型,读者性别,身份证号,借阅时间,应还时间,实际还书时间,罚金,续借次数"; string ColumnHeaderName = @"BookId,ReaderId,BookName,ReaderName,BookTypeName,ReaderTypeName,Gender,IdentityCard,BorrowTime,ReturnTime,FactReturnTime,Fine,RenewCount"; com.AutoColumn(ColumnHeaderText, ColumnHeaderName, dgvHostory); dgvHostory.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvHostory.DataSource = borrowReturn_bll.AllBorrowReturn().Tables[0]; #endregion }
/// <summary> /// 设置dgv的显示格式 /// </summary> private void ShowLayout_dGV_PersonType() { string headerText = "Guid,人员类型"; string dataPropertyNames = "ReaderTypeId,ReaderTypeName"; dgv_PersonType.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(headerText, dataPropertyNames, dgv_PersonType); auto.AddColumn("修改", dgv_PersonType); auto.AddColumn("删除", dgv_PersonType); }
/// <summary> /// 显示dgv格式 /// </summary> private void ShowLayout_dGV_Room() { string HeaderText = "Guid,房间"; string DataPropertyNames = "RoomID,RoomName"; dGV_Room.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText, DataPropertyNames, dGV_Room); auto.AddColumn("修改", dGV_Room); auto.AddColumn("删除", dGV_Room); dGV_Room.Columns[0].Visible = false; }
/// <summary> /// 显示dgv格式 /// </summary> private void ShowLayout_dGV_EquipType() { string HeaderText = "Guid,配属装备类型"; string DataPropertyNames = "EquipTypeID,EquipTypeName"; dGV_EquipType.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText, DataPropertyNames, dGV_EquipType); auto.AddColumn("修改", dGV_EquipType); auto.AddColumn("删除", dGV_EquipType); dGV_EquipType.Columns[0].Visible = false; }
/// <summary> /// 显示dgv格式 /// </summary> private void ShowLayout_dgv_BookType() { string HeaderText = "Guid,类型名称"; string DataPropertyNames = "BookTypeGuid,BookTypeName"; dgv_BookType.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText, DataPropertyNames, dgv_BookType); auto.AddColumn("修改", dgv_BookType); auto.AddColumn("删除", dgv_BookType); dgv_BookType.Columns[0].Visible = false; }
/// <summary> /// 初始化dgv_BookInfo显示格式 /// </summary> public void ShowLayout_dgv_BookInfo() { //这两处不能放回车,否则不显示 //需要添加列的列标题字符串 string dgv_MatInfoHeaderText = @"Guid,ISBN,图书原名,图书中文名,图书作者,出版社,出版日期,数量,购买日期,购买人,购买商店,图书类型,图书语言,描述"; //需要绑定数据库列名称的字符串 string dgv_MatInfoName = @"BookGuid,BookISBN,BookRawName,BookCNName,BookAuthor,BookPress,BookPubDate,BookNumber,BookBuyDate,BookBuyPerson,BookBuyShop,BookTypeName,BookLanType,BookAnnotation"; //自动生成columns,包括删除、修改和查看 autocolumns.AutoColumn(dgv_MatInfoHeaderText, dgv_MatInfoName, dgv_BookInfo); autocolumns.AddColumn("修改", dgv_BookInfo); autocolumns.AddColumn("删除", dgv_BookInfo); autocolumns.AddColumn("查看", dgv_BookInfo); //隐藏guid列 dgv_BookInfo.Columns[0].Visible = false; //窗体加载时默认隐藏的列 int columnCount = dgv_BookInfo.Columns.Count; for (int i = columnCount - 6; i < columnCount - 3; ++i) { dgv_BookInfo.Columns[i].Visible = false; } }
//加载 private void BorrowManager_UI_Load(object sender, EventArgs e) { #region dgvReaderInfo自动生成列 //需要添加列的列标题字符串 string arraysHeaderText = @"读者编号,读者名称,登记时间,有效时间,图书类型,所在院系,所在班级,省份证号,性别,电话,手机,Email,联系地址,描述信息"; //需要绑定数据库列名称的字符串 string arraysName = @"ReaderId,ReaderName,TimeIn,TimeOut,ReaderTypeName,DepartmentName,ClassName,IdentityCard,Gender,Special,Phone,Email,Address,ReaderRemark"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText, arraysName, dgvReaderInfo); //DataGridView1数据集绑定 //this.dgvReaderInfo.DataSource = reader_bll.selectReader().Tables[0]; this.dgvReaderInfo.Columns[13].Visible = false; this.dgvReaderInfo.Columns[12].Visible = false; this.dgvReaderInfo.Columns[11].Visible = false; dgvReaderInfo.DataSource = null; #endregion #region dgvBorrow表的自动生成列 //dataGridView3.AutoGenerateColumns = false; //需要添加列的列标题字符串 string arraysHeaderText1 = @"借还ID,读者编号,读者名称,图书编号,图书名称,借出时间,书应归还时间,实际归还时间,应付罚金,续借次数,借还描述"; //需要绑定数据库列名称的字符串 string arraysName1 = @"BorrowId,ReaderId,ReaderName,BookId,BookName,BorrowTime,ReturnTime,FactReturnTime,Fine,RenewCount,BorrowRemark"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText1, arraysName1, dgvBorrowed); autocoumns.AddColumn("续借", dgvBorrowed); autocoumns.AddColumn("还书", dgvBorrowed); //dgvBorrowed.Columns[2].Frozen = true; //dgvBorrowed.Columns[1].Frozen = true; //自动铺满的列宽 dgvBorrowed.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvBorrowed.Columns[0].Visible = false; dgvBorrowed.Columns[1].Visible = false; dgvBorrowed.Columns[2].Visible = false; dgvBorrowed.Columns[7].Visible = false; dgvBorrowed.Columns[dgvBorrowed.Columns.Count - 3].Visible = false; dgvBorrowed.DataSource = null; #endregion #region dgvBookInfo的自动生成列 //需要添加列的列标题字符串 string arraysHeaderText2 = @"图书编号,图书名称,登记时间,图书类型,作者,拼音码,翻译,语言,页数,价格,印刷版面,存放位置,ISBS码,版本,描述"; //需要绑定数据库列名称的字符串 string arraysName2 = @"BookId,BookName,TimeIn,BookTypeName,Author,PinYinCode,Translator,Language,BookNumber,Price,Layout,Address,ISBS,Versions,BookRemark"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText2, arraysName2, dgvBookInfo); autocoumns.AddColumn("借书", dgvBookInfo); dgvBookInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvBookInfo.DataSource = null; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 2].Visible = false; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 3].Visible = false; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 4].Visible = false; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 5].Visible = false; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 6].Visible = false; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 7].Visible = false; dgvBookInfo.Columns[dgvBookInfo.Columns.Count - 8].Visible = false; #endregion }
//读者管理窗体的加载事件 private void ReaderManager_UI_Load(object sender, EventArgs e) { //需要添加列的列标题字符串 string arraysHeaderText = @"读者编号,读者名称,登记时间,有效时间,读者类型,所在院系,所在班级,身份证号,性别"; //需要绑定数据库列名称的字符串 string arraysName = @"ReaderId,ReaderName,TimeIn,TimeOut,ReaderTypeName,DepartmentName,ClassName,IdentityCard,Gender"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText, arraysName, dgvHeaderInfo); autocoumns.AddColumn("修改", dgvHeaderInfo); autocoumns.AddColumn("删除", dgvHeaderInfo); //dgvHeaderInfo数据集绑定 this.dgvHeaderInfo.DataSource = reader_bll.selectReader().Tables[0]; //this.dgvHeaderInfo.Columns[13].Visible = false; //this.dgvHeaderInfo.Columns[12].Visible = false; //this.dgvHeaderInfo.Columns[11].Visible = false; //this.dgvHeaderInfo.Columns[10].Visible = false; #region 拉框绑定 DataGridViewColumnCollection columns = dgvHeaderInfo.Columns; for (int i = 0; i < columns.Count - 2; i++) { comboBox1.Items.Add(columns[i].HeaderText); } comboBox1.Items.Insert(0, "全部"); comboBox1.SelectedIndex = 0; #endregion //树状图的绑定 TreeViewBand(); #region DataGridView3的绑定 已借阅的图书信息表 //dataGridView3.AutoGenerateColumns = false; //需要添加列的列标题字符串 string arraysHeaderText1 = @"读者编号,读者名称,图书编号,图书名称,借出时间,书应归还时间,实际归还时间,应付罚金,续借次数,借还描述"; //需要绑定数据库列名称的字符串 string arraysName1 = @"ReaderId,ReaderName,BookId,BookName,BorrowTime,ReturnTime,FactReturnTime,Fine,RenewCount,BorrowRemark"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText1, arraysName1, dgvReaderBorrowBook); //string index = dgvHeaderInfo.Rows[0].Cells[0].Value.ToString(); //DataGridView1数据集绑定 //this.dgvReaderBorrowBook.DataSource = borrowReturn_bll.ReaderBorrowReturn(index).Tables[0]; #endregion #region DataGridView2的绑定 历史借阅记录表 //dataGridView2.AutoGenerateColumns = false; //需要添加列的列标题字符串 string arraysHeaderText2 = @"读者编号,读者名称,图书编号,图书名称,借出时间,书应归还时间,实际归还时间,应付罚金,续借次数,借还描述"; //需要绑定数据库列名称的字符串 string arraysName2 = @"ReaderId,ReaderName,BookId,BookName,BorrowTime,ReturnTime,FactReturnTime,Fine,RenewCount,BorrowRemark"; //自动生成columns autocoumns.AutoColumn(arraysHeaderText2, arraysName2, dgvReaderBorrowBookInfoed); string index1 = dgvHeaderInfo.Rows[0].Cells[0].Value.ToString(); //DataGridView1数据集绑定 this.dgvReaderBorrowBookInfoed.DataSource = borrowReturn_bll.ReaderBorrowReturn1(index1).Tables[0]; dgvReaderBorrowBookInfoed.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; #endregion }
private void Add_Load(object sender, EventArgs e) { TabControl.TabPageCollection tabs = this.tabControl1.TabPages; for (int i = 0; i < tabs.Count; i++) { if (tabs[i].Text == tabName) { this.tabControl1.SelectedIndex = i; break; } } #region 图书类型表的绑定 string HeaderText = "ID,图书类型"; string DataPropertyNames = "BookTypeId,BookTypeName"; //this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText, DataPropertyNames, this.dataGridView1); auto.AddColumn("修改", this.dataGridView1); auto.AddColumn("删除", this.dataGridView1); this.dataGridView1.DataSource = booktype.selectBookType1().Tables[0]; this.dataGridView1.Columns[0].Visible = false; #endregion #region 读者类型表的绑定 string HeaderText1 = "ID,读者类型"; string DataPropertyNames1 = "ReaderTypeId,ReaderTypeName"; //this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText1, DataPropertyNames1, this.dataGridView2); auto.AddColumn("修改", this.dataGridView2); auto.AddColumn("删除", this.dataGridView2); this.dataGridView2.DataSource = readerType_bll.selectReaderType1().Tables[0]; this.dataGridView2.Columns[0].Visible = false; #endregion #region 院系表的绑定 string HeaderText2 = "ID,院系"; string DataPropertyNames2 = "DepartmentId,DepartmentName"; //this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText2, DataPropertyNames2, this.dataGridView3); auto.AddColumn("修改", this.dataGridView3); auto.AddColumn("删除", this.dataGridView3); this.dataGridView3.DataSource = department_bll.selectDepartment1().Tables[0]; this.dataGridView3.Columns[0].Visible = false; #endregion #region 班级表的绑定 string HeaderText3 = "ID,班级"; string DataPropertyNames3 = "ClassId,ClassName"; //this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; //自动生成列 auto.AutoColumn(HeaderText3, DataPropertyNames3, this.dataGridView4); auto.AddColumn("修改", this.dataGridView4); auto.AddColumn("删除", this.dataGridView4); this.dataGridView4.DataSource = class_bll.selectClass1().Tables[0]; this.dataGridView4.Columns[0].Visible = false; #endregion }