📄 statusmanage.cs
字号:
this.groupBox1.Controls.Add(this.lblClass);
this.groupBox1.Controls.Add(this.lblDepartment);
this.groupBox1.Controls.Add(this.label16);
this.groupBox1.Controls.Add(this.label14);
this.groupBox1.Controls.Add(this.label12);
this.groupBox1.Controls.Add(this.label11);
this.groupBox1.Controls.Add(this.pictureBox1);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.ForeColor = System.Drawing.SystemColors.Desktop;
this.groupBox1.Location = new System.Drawing.Point(24, 104);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(352, 344);
this.groupBox1.TabIndex = 124;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "详细信息";
//
// lblStatus
//
this.lblStatus.BackColor = System.Drawing.SystemColors.Window;
this.lblStatus.Location = new System.Drawing.Point(80, 240);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(72, 23);
this.lblStatus.TabIndex = 133;
//
// lblAge
//
this.lblAge.BackColor = System.Drawing.SystemColors.Window;
this.lblAge.Location = new System.Drawing.Point(80, 152);
this.lblAge.Name = "lblAge";
this.lblAge.Size = new System.Drawing.Size(40, 23);
this.lblAge.TabIndex = 132;
//
// lblNation
//
this.lblNation.BackColor = System.Drawing.SystemColors.Window;
this.lblNation.Location = new System.Drawing.Point(80, 192);
this.lblNation.Name = "lblNation";
this.lblNation.Size = new System.Drawing.Size(72, 23);
this.lblNation.TabIndex = 131;
//
// lblInDate
//
this.lblInDate.BackColor = System.Drawing.SystemColors.Window;
this.lblInDate.Location = new System.Drawing.Point(216, 248);
this.lblInDate.Name = "lblInDate";
this.lblInDate.Size = new System.Drawing.Size(112, 23);
this.lblInDate.TabIndex = 130;
//
// lblNativePlace
//
this.lblNativePlace.BackColor = System.Drawing.SystemColors.Window;
this.lblNativePlace.Location = new System.Drawing.Point(216, 192);
this.lblNativePlace.Name = "lblNativePlace";
this.lblNativePlace.Size = new System.Drawing.Size(112, 23);
this.lblNativePlace.TabIndex = 129;
//
// lblSex
//
this.lblSex.BackColor = System.Drawing.SystemColors.Window;
this.lblSex.Location = new System.Drawing.Point(80, 112);
this.lblSex.Name = "lblSex";
this.lblSex.Size = new System.Drawing.Size(40, 23);
this.lblSex.TabIndex = 128;
//
// lblStuName
//
this.lblStuName.BackColor = System.Drawing.SystemColors.Window;
this.lblStuName.Location = new System.Drawing.Point(80, 72);
this.lblStuName.Name = "lblStuName";
this.lblStuName.Size = new System.Drawing.Size(80, 23);
this.lblStuName.TabIndex = 127;
//
// label2
//
this.label2.Location = new System.Drawing.Point(176, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 23);
this.label2.TabIndex = 125;
this.label2.Text = "班级";
//
// label3
//
this.label3.Location = new System.Drawing.Point(32, 40);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 23);
this.label3.TabIndex = 124;
this.label3.Text = "院系";
//
// lblClass
//
this.lblClass.BackColor = System.Drawing.SystemColors.Window;
this.lblClass.Location = new System.Drawing.Point(216, 32);
this.lblClass.Name = "lblClass";
this.lblClass.Size = new System.Drawing.Size(120, 23);
this.lblClass.TabIndex = 123;
//
// lblDepartment
//
this.lblDepartment.BackColor = System.Drawing.SystemColors.Window;
this.lblDepartment.Location = new System.Drawing.Point(80, 32);
this.lblDepartment.Name = "lblDepartment";
this.lblDepartment.Size = new System.Drawing.Size(80, 23);
this.lblDepartment.TabIndex = 122;
//
// label16
//
this.label16.Location = new System.Drawing.Point(176, 200);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(32, 23);
this.label16.TabIndex = 113;
this.label16.Text = "籍贯";
//
// label14
//
this.label14.Location = new System.Drawing.Point(32, 80);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(40, 23);
this.label14.TabIndex = 111;
this.label14.Text = "姓名";
//
// label12
//
this.label12.Location = new System.Drawing.Point(24, 160);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(40, 16);
this.label12.TabIndex = 104;
this.label12.Text = "年龄";
//
// label11
//
this.label11.Location = new System.Drawing.Point(80, -72);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(40, 34);
this.label11.TabIndex = 102;
this.label11.Text = "照片";
//
// pictureBox1
//
this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(200, 72);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(72, 104);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 101;
this.pictureBox1.TabStop = false;
//
// label9
//
this.label9.Location = new System.Drawing.Point(32, 112);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(32, 16);
this.label9.TabIndex = 97;
this.label9.Text = "性别";
//
// label7
//
this.label7.Location = new System.Drawing.Point(32, 240);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(40, 32);
this.label7.TabIndex = 95;
this.label7.Text = "政治身份";
//
// label4
//
this.label4.Location = new System.Drawing.Point(32, 200);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 23);
this.label4.TabIndex = 91;
this.label4.Text = "民族";
//
// label5
//
this.label5.Location = new System.Drawing.Point(160, 256);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 23);
this.label5.TabIndex = 89;
this.label5.Text = "入学时间";
//
// StatusManage
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(720, 549);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.groupBox10);
this.Controls.Add(this.groupBox9);
this.Controls.Add(this.groupBox7);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "StatusManage";
this.Text = "学籍管理";
this.Load += new System.EventHandler(this.StatusManage_Load);
this.groupBox10.ResumeLayout(false);
this.groupBox9.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void Combo_Fill()
{
try
{
this.Connection1.Open();
this.commandStr="select DepartmentName from Department";
this.Command1.CommandText=this.commandStr;
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
this.comboDepartment.Items.Add(this.DataReader1["DepartmentName"].ToString());
}
this.DataReader1.Close();
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
}
finally
{
this.DataReader1.Close();
this.Connection1.Close();
}
}
private void comboDepartment_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.comboClass.Items.Clear();
this.comboClass.Text="";
try
{
if(this.Connection1.State==ConnectionState.Closed)
this.Connection1.Open();
this.commandStr="select ClassName from Class where DepartmentName="+"'"+this.comboDepartment.Text+"'";
this.Command1.CommandText=this.commandStr;
this.DataReader1.Close();
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
this.comboClass.Items.Add(this.DataReader1["ClassName"].ToString());
}
this.DataReader1.Close();
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
}
finally
{
this.DataReader1.Close();
this.Connection1.Close();
}
}
private void btnApply_Click(object sender, System.EventArgs e)
{
try
{
if(this.Connection1.State==ConnectionState.Closed)
this.Connection1.Open();
this.commandStr="select * from Student where StudentID='"+this.textID.Text+"'";
this.Command1.CommandText=this.commandStr;
this.DataReader1.Close();
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
System.DateTime indate;
this.lblStuName.Text=this.DataReader1["StudentName"].ToString();
this.lblNativePlace.Text=this.DataReader1["NativePlace"].ToString();
this.lblDepartment.Text=this.DataReader1["Department"].ToString();
this.lblClass.Text=this.DataReader1["Class"].ToString();
indate=Convert.ToDateTime(this.DataReader1["InDate"].ToString());
this.lblInDate.Text=indate.ToShortTimeString().ToString();
this.lblNation.Text=this.DataReader1["Nation"].ToString();
this.lblSex.Text=this.DataReader1["Sex"].ToString();
this.lblAge.Text=this.DataReader1["Age"].ToString();
this.lblStatus.Text=this.DataReader1["Status"].ToString();
this.pictureBox1.Image=Image.FromFile(this.DataReader1["Picture"].ToString());
}
this.DataReader1.Close();
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
}
finally
{
this.DataReader1.Close();
this.Connection1.Close();
}
}
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void StatusManage_Load(object sender, System.EventArgs e)
{
this.Combo_Fill();
}
private void btnStuMove_Click(object sender, System.EventArgs e)
{
if(this.comboDepartment.Text==""|this.comboClass.Text==""|this.dateTimePicker2.Text=="")
{
MessageBox.Show("调入院系和班级和时间不能为空");
return;
}
this.originDep=this.lblDepartment.Text;
this.originCla=this.lblClass.Text;
string studentId=this.textID.Text;
DateTime date=Convert.ToDateTime(this.dateTimePicker2.Text);
string dateMove=date.ToShortDateString().ToString();
if(this.statusManage.StuMove_Insert(studentId,originDep,originCla,this.comboDepartment.Text,this.comboClass.Text,dateMove))
{
if(this.statusManage.Student_Move(studentId,this.comboDepartment.Text,this.comboClass.Text))
{
MessageBox.Show("学生:"+this.lblStuName.Text+"调动成功");
this.lblDepartment.Text=this.comboDepartment.Text;
this.lblClass.Text=this.comboClass.Text;
}
}
}
private void btnStuLeave_Click(object sender, System.EventArgs e)
{
if(this.comboLeaveType.Text==""|this.dateTimePicker1.Text=="")
{
MessageBox.Show("离校类型和时间不能为空");
return;
}
string studentId=this.textID.Text;
DateTime date=Convert.ToDateTime(this.dateTimePicker1.Text);
string dateLeave=date.ToShortDateString().ToString();
if(MessageBox.Show("此同学真的确认离校吗?","确认离校",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning)==DialogResult.OK)
{
if(this.statusManage.StuLeave_Insert(studentId,this.lblDepartment.Text,this.lblClass.Text,this.comboLeaveType.Text,dateLeave))
{
if(this.statusManage.StuLeave(studentId))
{
MessageBox.Show("学生:"+this.lblStuName.Text+"离校已经成功");
this.Info_Clear();
}
}
}
}
private void Info_Clear()
{
this.lblStuName.Text="";
this.lblNativePlace.Text="";
this.lblDepartment.Text="";
this.lblClass.Text="";
this.lblInDate.Text="";
this.lblNation.Text="";
this.lblSex.Text="";
this.lblAge.Text="";
this.lblStatus.Text="";
this.textID.Clear();
this.pictureBox1.Image.Dispose();
this.pictureBox1.Image=null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -