Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     gl.myclos();
     sql2 = null;
     comboBox1.Items.Clear();
     comboBox2.Items.Clear();
     textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = textBox6.Text = "";
 }
Example #2
0
        private void setDepartment()
        {
            string sql1 = "select * from department_info where id=@id ";

            Dictionary <string, Object> dic = new Dictionary <string, Object>();

            dic.Add("@id", de.getId());
            ArrayList al = new ArrayList();

            al = sqlHelper.SelectInfo(sql1, dic);
            if (al != null && al.Count > 0)//判断是有该数据
            {
                foreach (Object[] obj in al)
                {       //得到几行数据就能产生多少个对象
                    de.setId((int)obj[0]);
                    de.setName((string)obj[1]);
                    de.setBasis((int)obj[2]);
                }
                comboBox1.Text = Convert.ToString(de.getId());
                textBox1.Text  = de.getName();
                textBox2.Text  = Convert.ToString(de.getBasis());
                if (sql2 == null)
                {
                    sql2 = "select id from department_info ";
                    al   = sqlHelper.SelectInfo(sql2, dic);
                    if (al != null && al.Count > 0)
                    {
                        foreach (Object[] obj in al)
                        {       //得到几行数据就能产生多少个对象
                            comboBox1.Items.Add((int)obj[0]);
                        }
                    }
                    else
                    {
                        MessageBox.Show("没有数据,请添加!", "提示");
                    }
                }
            }
            else
            {
                MessageBox.Show("该部门可能已被删除!", "提示");

                gl.myclos();
                sql2 = null;
                comboBox1.Items.Clear();
            }
        }
Example #3
0
 private void button1_Click(object sender, EventArgs e)//关闭
 {
     gl.myclos();
     setzt();
 }
Example #4
0
 private void button2_Click(object sender, EventArgs e)
 {
     guanli.myclos();
 }
Example #5
0
      private void setDepartment()
      {  //
          string sql1 = "select * from staff_info where id=@id ";

          Dictionary <string, Object> dic = new Dictionary <string, Object>();

          dic.Add("@id", st.getId());
          ArrayList al = new ArrayList();

          al = sqlHelper.SelectInfo(sql1, dic);
          if (al != null && al.Count > 0)  //判断是有该数据
          {
              foreach (Object[] obj in al)
              {         //得到几行数据就能产生多少个对象
                  st.setId((int)obj[0]);
                  st.setName((string)obj[1]);
                  st.setDepartment_id((int)obj[2]);
                  st.setPassword((String)obj[3]);
                  st.setSex((string)obj[4]);
                  st.setAge((int)obj[5]);
                  st.setTime((DateTime)obj[6]);
                  st.setPost((string)obj[7]);
              }
              comboBox1.Text = Convert.ToString(st.getId());
              textBox1.Text  = st.getName();
              textBox2.Text  = st.getPassword();
              textBox3.Text  = Convert.ToString(st.getAge());
              textBox4.Text  = st.getPost();
              comboBox3.Text = st.getSex();
              label9.Text    = st.getTime();
              foreach (ComboxItem c in comboBox2.Items)
              {
                  if (c.Values == st.getDepartment_id())
                  {
                      comboBox2.Text = c.Text;
                      break;
                  }
              }
              if (sql2 == null)
              {
                  sql2 = "select id from staff_info ";
                  al   = sqlHelper.SelectInfo(sql2, dic);
                  if (al != null && al.Count > 0)
                  {
                      foreach (Object[] obj in al)
                      {         //得到几行数据就能产生多少个对象
                          comboBox1.Items.Add((int)obj[0]);
                      }
                  }
                  else
                  {
                      MessageBox.Show("没有数据,请添加!", "提示");
                  }
              }
          }
          else
          {
              MessageBox.Show("该员工可能已被删除!", "提示");

              gl.myclos();
              sql2 = null;
              comboBox1.Items.Clear();
          }
      }