private void linkLabel1_MouseClick(object sender, MouseEventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=Inst_JoseCelilioValle;Integrated Security=True");

            conn.Open();

            string usuario = txtUser.Text;

            string qry = string.Format("select * from Empleado where usr_empleado = '{0}'", usuario);

            SqlCommand    cmd  = new SqlCommand(qry, conn);
            SqlDataReader lect = cmd.ExecuteReader();

            if (txtUser.Text.Trim() == "")
            {
                MessageBox.Show("debe de ingresar al menos su usuario", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (lect.Read())
                {
                    pwdOlvidada pass = new pwdOlvidada();
                    pass.user = txtUser.Text;
                    pass.Show();
                }
                else
                {
                    MessageBox.Show("No se encontro el usuario ingresado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            lect.Close();
            conn.Close();
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();


            if (txtconfirmNewContra.Text != txtNewContra.Text)
            {
                MessageBox.Show("Contraseñas incorrectas", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (txtconfirmNewContra.TextLength < 8 || txtNewContra.TextLength < 8)
                {
                    MessageBox.Show("La contraseña debe contener al menos 8 caracteres");
                }
                else
                {
                    SqlConnection conn      = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=Inst_JoseCelilioValle;Integrated Security=True");
                    pwdOlvidada   pass      = new pwdOlvidada();
                    Class1        cl        = new Class1();
                    string        encrypted = cl.Encrypt(txtNewContra.Text);

                    string qry = string.Format("update Empleado set [pwd_empleado] = '{0}' where usr_empleado = '{1}'", encrypted, user);

                    SqlCommand cmd = new SqlCommand(qry, conn);
                    cmd.Connection.Open();
                    var command = cmd.ExecuteNonQuery();

                    string     qryBloq = "update Empleado set codigo_estado = 1 where usr_empleado = '" + user + "'";
                    SqlCommand cmd2    = new SqlCommand(qryBloq, conn);
                    cmd2.ExecuteNonQuery();

                    string     qryBloq2 = "update Empleado set intentos = 0 where usr_empleado = '" + user + "'";
                    SqlCommand cmd3     = new SqlCommand(qryBloq2, conn);
                    cmd3.ExecuteNonQuery();

                    MessageBox.Show("Cambio de contraseña realizado, porfavor inicie sesion de nuevo.", "Confirmado", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();


                    conn.Close();
                }
            }
        }