📄 form3.cs
字号:
{
lblClass.ForeColor = Color.Red;
lblClass.Text = pycc;
}
if( xxxs == cbXXXs.Text )
{
lblDiploma.ForeColor = Color.Black;
lblDiploma.Text = xxxs;
}
else
{
lblDiploma.ForeColor = Color.Red;
lblDiploma.Text = xxxs;
}
if( yxmc == tbYxmc.Text )
{
lblSchool.ForeColor = Color.Black;
lblSchool.Text = yxmc;
}
else
{
lblSchool.ForeColor = Color.Red;
lblSchool.Text = yxmc;
}
if( xz == tbXz.Text )
{
lblSystem.ForeColor = Color.Black;
lblSystem.Text = xz;
}
else
{
lblSystem.ForeColor = Color.Red;
lblSystem.Text = xz;
}
if( zymc == tbZymc.Text )
{
lblSpecialty.ForeColor = Color.Black;
lblSpecialty.Text = zymc;
}
else
{
lblSpecialty.ForeColor = Color.Red;
lblSpecialty.Text = zymc;
}
if( rxrq == tbRxrq.Text )
{
lblEnrollment.ForeColor = Color.Black;
lblEnrollment.Text = rxrq;
}
else
{
lblEnrollment.ForeColor = Color.Red;
lblEnrollment.Text = rxrq;
}
if( byrq == tbByrq.Text )
{
lblGraduation.ForeColor = Color.Black;
lblGraduation.Text = byrq;
}
else
{
lblGraduation.ForeColor = Color.Red;
lblGraduation.Text = byrq;
}
if( zsbh == tbZsbh.Text )
{
lblDiplomaID.ForeColor = Color.Black;
lblDiplomaID.Text = zsbh;
}
else
{
lblDiplomaID.ForeColor = Color.Red;
lblDiplomaID.Text = zsbh;
}
Panel2.Visible = false;
Panel1.Visible = true;
}
private void Form3_Load(object sender, System.EventArgs e)
{
Panel1.Visible = true;
Panel2.Visible = false;
}
private void button1_Click_1(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 void lvInput_DoubleClick_1(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
{
lblClass.ForeColor = Color.Red;
lblClass.Text = pycc;
}
if( xxxs == cbXXXs.Text )
{
lblDiploma.ForeColor = Color.Black;
lblDiploma.Text = xxxs;
}
else
{
lblDiploma.ForeColor = Color.Red;
lblDiploma.Text = xxxs;
}
if( yxmc == tbYxmc.Text )
{
lblSchool.ForeColor = Color.Black;
lblSchool.Text = yxmc;
}
else
{
lblSchool.ForeColor = Color.Red;
lblSchool.Text = yxmc;
}
if( xz == tbXz.Text )
{
lblSystem.ForeColor = Color.Black;
lblSystem.Text = xz;
}
else
{
lblSystem.ForeColor = Color.Red;
lblSystem.Text = xz;
}
if( zymc == tbZymc.Text )
{
lblSpecialty.ForeColor = Color.Black;
lblSpecialty.Text = zymc;
}
else
{
lblSpecialty.ForeColor = Color.Red;
lblSpecialty.Text = zymc;
}
if( rxrq == tbRxrq.Text )
{
lblEnrollment.ForeColor = Color.Black;
lblEnrollment.Text = rxrq;
}
else
{
lblEnrollment.ForeColor = Color.Red;
lblEnrollment.Text = rxrq;
}
if( byrq == tbByrq.Text )
{
lblGraduation.ForeColor = Color.Black;
lblGraduation.Text = byrq;
}
else
{
lblGraduation.ForeColor = Color.Red;
lblGraduation.Text = byrq;
}
if( zsbh == tbZsbh.Text )
{
lblDiplomaID.ForeColor = Color.Black;
lblDiplomaID.Text = zsbh;
}
else
{
lblDiplomaID.ForeColor = Color.Red;
lblDiplomaID.Text = zsbh;
}
Panel2.Visible = false;
Panel1.Visible = true;
}
private void button2_Click(object sender, System.EventArgs e)
{
Panel2.Visible = true;
Panel1.Visible = false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -