123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using Servise.Classes;
- using System;
- using System.Data.SqlClient;
- using System.Windows.Forms;
- namespace Servise.Forms.User
- {
- public partial class edpass : Form
- {
- DataBase conect = new DataBase();
- public edpass()
- {
- InitializeComponent();
- }
- private void edpass_Load(object sender, EventArgs e)
- {
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- //Проверка пароля и сохранение в БД
- private void EditPas_Click(object sender, EventArgs e)
- {
- if (textBox1.Text == textBox2.Text || textBox1.Text == textBox3.Text)
- {
- if (textBox1.Text == UserInform.Password)
- {
- if (textBox2.Text == textBox3.Text)
- {
- var indert = "update employees set password= '" + textBox2.Text.GetHashCode() + "' where login ='" + UserInform.Login + "'";
- var command = new SqlCommand(indert, conect.getConect());
- command.ExecuteNonQuery();
- UserInform.Password = textBox3.Text.Trim();
- this.Hide();
- Users goUser = new Users();
- goUser.Show();
- }
- else
- {
- MessageBox.Show("Пароли не совпадают");
- }
- }
- else
- {
- MessageBox.Show("Старый пароль указан не верно");
- }
- }
- else
- {
- MessageBox.Show("Старый пароль одинаков со старым");
- }
- }
- private void edpass_FormClosed(object sender, FormClosedEventArgs e)
- {
- Application.Exit();
- }
- }
- }
|