⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studentmanage.cs

📁 c#写图书管理系统 界面美观 功能齐全 配有完整的数据库
💻 CS
📖 第 1 页 / 共 4 页
字号:
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.Resources.ResourceManager resources = new System.Resources.ResourceManager(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.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.btnApply = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			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();
			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(840, 480);
			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.Controls.Add(this.btnApply);
			this.tabPage1.Controls.Add(this.btnCancel);
			this.tabPage1.Location = new System.Drawing.Point(4, 24);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(832, 452);
			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(384, 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.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			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
			// 
			this.groupBox4.Controls.Add(this.btnModify);
			this.groupBox4.Controls.Add(this.btnAdd);
			this.groupBox4.Location = new System.Drawing.Point(464, 8);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(216, 48);
			this.groupBox4.TabIndex = 111;
			this.groupBox4.TabStop = false;
			// 
			// btnModify
			// 
			this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnModify.Image = ((System.Drawing.Image)(resources.GetObject("btnModify.Image")));
			this.btnModify.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnModify.Location = new System.Drawing.Point(104, 16);
			this.btnModify.Name = "btnModify";
			this.btnModify.Size = new System.Drawing.Size(56, 24);
			this.btnModify.TabIndex = 99;
			this.btnModify.Text = "修改";
			this.btnModify.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
			// 
			// btnAdd
			// 
			this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnAdd.Image = ((System.Drawing.Image)(resources.GetObject("btnAdd.Image")));
			this.btnAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnAdd.Location = new System.Drawing.Point(8, 16);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new System.Drawing.Size(56, 24);
			this.btnAdd.TabIndex = 96;
			this.btnAdd.Text = "添加";
			this.btnAdd.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.btnFirst);
			this.groupBox3.Controls.Add(this.btnPrevious);
			this.groupBox3.Controls.Add(this.btnNext);
			this.groupBox3.Controls.Add(this.btnLast);
			this.groupBox3.Controls.Add(this.lblRecord);
			this.groupBox3.Controls.Add(this.dataGrid1);
			this.groupBox3.Location = new System.Drawing.Point(8, 80);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(448, 344);
			this.groupBox3.TabIndex = 110;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "本班同学记录";
			// 
			// btnFirst
			// 
			this.btnFirst.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnFirst.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnFirst.Location = new System.Drawing.Point(40, 32);
			this.btnFirst.Name = "btnFirst";
			this.btnFirst.Size = new System.Drawing.Size(56, 24);
			this.btnFirst.TabIndex = 103;
			this.btnFirst.Text = "第一条";
			this.btnFirst.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click);
			// 
			// btnPrevious
			// 
			this.btnPrevious.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnPrevious.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnPrevious.Location = new System.Drawing.Point(96, 32);
			this.btnPrevious.Name = "btnPrevious";
			this.btnPrevious.Size = new System.Drawing.Size(56, 24);
			this.btnPrevious.TabIndex = 102;
			this.btnPrevious.Text = "上一条";
			this.btnPrevious.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click);
			// 
			// btnNext
			// 
			this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnNext.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnNext.Location = new System.Drawing.Point(280, 32);
			this.btnNext.Name = "btnNext";
			this.btnNext.Size = new System.Drawing.Size(56, 24);
			this.btnNext.TabIndex = 101;
			this.btnNext.Text = "下一条";
			this.btnNext.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
			// 
			// btnLast
			// 
			this.btnLast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnLast.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnLast.Location = new System.Drawing.Point(344, 32);
			this.btnLast.Name = "btnLast";
			this.btnLast.Size = new System.Drawing.Size(64, 24);
			this.btnLast.TabIndex = 100;
			this.btnLast.Text = "最后一条";
			this.btnLast.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnLast.Click += new System.EventHandler(this.btnLast_Click);
			// 
			// lblRecord
			// 
			this.lblRecord.BackColor = System.Drawing.SystemColors.Window;
			this.lblRecord.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lblRecord.ForeColor = System.Drawing.SystemColors.Desktop;
			this.lblRecord.Location = new System.Drawing.Point(160, 32);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -