form2.Denglulx = Helper01.D_read[\登录类型\
xiugaimima.YgMima = Helper01.D_read[\员工密码\ form2 mdi = new form2(); Helper01.con.Close(); this.Hide(); mdi.Show(); } else {
MessageBox.Show(\用户名、密码错误或者登录类型错误\ textBox1.Text = \ textBox2.Text = \ textBox1.Focus(); } }
private void textBox1_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyCode == Keys.Enter) textBox2.Focus(); }
2、管理员查询的实现
private void button5_Click(object sender, EventArgs e)//查询 {
label52.Text = label53.Text = label51.Text = \ Helper01.con = new SqlConnection(Form1.constr); Helper01.con.Open();
if (radioButton1.Checked == true) {
string strCx = \* from YuangongInfo,BumenInfo,GongziInfo,KaoqingInfo where YuangongInfo.员工编号='\+ textBox20.Text + \
strCx += \员工编号='\+ textBox20.Text + \and GongziInfo.员工编号='\员工编号='\+ \
Helper01.cmd = new SqlCommand(strCx, Helper01.con); Helper01.D_read = Helper01.cmd.ExecuteReader(); if (Helper01.D_read.Read()) {
textBox21.Text = textBox1.Text = label32.Text = label44.Text = label19.Text = Helper01.D_read[\员工编号\
textBox22.Text = textBox2.Text = label20.Text = label33.Text =
30
label45.Text = Helper01.D_read[\员工姓名\
textBox6.Text = label21.Text = Helper01.D_read[\工种编号\
textBox3.Text = Helper01.D_read[\性别\
textBox4.Text = Helper01.D_read[\所在部门\ textBox5.Text = Helper01.D_read[\所属工种\ textBox15.Text = Helper01.D_read[\基本工资\
textBox16.Text = textBox14.Text = Helper01.D_read[\加班工资\
textBox11.Text = textBox17.Text = Helper01.D_read[\扣除工资\
Inta=Convert.ToInt16(textBox15.Text)+Convert.ToInt16(textBox14.Text)-Convert.ToInt16(textBox11.Text);
textBox18.Text = a.ToString();
textBox19.Text = textBox12.Text = textBox8.Text = Helper01.D_read.GetDateTime(22).ToShortDateString();//转换为日期格式
textBox29.Text = Helper01.D_read.GetDateTime(30).ToShortDateString().ToString();//考勤所在月份
textBox23.Text = Helper01.D_read[\上班天数\
textBox24.Text = Helper01.D_read[26].ToString();//本月加班天数 textBox27.Text = Helper01.D_read[27].ToString();//本月缺勤天数 textBox25.Text = Helper01.D_read[\考勤记录\考勤记录 textBox26.Text = Helper01.D_read[\考勤时间\考勤时间 textBox13.Text = Helper01.D_read[\加班天数\ textBox9.Text = Helper01.D_read[\请假类型\ textBox10.Text = Helper01.D_read[\缺勤天数\ textBox7.Text = Helper01.D_read[\员工备注\ label22.ForeColor = Color.Green; label22.Text = \查询成功!\ Helper01.con.Close(); } else {
label22.ForeColor = Color.Red;
label22.Text = \请输入正确的员工编号!\ textBox20.Text = \ textBox20.Focus(); } } 3、管理员修改的实现
private void button6_Click(object sender, EventArgs e)//修改
31
{ try {
Helper01.con = new SqlConnection(Form1.constr); Helper01.con.Open();
string XiugaiStr2 = \YuangongInfo set 员工姓名='\+ textBox2.Text.Trim() + \
XiugaiStr2 += \所在部门='\ XiugaiStr2 += \所属工种='\
XiugaiStr2 += \性别='\+ textBox3.Text.Trim() + \from YuangongInfo,GongziInfo,BumenInfo,KaoqingInfo \
XiugaiStr2 += \员工编号='\+ textBox1.Text + \and BumenInfo.员工编号='\员工编号='\and KaoqingInfo.员工编号='\
XiugaiStr2 += \BumenInfo set 工种编号='\+ textBox6.Text.Trim() + \员工姓名='\
XiugaiStr2 += \ XiugaiStr2 += \员工编号='\+ textBox1.Text + \and BumenInfo.员工编号='\员工编号='\and KaoqingInfo.员工编号='\
XiugaiStr2 += \加班天数='\+ \缺勤天数='\
XiugaiStr2 += \加班工资='\+ textBox14.Text.Trim() + \请假类型='\+ textBox9.Text.Trim() + \员工姓名='\
XiugaiStr2 += \扣除工资='\+ textBox11.Text.Trim() + \员工备注='\+ textBox7.Text.Trim() + \所在月份='\
XiugaiStr2 += \基本工资='\+ textBox15.Text.Trim() + \总工资='\+ textBox18.Text.Trim() + \
XiugaiStr2 += \员工编号='\+ textBox1.Text + \and BumenInfo.员工编号='\员工编号='\and KaoqingInfo.员工编号='\
XiugaiStr2 += \员工姓名='\+ \上班天数='\+ textBox23.Text.Trim() + \KaoqingInfo.加班天数='\+ textBox24.Text.Trim() + \
XiugaiStr2 += \缺勤天数='\考勤记录='\考勤时间='\
XiugaiStr2 += \所在月份='\YuangongInfo,GongziInfo,BumenInfo,KaoqingInfo \
XiugaiStr2 += \员工编号='\+ textBox1.Text + \and BumenInfo.员工编号='\员工编号='\and KaoqingInfo.员工编号='\
Helper01.cmd = new SqlCommand(XiugaiStr2, Helper01.con); Helper01.cmd.ExecuteNonQuery();
textBox8.Text = textBox12.Text = textBox19.Text;
label32.Text = label44.Text = label19.Text = textBox1.Text;//员工编号
32
label20.Text = label33.Text = label45.Text = textBox2.Text;//员工姓名 label21.Text = textBox6.Text;//工种编号 label22.ForeColor = Color.Green; label22.Text = \修改成功!\ Helper01.con.Close(); }
catch (Exception t) {
MessageBox.Show(t.Message); } }
33