📄 inputdata.cs
字号:
{
lblGraduation.Tag = "false";
}
else
{
if( onlyOne.GraduationTime == TimeChange.turnTime( dtByrq.Value ) )
{
lblGraduation.Tag = "true";
lblGraduation.ForeColor = Color.Black;
lblGraduation.Text = onlyOne.GraduationTime;
// lblGraduation.Text = DateTime.Parse(TimeChange.ChangeForm(onlyOne.GraduationTime)).ToLongDateString( );
}
else
{
lblGraduation.Tag = "false";
lblGraduation.ForeColor = Color.Red;
lblGraduation.Text = onlyOne.GraduationTime;
// lblGraduation.Text = DateTime.Parse(TimeChange.ChangeForm(onlyOne.GraduationTime)).ToLongDateString( );
}
}
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;
}
NoQuery = false;
}
//没有查到
else if( otherPeople.Count == 0 )
{
Panel2.Visible = false;
Panel1.Visible = true;
MessageBox.Show("查无此人","查询提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Error );
this.Focus( );
return;
}
//符合条件的有多个
else
{
NoQuery = false;
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( );
if( i%2 == 0 )
{
first.BackColor = Color.SkyBlue;
}
first.Text = (i+1).ToString( );
first.SubItems.Add( 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 );
}
pictureBox4.Enabled = true;
}
}
pictureBox3.Enabled = true;
}
catch
{
MessageBox.Show( "所需查找数据表不存在,请重新设置源数据库" ,"查询错误提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
if ( fbdd.ShowDialog( ) == DialogResult.OK )
{
Config.SetPath ( fbdd.SelectedPath );
MessageBox.Show( "源数据库设置成功!","修改提示",MessageBoxButtons.OK ,MessageBoxIcon.Warning );
}
else
{
MessageBox.Show( "你还没有设置源数据库位置!不可以进行查询", "修改提示",MessageBoxButtons.OK ,MessageBoxIcon.Warning );
}
}
}
private void pictureBox2_MouseEnter(object sender, System.EventArgs e)
{
pictureBox2.Image = Image.FromFile( "img\\button-保存02.GIF" );
}
private void pictureBox2_MouseLeave(object sender, System.EventArgs e)
{
pictureBox2.Image = Image.FromFile( "img\\button-保存01.GIF" );
}
private void pictureBox2_Click(object sender, System.EventArgs e)
{
bool ok = tbXm.Text.Trim( ).Length != 0 && cbPycc.Text.Trim( ) != "请选择或输入新项" && cbXXXs.Text.Trim( ) != "请选择或输入新项" && tbXz.Text.Trim( ).Length != 0 && tbYxmc.Text.Trim( ).Length != 0 && tbZymc.Text.Trim( ).Length != 0 && tbZsbh.Text.Trim( ).Length != 0 ;
if ( !ok )
{
MessageBox.Show( "请填写全部信息!","存储信息提示框",MessageBoxButtons.OK,MessageBoxIcon.Information );
this.Focus( );
return;
}
string tempXm = tbXm.Text.Trim( );
string tempXb = rb1.Checked ? "男" : "女";
string tempCsrq = tbBirth.Text.Trim( );
string tempPycc = cbPycc.Text.Trim( );
string tempXXXs = cbXXXs.Text.Trim( );
string tempXz = tbXz.Text.Trim( );
string tempYxmc = tbYxmc.Text.Trim( );
string tempZymc = tbZymc.Text.Trim( );
string tempRxrq = TimeChange.turnTime( dtRxrq.Value );
string tempZsbh = tbZsbh.Text.Trim( );
string sqlString = "SELECT * FROM education WHERE xm='" + tempXm + "' AND zsbh='" + tempZsbh + "'";
try
{
DataSet ds = db.ExecuteCommand( sqlString );
if (ds.Tables[0].Rows.Count == 1 )
{
//新库里有查询数据的话,弹出窗口显示
MessageBox.Show("新数据库已有查询的数据,请查看","存储信息提示框",MessageBoxButtons.OK,MessageBoxIcon.Information );
this.Focus( );
return ;
}
}
catch(Exception ee)
{
string gg = ee.Message;
}
ConfirmSave tempCs = new ConfirmSave( );
DialogResult tp = tempCs.ShowDialog( );
if ( tp == DialogResult.OK )
{
stuState = ConfirmSave.hasPass;
People tempPeople = new People( tempXm , tempXb,tempCsrq,tempPycc,tempXXXs,tempXz,tempYxmc,tempZymc,GetBjyjl( ),tempRxrq,TimeChange.turnTime( dtByrq.Value ),tempZsbh,true);
SaveRecord sr = new SaveRecord( tempPeople );
if ( sr.Save( ) )
{
MessageBox.Show( "已存储到查询数据表中!","存储信息提示框",MessageBoxButtons.OK,MessageBoxIcon.Information );
this.Focus( );
}
else
{
MessageBox.Show( " 存储失败!" );
this.Focus( );
}
}
}
private void pictureBox3_MouseEnter(object sender, System.EventArgs e)
{
pictureBox3.Image = Image.FromFile( "img\\button-打印02.GIF" );
}
private void pictureBox3_MouseLeave(object sender, System.EventArgs e)
{
pictureBox3.Image = Image.FromFile( "img\\button-打印01.GIF" );
}
private void pictureBox3_Click(object sender, System.EventArgs e)
{
tbXm.Text = tbXm.Text.Trim();
// tbCsrq.Text = tbCsrq.Text.Trim();
cbPycc.Text = cbPycc.Text.Trim();
cbXXXs.Text = cbXXXs.Text.Trim();
tbYxmc.Text = tbYxmc.Text.Trim();
tbXz.Text = tbXz.Text.Trim();
tbZymc.Text = tbZymc.Text.Trim();
// tbRxrq.Text = tbRxrq.Text.Trim();
// tbByrq.Text = tbByrq.Text.Trim();
tbZsbh.Text = tbZsbh.Text.Trim();
if((tbXm.Text.Length == 0)||(cbPycc.Text.Length == 0)||(cbXXXs.Text.Length ==0)
||(tbYxmc.Text.Length == 0)||(tbXz.Text.Length == 0)||(tbZymc.Text.Length == 0)
||(tbZsbh.Text.Length == 0)||((rb1.Checked==false)&&(rb2.Checked ==false)))
{
MessageBox.Show("请输入全部信息!");
//pictureBox3.Enabled = false;
this.Focus( );
return;
}
//pictureBox3.Enabled = false;
trans.name = tbXm.Text.Trim();
//
// trans.birthYear = dtCsrq.Value.Year.ToString( );
// //string i = tbCsrq.Text;
//// by = by.Remove(0,4);//日期的处理
// trans.birthMonth = dtCsrq.Value.Month.ToString( );
// trans.birthDay = dtCsrq.Value.Day.ToString( );
tbBirth.Text = tbBirth.Text.Trim();
if(tbBirth.Text.Length == 0)
{
trans.birthYear = "****" ;
trans.birthMonth = "**";
trans.birthDay = "**";
}
if(tbBirth.Text.Length == 8)
{
trans.birthYear = tbBirth.Text.Remove(4,4);
string by = tbBirth.Text;
by = by.Remove(0,4);
trans.birthMonth = by.Remove(2,2);
trans.birthDay = by.Remove(0,2);
}
if(tbBirth.Text.Length == 6)
{
trans.birthYear = tbBirth.Text.Remove(4,2);
trans.birthMonth = tbBirth.Text.Remove(0,4);
trans.birthDay = "**";
}
if((tbBirth.Text.Length > 8)||(tbBirth.Text.Length == 7))
{
MessageBox.Show("请按照类似格式输入“19810806”或“198108”");
}
trans.degree = cbPycc.Text.Trim();
trans.degreeKind = cbXXXs.Text.Trim();
trans.schName = tbYxmc.Text.Trim();
trans.termYear = tbXz.Text.Trim();
trans.schCourse = tbZymc.Text.Trim();
// string gy = tbByrq.Text;
trans.graYear = dtByrq.Value.Year.ToString( );
// gy = gy.Remove(0,4);//日期的处理
trans.graMonth = dtByrq.Value.Month.ToString( );
trans.degreeNum = tbZsbh.Text;
// string ry = tbRxrq.Text;
trans.schYear = dtRxrq.Value.Year.ToString( );
// ry = ry.Remove(0,4);
trans.schMonth = dtRxrq.Value.Month.ToString( );
if(rb1.Checked == true)
{
trans.sex = "男";
}
else
{
trans.sex = "女";
}
InputPrint print = new InputPrint();
print.ShowDialog();
}
private void pictureBox4_MouseEnter(object sender, System.EventArgs e)
{
pictureBox4.Image = Image.FromFile( "img\\button-查看多条信息02.GIF" );
}
private void pictureBox4_MouseLeave(object sender, System.EventArgs e)
{
pictureBox4.Image = Image.FromFile( "img\\button-查看多条信息01.GIF" );
}
private void pictureBox4_Click(object sender, System.EventArgs e)
{
Panel2.Visible = true;
Panel1.Visible = false;
}
private void lblBirthday_MouseEnter(object sender, System.EventArgs e)
{
}
private void lblBirthday_Click(object sender, System.EventArgs e)
{
tbBirth.Text = lblBirthday.Text.Trim( );
}
private void lblSex_Click(object sender, System.EventArgs e)
{
if( lblSex.Text.Trim( ) == "男" )
{
rb1.Checked = true;
}
else
{
rb2.Checked = true;
}
}
private void lblClass_Click(object sender, System.EventArgs e)
{
cbPycc.Text = lblClass.Text.Trim( );
}
private void lblSchool_Click(object sender, System.EventArgs e)
{
tbYxmc.Text = lblSchool.Text.Trim( );
}
private void lblSystem_Click(object sender, System.EventArgs e)
{
tbXz.Text = lblSystem.Text.Trim( );
}
private void lblSpecialty_Click(object sender, System.EventArgs e)
{
tbZymc.Text = lblSpecialty.Text.Trim( );
}
private void lblDiplomaID_Click(object sender, System.EventArgs e)
{
tbZsbh.Text = lblDiplomaID.Text.Trim( );
}
private void lblEnrollment_Click(object sender, System.EventArgs e)
{
if ( lblEnrollment.Text.Trim( ).Length == 0 )
{
MessageBox.Show("无入学日期,将设置为默认值" );
}
if( lblEnrollment.Text.Trim( ).Length == 6 )
{
MessageBox.Show("错误日期格式,请手动设置" );
}
else if( lblEnrollment.Text.Trim( ).Length == 8 )
{
dtRxrq.Value = DateTime.Parse(TimeChange.ChangeForm( lblEnrollment.Text.Trim( ) ) );
}
else
{}
}
private void lblGraduation_Click(object sender, System.EventArgs e)
{
if ( lblGraduation.Text.Trim( ).Length == 0 )
{
MessageBox.Show("无入学日期,将设置为默认值" );
}
else if( lblGraduation.Text.Trim( ).Length == 6 )
{
MessageBox.Show("错误日期格式,请手动设置" );
}
else if( lblGraduation.Text.Trim( ).Length == 8 )
{
dtByrq.Value = DateTime.Parse(TimeChange.ChangeForm( lblGraduation.Text.Trim( ) ) );
}
else
{}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -