📄 detailform.cs
字号:
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DetailForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "查询信息";
this.Load += new System.EventHandler(this.DetailForm_Load);
this.Closed += new System.EventHandler(this.DetailForm_Closed);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void DetailForm_Load(object sender, System.EventArgs e)
{
if( Query.btnYN ==true)
{
txtConclusion.Visible = true;
//txtConclusion.Enabled = true;
label9.Visible = true;
label9.Enabled = true;
scjgTxt.Visible = false;
scjgTxt.Enabled = false;
scjgLable.Visible = false;
scjgLable.Enabled = false;
pictureBox2.Visible = false;
pictureBox3.Visible = false;
pictureBox4.Visible = false;
}
if(QueryByNewData.btnYN_2 == true)
{
txtConclusion.Visible = false;
txtConclusion.Enabled = false;
label9.Visible = false;
label9.Enabled = false;
scjgTxt.Visible = true;
scjgTxt.Enabled = true;
scjgLable.Visible = true;
scjgLable.Enabled = true;
}
// if((scjgTxt.Visible == true)&&( Query.btnYN == false))
// {
// if(ConfirmSave.scjgCD.Length == 0)
// {
// scjgTxt.Text = "未经审查";
// }
// else
// {
// scjgTxt.Text = ConfirmSave.scjgCD;
// }
// }
}
public static DialogResult ShowForm( string name ,string sex,string bithday,string classOfedu,string diploma,string xz,string yxmc,string zymc,string byjl,string rxrq,string byrq,string zsbh,string shjl,bool isOld)
{
return new DetailForm(name,sex,bithday,classOfedu,diploma,xz,yxmc,zymc,byjl,rxrq,byrq,zsbh,shjl,isOld).ShowDialog( );
}
public static DialogResult ShowForm( string name ,string sex,string bithday,string classOfedu,string diploma,string xz,string yxmc,string zymc,string byjl,string rxrq,string byrq,string zsbh,bool isOld)
{
return new DetailForm(name,sex,bithday,classOfedu,diploma,xz,yxmc,zymc,byjl,rxrq,byrq,zsbh,isOld).ShowDialog( );
}
private void button1_Click(object sender, System.EventArgs e)
{
if( !IsOld )
{
if( MessageBox.Show("您现在要删除数据,请确认操作!","删除数据确认提示!",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes )
{
string delstr = "DELETE FROM education WHERE zsbh='" + txtZsbh.Text.Trim( ) + "'";
db.ExecuteCommandNonQuery( delstr );
MessageBox.Show("删除数据成功!","详细信息操作提示信息",MessageBoxButtons.OK ,MessageBoxIcon.Information );
this.DialogResult = DialogResult.No;
}
}
else
{
MessageBox.Show("您试图对旧数据库进行操作!您只可以对新数据库进行操作","详细信息操作提示信息",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
}
private void txtBirthday_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if( !(( 48 <= e.KeyChar && e.KeyChar <=57 )|| e.KeyChar == 8 ))
{
e.Handled = true;
}
}
private void txtEnrollment_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if( !(( 48 <= e.KeyChar && e.KeyChar <=57 )|| e.KeyChar == 8 ))
{
e.Handled = true;
}
}
private void txtZsbh_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if( !(( 48 <= e.KeyChar && e.KeyChar <=57 )|| e.KeyChar == 8 ))
{
e.Handled = true;
}
}
private void txtGraduation_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if( !(( 48 <= e.KeyChar && e.KeyChar <=57 )|| e.KeyChar == 8 ))
{
e.Handled = true;
}
}
private void pictureBox2_Click(object sender, System.EventArgs e)
{
txtName.Text = txtName.Text.Trim();
txtSex.Text = txtSex.Text.Trim();
// txtBirthday.Text = txtBirthday.Text.Trim();
txtClass.Text = txtClass.Text.Trim();
txtDiploma.Text = txtDiploma.Text.Trim();
txtXz.Text = txtXz.Text.Trim();
txtSchool.Text = txtSchool.Text.Trim();
txtSpecialty.Text = txtSpecialty.Text.Trim();
// txtEnrollment.Text = txtEnrollment.Text.Trim();
// txtGraduation.Text = txtGraduation.Text.Trim();
txtZsbh.Text = txtZsbh.Text.Trim();
InputData.trans.name = txtName.Text;
InputData.trans.sex = txtSex.Text;
if(ByearCheck == "")
{
InputData.trans.birthYear = " ";
InputData.trans.birthMonth = " ";
InputData.trans.birthDay = " ";
}
else
{
InputData.trans.birthYear = dtCsrq.Value.Year.ToString( );
InputData.trans.birthMonth = dtCsrq.Value.Month.ToString( );
InputData.trans.birthDay = dtCsrq.Value.Day.ToString( );
}
InputData.trans.degree = txtClass.Text;
InputData.trans.degreeKind = txtDiploma.Text;
InputData.trans.termYear = txtXz.Text;
InputData.trans.schName = txtSchool.Text;
InputData.trans.schCourse = txtSpecialty.Text;
// string ry = txtEnrollment.Text;
if(RyearCheck == "")
{
InputData.trans.schYear = " ";
InputData.trans.schMonth = " ";
}
else
{
InputData.trans.schYear = dtRxrq.Value.Year.ToString( );
InputData.trans.schMonth = dtRxrq.Value.Month.ToString( );
}
if(GyearCheck == "")
{
InputData.trans.graYear = " ";
InputData.trans.graMonth = " ";
InputData.trans.degreeNum = " ";
}
else
{
InputData.trans.graYear = dtByrq.Value.Year.ToString( );
InputData.trans.graMonth = dtByrq.Value.Month.ToString( ) ;
InputData.trans.degreeNum = txtZsbh.Text;
}
searchprint sch = new searchprint();
sch.ShowDialog();
}
private void pictureBox3_Click(object sender, System.EventArgs e)
{
if( !IsOld )
{
if( MessageBox.Show("您现在要删除数据,请确认操作!","删除数据确认提示!",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes )
{
string delstr = "DELETE FROM education WHERE zsbh='" + txtZsbh.Text.Trim( ) + "'";
db.ExecuteCommandNonQuery( delstr );
MessageBox.Show("删除数据成功!","详细信息操作提示信息",MessageBoxButtons.OK ,MessageBoxIcon.Information );
this.DialogResult = DialogResult.No;
}
}
else
{
MessageBox.Show("您试图对旧数据库进行操作!您只可以对新数据库进行操作","详细信息操作提示信息",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
}
private void pictureBox4_Click(object sender, System.EventArgs e)
{
if( !IsOld )
{
if( MessageBox.Show("您确认要修改数据,请确认操作!","删除数据确认提示!",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) == DialogResult.Yes )
{
string upstring = "UPDATE education SET xb='" + txtSex.Text
+ "',csrq='" + TimeChange.turnTime( dtCsrq.Value )
+ "',pycc='" + txtClass.Text
+ "',xxxs='" + txtDiploma.Text
+ "',xz='" + txtXz.Text
+ "',yxmc='" + txtSchool.Text
+ "',zymc='" + txtSpecialty.Text
+ "',bjyjl='" + txtConclusion.Text
+ "',rxrq='" + TimeChange.turnTime( dtRxrq.Value )
+ "',byrq='" + TimeChange.turnTime( dtByrq.Value )
+ "' WHERE xm='" + txtName.Text
+ "' AND zsbh='" + txtZsbh.Text + "'";
try
{
db.ExecuteCommandNonQuery( upstring );
//对主窗口进行更新的数据
Namem = txtName.Text;
Sex = txtSex.Text;
Birthday = TimeChange.turnTime ( dtCsrq.Value );
Classo = txtClass.Text;
Diploma = txtDiploma.Text;
Xz = txtXz.Text;
Yxmc = txtSchool.Text;
Zymc = txtSpecialty.Text;
Byjl = txtConclusion.Text;
Rxrq = TimeChange.turnTime( dtRxrq.Value );
Byrq = TimeChange.turnTime( dtByrq.Value );
Zsbh = txtZsbh.Text;
Shjg = scjgTxt.Text;
MessageBox.Show("修改数据成功!","详细信息操作提示信息",MessageBoxButtons.OK ,MessageBoxIcon.Information );
this.DialogResult = DialogResult.OK;
}
catch(Exception ee )
{
Console.WriteLine( ee.Message );
}
}
}
else
{
MessageBox.Show("您试图对旧数据库进行操作!您只可以对新数据库进行操作","详细信息操作提示信息",MessageBoxButtons.OK ,MessageBoxIcon.Error );
}
}
private void pictureBox5_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
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 pictureBox5_MouseEnter(object sender, System.EventArgs e)
{
pictureBox5.Image = Image.FromFile( "img\\button-返回02.GIF" );
}
private void pictureBox5_MouseLeave(object sender, System.EventArgs e)
{
pictureBox5.Image = Image.FromFile( "img\\button-返回01.GIF" );
}
private void pictureBox3_MouseEnter_1(object sender, System.EventArgs e)
{
pictureBox3.Image = Image.FromFile( "img\\button-删除02.GIF" );
}
private void pictureBox3_MouseLeave_1(object sender, System.EventArgs e)
{
pictureBox3.Image = Image.FromFile( "img\\button-删除01.GIF" );
}
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 DetailForm_Closed(object sender, System.EventArgs e)
{
Query.btnYN = false;
QueryByNewData.btnYN_2 = false;
RyearCheck = "1";
ByearCheck = "1";
GyearCheck = "1";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -