private void сброситьПарольToolStripMenuItem_Click(object sender, EventArgs e) { string alhp = "qwertyuiopasdfghjklzxcvbnm"; Random random = new Random(); string pass = alhp[random.Next(25)].ToString() + alhp[random.Next(25)].ToString() + alhp[random.Next(25)].ToString() + alhp[random.Next(25)].ToString() + alhp[random.Next(25)].ToString(); пользователиDataGridView.CurrentRow.Cells[3].Value = DataBaseCenter.HashPass(pass); MessageBox.Show("Новый пароль " + pass, "Оповещение"); }
private void button1_Click(object sender, EventArgs e) { DataBaseCenter dataBaseCenter = DataBaseCenter.Create(); if (dataBaseCenter.Autorization(user.login, textBox1.Text) != null) { if (textBox2.Text == textBox3.Text) { if (0 < dataBaseCenter.RunCommand(string.Format("UPDATE пользователи SET пароль='{1}' WHERE id='{0}'", user.id, DataBaseCenter.HashPass(textBox2.Text)))) { MessageBox.Show("Пароль изменен", "Оповещение"); } else { MessageBox.Show("Пароль изменить не удалось!", "Ошибка"); }; } else { MessageBox.Show("Новые пароли не совпадают!", "Ошибка"); } } else { MessageBox.Show("Старый пароль неверный!", "Ошибка"); }; }