📄 studentmanage.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using StudentManage.DataLevel;
namespace StudentManage.UILevel
{
/// <summary>
/// StudentManage 的摘要说明。
/// </summary>
public class StudentManage : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button btnModify;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button btnFirst;
private System.Windows.Forms.Button btnPrevious;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button btnLast;
private System.Windows.Forms.Label lblRecord;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox comboClass;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textName;
private System.Windows.Forms.TextBox textNativePlace;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button btnPicture;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.ComboBox comboSex;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboStatus;
private System.Windows.Forms.ComboBox comboNation;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.GroupBox groupBox8;
//private System.Windows.Forms.Button btnStudentExport;
private System.Windows.Forms.Button btnSearchCancel;
//private System.Windows.Forms.Button btnStudentSearch;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.ComboBox comboDepartment2;
//private System.Windows.Forms.Button btnStudentLeaveExport;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private string selectStr;
private SqlConnection Connection1=null;
private SqlCommand Command1=null;
private SqlDataReader DataReader1=null;
private SqlDataAdapter dataAdapter1=null;
private SqlDataAdapter dataAdapter2=null;
DataView DataViewStudent=new DataView();
private DataSet DataSetStudent=new DataSet();
private DataSet DataSetStudentAll=new DataSet();
private string commandStr;
private string StuDepartment;
private string StuClass;
private bool first=true;
private string [] ListHeader={"学生ID","姓名","性别","年龄","民族","籍贯","院系","系别","政治身份","入学时间"};
private System.Windows.Forms.TextBox textID;
private System.Windows.Forms.ComboBox comboDepartment;
private System.Windows.Forms.TextBox textID2;
private System.Windows.Forms.ComboBox comboClass2;
private System.Windows.Forms.Button btnStuSearch;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label lblDepartment;
private System.Windows.Forms.Label lblClass;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
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.Label lblPicture;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public StudentManage()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.selectStr="select * from Student";
this.Connection1=new SqlConnection(DataLevel.Connection.ConnString);
this.Command1=new SqlCommand();
this.dataAdapter2=new SqlDataAdapter(this.selectStr,this.Connection1);
this.Command1.Connection=this.Connection1;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StudentManage));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.comboClass = new System.Windows.Forms.ComboBox();
this.comboDepartment = new System.Windows.Forms.ComboBox();
this.btnOk = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.btnModify = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnFirst = new System.Windows.Forms.Button();
this.btnPrevious = new System.Windows.Forms.Button();
this.btnNext = new System.Windows.Forms.Button();
this.btnLast = new System.Windows.Forms.Button();
this.lblRecord = new System.Windows.Forms.Label();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle1 = 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.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblPicture = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.lblClass = new System.Windows.Forms.Label();
this.lblDepartment = new System.Windows.Forms.Label();
this.textID = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.textName = new System.Windows.Forms.TextBox();
this.textNativePlace = new System.Windows.Forms.TextBox();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label12 = new System.Windows.Forms.Label();
this.btnPicture = new System.Windows.Forms.Button();
this.label11 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.comboSex = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comboStatus = new System.Windows.Forms.ComboBox();
this.comboNation = new System.Windows.Forms.ComboBox();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.label1 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.btnStuSearch = new System.Windows.Forms.Button();
this.btnSearchCancel = new System.Windows.Forms.Button();
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textID2 = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.comboClass2 = new System.Windows.Forms.ComboBox();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.comboDepartment2 = new System.Windows.Forms.ComboBox();
this.btnExit = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.tabPage2.SuspendLayout();
this.groupBox8.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Appearance = System.Windows.Forms.TabAppearance.Buttons;
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(8, 24);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(729, 461);
this.tabControl1.TabIndex = 1;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox6);
this.tabPage1.Controls.Add(this.groupBox4);
this.tabPage1.Controls.Add(this.groupBox3);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 24);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(721, 433);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "学生信息管理";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.label5);
this.groupBox6.Controls.Add(this.label4);
this.groupBox6.Controls.Add(this.comboClass);
this.groupBox6.Controls.Add(this.comboDepartment);
this.groupBox6.Controls.Add(this.btnOk);
this.groupBox6.Location = new System.Drawing.Point(8, 8);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(369, 53);
this.groupBox6.TabIndex = 113;
this.groupBox6.TabStop = false;
//
// label5
//
this.label5.Location = new System.Drawing.Point(128, 16);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(32, 23);
this.label5.TabIndex = 120;
this.label5.Text = "班级";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 23);
this.label4.TabIndex = 119;
this.label4.Text = "院系";
//
// comboClass
//
this.comboClass.Location = new System.Drawing.Point(160, 16);
this.comboClass.Name = "comboClass";
this.comboClass.Size = new System.Drawing.Size(120, 20);
this.comboClass.TabIndex = 118;
//
// comboDepartment
//
this.comboDepartment.Location = new System.Drawing.Point(40, 16);
this.comboDepartment.Name = "comboDepartment";
this.comboDepartment.Size = new System.Drawing.Size(88, 20);
this.comboDepartment.TabIndex = 117;
this.comboDepartment.SelectedIndexChanged += new System.EventHandler(this.comboDepartment_SelectedIndexChanged);
//
// btnOk
//
this.btnOk.Image = ((System.Drawing.Image)(resources.GetObject("btnOk.Image")));
this.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOk.Location = new System.Drawing.Point(304, 16);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(56, 24);
this.btnOk.TabIndex = 103;
this.btnOk.Text = "确认";
this.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// groupBox4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -