📄 statusmanage.cs
字号:
//
// 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(217, 85);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(119, 87);
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, 124);
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, 288);
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, 230);
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(164, 288);
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(699, 515);
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.MaximizeBox = false;
this.Name = "StatusManage";
this.Text = "学籍管理";
this.Load += new System.EventHandler(this.StatusManage_Load);
this.groupBox10.ResumeLayout(false);
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
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 = this.DataReader1["InDate"].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;
}
private void lblInDate_Click(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -