📄 orgsettings.cs
字号:
using System;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using StudentsMIS.DataAccess;
using StudentsMIS.Business;
using StudentsMIS.CommonClassLibrary;
namespace StudentsMIS.WinForm
{
/// <summary>
/// OrgSettings 的摘要说明。
/// </summary>
public class OrgSettings : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.DataGrid gridClass;
private System.Windows.Forms.ComboBox cmbCollege;
private System.Windows.Forms.ComboBox cmbSpeciality;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnSerchClass;
private System.Windows.Forms.TextBox txtSearchValueClass;
private System.Windows.Forms.ComboBox cmbSearchTypeClass;
private StudentsMIS.WinForm.Organization dataSetOrgs;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.DataGrid gridSpeciality;
private System.Windows.Forms.DataGridTableStyle dgTableStyleSpeciality;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn6;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn7;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn8;
private System.Windows.Forms.DataGridTableStyle dgTableStyleClass;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn5;
private System.Windows.Forms.DataGridTableStyle dgTableStyleCollege;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn9;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn10;
private System.Windows.Forms.DataGrid gridCollege;
private System.Windows.Forms.Button btnSearchSpeciality;
private System.Windows.Forms.TextBox txtSearchSpeciality;
private System.Windows.Forms.ComboBox cmbSearchSpeciality;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Button btnSearchCollege;
private System.Windows.Forms.TextBox txtSearchCollege;
private System.Windows.Forms.ComboBox cmbSearchCollege;
private System.Windows.Forms.TextBox txtCollegeID;
private System.Windows.Forms.TextBox txtCollegeName;
private System.Windows.Forms.Button btnDeleteCollege;
private System.Windows.Forms.Button btnUpdateCollege;
private System.Windows.Forms.Button btnInsertCollege;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.ComboBox cmbCollegeSpe;
private System.Windows.Forms.TextBox txtSpecialityID;
private System.Windows.Forms.TextBox txtSpecialityName;
private System.Windows.Forms.Button btnDeleteSpeciality;
private System.Windows.Forms.Button btnUpdateSpeciality;
private System.Windows.Forms.Button btnInsertSpeciality;
private System.Windows.Forms.Label labelSpeID;
private System.Windows.Forms.TextBox txtHeadTeacher;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtClassID;
private System.Windows.Forms.TextBox txtClassName;
private System.Windows.Forms.Button btnDeleteClass;
private System.Windows.Forms.Button btnUpdateClass;
private System.Windows.Forms.Button btnInsertClass;
private System.Windows.Forms.Label labelClassID;
private CollegeManager managerCol = new CollegeManager();
private SpecialityManager managerSpe = new SpecialityManager();
private ClassEntity entityClass = new ClassEntity();
private System.Windows.Forms.LinkLabel linkAddClass;
private System.Windows.Forms.LinkLabel linkAddSpeciality;
private System.Windows.Forms.LinkLabel linkAddCollege;
private ClassManager managerClass = new ClassManager();
public OrgSettings()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
Bind_gridCollege();
Bind_gridSpeciality();
Bind_gridClass();
}
private void Bind_gridCollege()
{
dataSetOrgs.colleges.BeginLoadData();
dataSetOrgs.colleges.Rows.Clear();
OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("Select * From colleges Order By college_ID asc");
OleDbDataAdapter objAdapter = new OleDbDataAdapter(objCommand);
objAdapter.Fill(dataSetOrgs.colleges);
dataSetOrgs.colleges.EndLoadData();
}
private void Bind_gridClass()
{
dataSetOrgs.classes.BeginLoadData();
dataSetOrgs.classes.Rows.Clear();
OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("SELECT * FROM (colleges INNER JOIN speciality ON colleges.college_ID = speciality.speciality_college) INNER JOIN classes ON speciality.speciality_ID = classes.class_speciality Order By class_ID asc");
OleDbDataAdapter objAdapter = new OleDbDataAdapter(objCommand);
objAdapter.Fill(dataSetOrgs.classes);
dataSetOrgs.classes.EndLoadData();
}
private void Bind_gridSpeciality()
{
dataSetOrgs.speciality.BeginLoadData();
dataSetOrgs.speciality.Rows.Clear();
OleDbCommand objCommand = CommandBuilder.BuildOleDbCommand("Select * From speciality Inner Join colleges On speciality.speciality_college=colleges.college_ID Order By speciality_ID asc");
OleDbDataAdapter objAdapter = new OleDbDataAdapter(objCommand);
objAdapter.Fill(dataSetOrgs.speciality);
dataSetOrgs.speciality.EndLoadData();
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtClassID = new System.Windows.Forms.TextBox();
this.labelClassID = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.txtHeadTeacher = new System.Windows.Forms.TextBox();
this.btnDeleteClass = new System.Windows.Forms.Button();
this.btnUpdateClass = new System.Windows.Forms.Button();
this.btnInsertClass = new System.Windows.Forms.Button();
this.txtClassName = new System.Windows.Forms.TextBox();
this.cmbCollege = new System.Windows.Forms.ComboBox();
this.dataSetOrgs = new StudentsMIS.WinForm.Organization();
this.cmbSpeciality = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnSerchClass = new System.Windows.Forms.Button();
this.txtSearchValueClass = new System.Windows.Forms.TextBox();
this.cmbSearchTypeClass = new System.Windows.Forms.ComboBox();
this.gridClass = new System.Windows.Forms.DataGrid();
this.dgTableStyleClass = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn5 = new System.Windows.Forms.DataGridTextBoxColumn();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.btnSearchSpeciality = new System.Windows.Forms.Button();
this.txtSearchSpeciality = new System.Windows.Forms.TextBox();
this.cmbSearchSpeciality = new System.Windows.Forms.ComboBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.labelSpeID = new System.Windows.Forms.Label();
this.btnDeleteSpeciality = new System.Windows.Forms.Button();
this.btnUpdateSpeciality = new System.Windows.Forms.Button();
this.btnInsertSpeciality = new System.Windows.Forms.Button();
this.txtSpecialityID = new System.Windows.Forms.TextBox();
this.txtSpecialityName = new System.Windows.Forms.TextBox();
this.cmbCollegeSpe = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.gridSpeciality = new System.Windows.Forms.DataGrid();
this.dgTableStyleSpeciality = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn6 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn7 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn8 = new System.Windows.Forms.DataGridTextBoxColumn();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.btnSearchCollege = new System.Windows.Forms.Button();
this.txtSearchCollege = new System.Windows.Forms.TextBox();
this.cmbSearchCollege = new System.Windows.Forms.ComboBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.btnDeleteCollege = new System.Windows.Forms.Button();
this.btnUpdateCollege = new System.Windows.Forms.Button();
this.btnInsertCollege = new System.Windows.Forms.Button();
this.txtCollegeID = new System.Windows.Forms.TextBox();
this.txtCollegeName = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.gridCollege = new System.Windows.Forms.DataGrid();
this.dgTableStyleCollege = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn9 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn10 = new System.Windows.Forms.DataGridTextBoxColumn();
this.btnCancel = new System.Windows.Forms.Button();
this.linkAddClass = new System.Windows.Forms.LinkLabel();
this.linkAddSpeciality = new System.Windows.Forms.LinkLabel();
this.linkAddCollege = new System.Windows.Forms.LinkLabel();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataSetOrgs)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridClass)).BeginInit();
this.tabPage2.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridSpeciality)).BeginInit();
this.tabPage3.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridCollege)).BeginInit();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(8, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(552, 344);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.White;
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.gridClass);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(544, 319);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "班级设置";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtClassID);
this.groupBox1.Controls.Add(this.labelClassID);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.txtHeadTeacher);
this.groupBox1.Controls.Add(this.btnDeleteClass);
this.groupBox1.Controls.Add(this.btnUpdateClass);
this.groupBox1.Controls.Add(this.btnInsertClass);
this.groupBox1.Controls.Add(this.txtClassName);
this.groupBox1.Controls.Add(this.cmbCollege);
this.groupBox1.Controls.Add(this.cmbSpeciality);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.linkAddClass);
this.groupBox1.Location = new System.Drawing.Point(344, 15);
this.groupBox1.Name = "groupBox1";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -