private void button1_Click(object sender, EventArgs e)
        {
            bool actE  = Encriptar.CompararMD5(textBox1.Text, comboBox1.SelectedValue.ToString());
            bool newE  = textBox2.Text.Equals(textBox3.Text);
            bool newCV = textBox2.Text.Length > 0;

            if (actE && newE && newCV)
            {
                try
                {
                    U.actPassword(comboBox1.Text, Encriptar.CrearMD5(textBox2.Text));

                    MessageBox.Show("SE HA ACTUAIZADO LA CONTRASEÑA",
                                    "PreParcial1", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Close();
                }
                catch (Exception)
                {
                    MessageBox.Show("NO SE PUDO ACTUALIZAR LA CONTRASEÑA",
                                    "PreParcial1", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("ERROR DATOS INCORRECTOS",
                                "PreParcial1", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (Encriptar.CompararMD5(textBox2.Text, cmbUser.SelectedValue.ToString()))
            {
                User u = (User)cmbUsers.SelectedItem;
                if (u.activo)
                {
                    MessageBox.Show("BIEVENIDO",
                                    "PreParcial1", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    Menu ventana = new Menu(u);
                    ventana.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("ERRO",
                                    "PreParcial1", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("CONTRASEÑA INCORRECTA", "PreParcial1",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }