コード例 #1
0
 private void DOIMAK()
 {
     DataRow[] r = TK.Select("MANV='" + tbxmanhanvien.Text + "'");
     if (r.Count() > 0)
     {
         r[0]["MATKHAU"] = tbxmatkhau.Text;
         TK.ghi();
         if (TK.ghi() == true)
         {
             MessageBox.Show("Mật khẩu đã được đổi");
         }
     }
 }
コード例 #2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (tbxmanhanvien.Text == "" || tbxhoten.Text == "" || tbxmatkhau.Text == "" || tbxnhaplaimatkhau.Text == "" | tbxtendangnhap.Text == "")
            {
                c = 1;
                MessageBox.Show("Thông tin yêu cầu chưa nhập đầy đủ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //DataRow[] u = tbnhanvien.Select("MANV='" + tbxmanhanvien.Text + "'");
            //DataRow[] d = tbnhanvien.Select("HOTENNV='" + tbxhoten.Text + "'");
            //if (u.Count() == 0 || d.Count() == 0)
            //{
            //    c = 1;
            //    MessageBox.Show("Mã nhân viên hoặc họ tên không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}
            if (c == 0 && check() == true)
            {
                int     a = 0;
                DataRow r = tk.NewRow();
                r["MANV"]     = tbxmanhanvien.Text;
                r["TENNV"]    = tbxhoten.Text;
                r["USERNAME"] = tbxtendangnhap.Text;
                checkmk(a);
                if (a == 0)
                {
                    r["MATKHAU"] = tbxmatkhau.Text;
                }
                tk.Rows.Add(r);
                tk.ghi();
            }
        }
コード例 #3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (tbxmanhanvien.Text == "" || tbxhoten.Text == "" || tbxtendangnhap.Text == "")
            {
                c = 1;
                MessageBox.Show("Thông tin yêu cầu chưa nhập đầy đủ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //DataRow[] u = tbnhanvien.Select("MANV='" + tbxmanhanvien.Text + "'");
            //DataRow[] d = tbnhanvien.Select("HOTENNV='" + tbxhoten.Text + "'");
            //if (u.Count() == 0 || d.Count() == 0)
            //{
            //    c = 1;
            //    MessageBox.Show("Mã nhân viên hoặc họ tên không tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}
            if (c == 0 && check() == true)
            {
                int     a = 0;
                DataRow r = tk.NewRow();
                r["MANV"]        = tbxmanhanvien.Text;
                r["TENNV"]       = tbxhoten.Text;
                r["USERNAME"]    = tbxtendangnhap.Text;
                r["MAPHANQUYEN"] = DBNull.Value;
                errorProvider1.SetError(tbxmatkhau, "");
                errorProvider1.SetError(tbxnhaplaimatkhau, "");
                if (tbxmatkhau.Text.Length < 8 || (tbxmatkhau.Text.Any(char.IsDigit) == false) || (tbxmatkhau.Text.Any(char.IsLower) == false) || (tbxmatkhau.Text.Any(char.IsUpper) == false))
                {
                    errorProvider1.SetError(tbxmatkhau, "Mật khẩu mới gồm 8 kí tự,gồm chữ số," + "in hoa in thường");
                    a = 1;
                    return;
                }
                if (tbxmatkhau.Text != tbxnhaplaimatkhau.Text)
                {
                    errorProvider1.SetError(tbxnhaplaimatkhau, "Mật khẩu nhập lại không trùng");
                    a = 2;
                    return;
                }
                if (a == 0)
                {
                    r["MATKHAU"] = tbxmatkhau.Text;
                    tk.Rows.Add(r);
                    try
                    {
                        if (tk.ghi())
                        {
                            MessageBox.Show("Chúc mừng bạn đăng ký thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (SqlException ex)
                    {
                        MessageBox.Show(ex.ToString(), "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
コード例 #4
0
      private void DOIMAK()
      {
          int t = 0;

          DataRow[] r = TK.Select("MANV='" + Bang.Bang.manhanvien + "'");
          DataRow[] d = TK.Select("MATKHAU='" + tbxmatkhau.Text + "'");
          if (d.Count() >= 1)
          {
              MessageBox.Show("Mật khẩu mới trùng mật khẩu cũ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
              t = 1;
          }
          if (r.Count() > 0 && t == 0)
          {
              r[0]["MATKHAU"] = tbxmatkhau.Text;
              if (TK.ghi() == true)
              {
                  MessageBox.Show("Mật khẩu đã được đổi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
              }
          }
      }