Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region 旧方法

            /*string sql = "select *from staffmessage where jobID='" + textBox9.Text + "'and name='" + textBox8.Text + "'";
             *  Dao dao = new Dao();
             *  IDataReader dr = dao.read(sql);
             *  if (dr.Read())
             *  {
             *      string a, b, c, d,f,g;
             *
             *      a = dr["gender"].ToString();
             *      b = dr["age"].ToString();
             *      c = dr["hireyear"].ToString();
             *      d = dr["post"].ToString();
             *      f = dr["seniorty"].ToString();
             *      g = dr["password"].ToString();
             *      textBox1.Text = c;
             *      textBox3.Text = a;
             *      textBox4.Text = b;
             *      textBox5.Text = d;
             *      textBox6.Text = f;
             *      textBox7.Text = g;
             *  }
             *  else
             *  {
             *      MessageBox.Show("未查询到该员工,请重试!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             *  }*/
            #endregion
            if (sm.CheckStaffIsExistsByJobIDandName(textBox1.Text.Trim(), textBox2.Text.Trim()))
            {
                textBox3.Text = sm.GetStaffmessageByJobID(textBox1.Text.Trim()).Age.ToString();
                textBox4.Text = sm.GetStaffmessageByJobID(textBox1.Text.Trim()).Gender.ToString();
                textBox5.Text = sm.GetStaffmessageByJobID(textBox1.Text.Trim()).Post.ToString();
                textBox6.Text = sm.GetStaffmessageByJobID(textBox1.Text.Trim()).Seniorty.ToString();
                textBox7.Text = sm.GetStaffmessageByJobID(textBox1.Text.Trim()).Password.ToString();
                textBox8.Text = sm.GetStaffmessageByJobID(textBox1.Text.Trim()).Hireyear.ToString();
            }
            else
            {
                MessageBox.Show("未查询到该员工,请重试!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            #region 旧方法

            /*
             *  jobid = textBox2.Text;
             *  string sql = "select * from staffmessage where name='"+textBox1.Text+"'and jobID='"+textBox2.Text +"'";
             *  Dao dao = new Dao();
             *  IDataReader dr = dao.read(sql);
             *  if (dr.Read())
             *  {
             *      Form4_2 form4_2 = new Form4_2(jobid);
             *      form4_2.Show();
             *      this.Hide();
             *  }
             *
             *  else
             *  {
             *      MessageBox.Show("未查询到该员工,请重新确认工号和姓名!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             *      textBox1.Text = null;
             *      textBox2.Text = null;
             *  }*/
            #endregion
            jobid = textBox2.Text;
            if (sm.CheckStaffIsExistsByJobIDandName(textBox2.Text.Trim(), textBox1.Text.Trim()))
            {
                Form4_2 form4_2 = new Form4_2(jobid);
                form4_2.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("未查询到该员工,请重新确认工号和姓名!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox1.Text = null;
                textBox2.Text = null;
            }
        }