📄 form3.cs
字号:
this.button2.Text = "查看";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(600, 336);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 32);
this.button1.TabIndex = 18;
this.button1.Text = "提交";
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// Form3
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(784, 541);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.Panel2);
this.Controls.Add(this.Panel1);
this.Name = "Form3";
this.Text = "Form3";
this.Load += new System.EventHandler(this.Form3_Load);
this.Panel1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.Panel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
#region 返回数据给People
private string GetXm( )
{
if( ckXm.Checked = true && tbXm.Text.Trim( ).Length != 0 )
{
return tbXm.Text.Trim( );
}
else
{
return "";
}
}
private string GetXb( )
{
if ( ckXb.Checked == true )
{
return rb1.Checked ? "男" : "女";
}
else
{
return "";
}
}
private string GetCsrq( )
{
if ( ckCsrq.Checked == true && tbCsrq.Text.Trim( ).Length !=0 )
{
return tbCsrq.Text.Trim( );
}
else
{
return "";
}
}
private string GetPycc( )
{
if ( ckPycc.Checked == true && cbPycc.Text != "请选择或输入新项" )
{
return cbPycc.Text.Trim( );
}
else
{
return "";
}
}
private string GetXz( )
{
if ( ckXz.Checked == true && tbXz.Text.Trim( ).Length != 0 )
{
return tbXz.Text.Trim( );
}
else
{
return "";
}
}
private string GetYxmc( )
{
if ( ckYxmc.Checked == true && tbYxmc.Text.Trim( ).Length != 0 )
{
return tbYxmc.Text.Trim( );
}
else
{
return "";
}
}
private string GetZymc( )
{
if ( ckZymc.Checked == true && tbZymc.Text.Trim( ).Length != 0 )
{
return tbZymc.Text.Trim( );
}
else
{
return "";
}
}
private string GetBjyjl( )
{
// if ( ckByjl.Checked == true && tbBjyjl.Text.Trim( ).Length != 0 )
// {
// return tbBjyjl.Text.Trim( );
// }
// else
// {
return "";
// }
}
private string GetRxrq( )
{
if ( ckRxrq.Checked == true && tbRxrq.Text.Trim( ).Length != 0 )
{
return tbRxrq.Text.Trim( );
}
else
{
return "";
}
}
private string GetZsbh( )
{
if ( ckZsbh.Checked == true && tbZsbh.Text.Trim( ).Length != 0 )
{
return tbZsbh.Text.Trim( );
}
else
{
return "";
}
}
#endregion
#region 清空Lable
private void ClearLable( )
{
lblName.Text = "";
lblSex.Text = "";
lblBirthday.Text = "";
lblClass.Text = "";
lblDiploma.Text = "";
lblSchool.Text = "";
lblSystem.Text = "";
lblSpecialty.Text = "";
lblEnrollment.Text = "";
lblGraduation.Text = "";
lblDiplomaID.Text = "";
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
if( cbXXXs.Text.Trim( ) == "请选择或输入新项" || tbByrq.Text.Length == 0 )
{
ClearLable( );
MessageBox.Show( "学历类型,毕业日期不可以为空,请务必填写","填写提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Warning );
return;
}
else
{
ClearLable( );
People tempPeople = new People( GetXm( ) , GetXb( ),GetCsrq( ),GetPycc( ),cbXXXs.Text,GetXz( ),GetYxmc( ),GetZymc( ),GetBjyjl( ),GetRxrq( ),tbByrq.Text,GetZsbh( ),true);
ArrayList otherPeople = tempPeople.GetQueryObject( );
//如果查询只有一个
if ( otherPeople.Count == 1 )
{
// MoreDataPanel.Visible = false;
People onlyOne = (People)otherPeople[0];
if( onlyOne.Name == tbXm.Text )
{
lblName.Tag = "ture";
lblName.ForeColor = Color.Black;
lblName.Text = onlyOne.Name;
}
else
{
lblName.Tag = "false";
lblName.ForeColor = Color.Red;
lblName.Text = onlyOne.Name;
}
if( onlyOne.Sex == ( rb1.Checked ? "男" : "女" ) )
{
lblSex.Tag = "true";
lblSex.ForeColor = Color.Black;
lblSex.Text = onlyOne.Sex;
}
else
{
lblSex.Tag = "false";
lblSex.ForeColor = Color.Red;
lblSex.Text = onlyOne.Sex;
}
if( onlyOne.Birthday == tbCsrq.Text )
{
lblBirthday.Tag = "true";
lblBirthday.ForeColor = Color.Black;
lblBirthday.Text = onlyOne.Birthday;
}
else
{
lblBirthday.Tag = "false";
lblBirthday.ForeColor = Color.Red;
lblBirthday.Text = onlyOne.Birthday;
}
if( onlyOne.ClassOfStudent == cbPycc.Text)
{
lblClass.Tag = "true";
lblClass.ForeColor = Color.Black;
lblClass.Text = onlyOne.ClassOfStudent;
}
else
{
lblClass.Tag = "false";
lblClass.ForeColor = Color.Red;
lblClass.Text = onlyOne.ClassOfStudent;
}
if( onlyOne.Diploma == cbXXXs.Text )
{
lblDiploma.Tag = "true";
lblDiploma.ForeColor = Color.Black;
lblDiploma.Text = onlyOne.Diploma;
}
else
{
lblDiploma.Tag = "false";
lblDiploma.ForeColor = Color.Red;
lblDiploma.Text = onlyOne.Diploma;
}
if( onlyOne.School == tbYxmc.Text )
{
lblSchool.Tag = "true";
lblSchool.ForeColor = Color.Black;
lblSchool.Text = onlyOne.School;
}
else
{
lblSchool.Tag = "false";
lblSchool.ForeColor = Color.Red;
lblSchool.Text = onlyOne.School;
}
if( onlyOne.SystemOfEducation == tbXz.Text )
{
lblSystem.Tag = "true";
lblSystem.ForeColor = Color.Black;
lblSystem.Text = onlyOne.SystemOfEducation;
}
else
{
lblSystem.Tag = "false";
lblSystem.ForeColor = Color.Red;
lblSystem.Text = onlyOne.SystemOfEducation;
}
if( onlyOne.Specialty == tbZymc.Text )
{
lblSpecialty.Tag = "true";
lblSpecialty.ForeColor = Color.Black;
lblSpecialty.Text = onlyOne.Specialty;
}
else
{
lblSpecialty.Tag = "false";
lblSpecialty.ForeColor = Color.Red;
lblSpecialty.Text = onlyOne.Specialty;
}
if( onlyOne.EnrollmentTime == tbRxrq.Text )
{
lblEnrollment.Tag = "true";
lblEnrollment.ForeColor = Color.Black;
lblEnrollment.Text = onlyOne.EnrollmentTime;
}
else
{
lblEnrollment.Tag = "false";
lblEnrollment.ForeColor = Color.Red;
lblEnrollment.Text = onlyOne.EnrollmentTime;
}
if( onlyOne.GraduationTime == tbByrq.Text )
{
lblGraduation.Tag = "true";
lblGraduation.ForeColor = Color.Black;
lblGraduation.Text = onlyOne.GraduationTime;
}
else
{
lblGraduation.Tag = "false";
lblGraduation.ForeColor = Color.Red;
lblGraduation.Text = onlyOne.GraduationTime;
}
if( onlyOne.DiplomaID == tbZsbh.Text )
{
lblDiplomaID.Tag = "true";
lblDiplomaID.ForeColor = Color.Black;
lblDiplomaID.Text = onlyOne.DiplomaID;
}
else
{
lblDiplomaID.Tag = "false";
lblDiplomaID.ForeColor = Color.Red;
lblDiplomaID.Text = onlyOne.DiplomaID;
}
if( isExist( ) )
{
stuState = true;
}
else
{
stuState = false;
}
}
//没有查到
else if( otherPeople.Count == 0 )
{
// MoreDataPanel.Visible = false;
MessageBox.Show("查无此人","查询提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Error );
}
//符合条件的有多个
else
{
Panel2.Visible = true;
Panel1.Visible = false;
lvInput.Items.Clear( );
for( int i = 0; i < otherPeople.Count ; i++ )
{
People tempOne = (People)otherPeople[i];
ListViewItem first = new ListViewItem( );
first.Text = tempOne.Name;
first.SubItems.Add( tempOne.Sex );
first.SubItems.Add( tempOne.Birthday );
first.SubItems.Add( tempOne.ClassOfStudent );
first.SubItems.Add( tempOne.Diploma );
first.SubItems.Add( tempOne.SystemOfEducation );
first.SubItems.Add( tempOne.School );
first.SubItems.Add( tempOne.Specialty );
first.SubItems.Add( tempOne.Conclusion );
first.SubItems.Add( tempOne.EnrollmentTime );
first.SubItems.Add( tempOne.GraduationTime );
first.SubItems.Add( tempOne.DiplomaID );
lvInput.Items.Add( first );
}
}
}
button3.Enabled = true;
}
private bool isExist( )
{
if( lblName.Tag.ToString( ) == "true" && lblSex.Tag.ToString( ) == "true" && lblBirthday.Tag.ToString( ) == "true" && lblClass.Tag.ToString( ) == "true" && lblDiploma.Tag.ToString( ) == "true" && lblSchool.Tag.ToString( ) == "true" && lblSystem.Tag.ToString( ) == "true" && lblSpecialty.Tag.ToString( ) == "true" && lblEnrollment.Tag.ToString( ) == "true" && lblGraduation.Tag.ToString( ) == "true" && lblDiplomaID.Tag.ToString( ) == "true" )
{
return true;
}
else
{
return false ;
}
}
private void lvInput_DoubleClick(object sender, System.EventArgs e)
{
ListViewItem ltemp = lvInput.SelectedItems[0];
string xm = lvInput.SelectedItems[0].Text;
string xb = lvInput.SelectedItems[0].SubItems[1].Text;
string csrq = lvInput.SelectedItems[0].SubItems[2].Text;
string pycc = lvInput.SelectedItems[0].SubItems[3].Text;
string xxxs = lvInput.SelectedItems[0].SubItems[4].Text;
string xz = lvInput.SelectedItems[0].SubItems[5].Text;
string yxmc = lvInput.SelectedItems[0].SubItems[6].Text;
string zymc = lvInput.SelectedItems[0].SubItems[7].Text;
// string bjyjl = lvInput.SelectedItems[0].SubItems[8].Text;
string rxrq = lvInput.SelectedItems[0].SubItems[9].Text;
string byrq = lvInput.SelectedItems[0].SubItems[10].Text;
string zsbh = lvInput.SelectedItems[0].SubItems[11].Text;
if( xm == tbXm.Text )
{
lblName.ForeColor = Color.Black;
lblName.Text = xm;
}
else
{
lblName.ForeColor = Color.Red;
lblName.Text = xm;
}
if( xb == ( rb1.Checked ? "男" : "女" ) )
{
lblSex.ForeColor = Color.Black;
lblSex.Text = xb;
}
else
{
lblSex.ForeColor = Color.Red;
lblSex.Text = xb;
}
if( csrq == tbCsrq.Text )
{
lblBirthday.ForeColor = Color.Black;
lblBirthday.Text = csrq;
}
else
{
lblBirthday.ForeColor = Color.Red;
lblBirthday.Text = csrq;
}
if( pycc == cbPycc.Text)
{
lblClass.ForeColor = Color.Black;
lblClass.Text = pycc;
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -