private void Admin_Load(object sender, EventArgs e) { DB db = new DB(); SQLiteCommand command = new SQLiteCommand("SELECT password FROM users WHERE login = @uL", db.getConnection()); command.Parameters.AddWithValue("@uL", "admin").Size = 50; db.openConnection(); string result = command.ExecuteScalar().ToString(); if (result == "admin") { DialogResult dr = new DialogResult(); PassChange passChange = new PassChange(); passChange.username = "******"; while (dr != DialogResult.OK || command.ExecuteScalar().ToString() == "admin") { dr = passChange.ShowDialog(); } } db.closeConnection(); }
private void bLogin_Click(object sender, EventArgs e) { string loginUser = tbLogin.Text; string passwordUser = tbPassword.Text; FirstOpen firstOpen = new FirstOpen(); firstOpen.CreateUsersIfNotExit(); PassChange passChange = new PassChange(); if (passChange.CheckPass(loginUser, passwordUser) == false) { MessageBox.Show("Ошибка в пароле или логине"); return; } this.Hide(); if (loginUser != "admin") { TextEncrypter textEncrypter = new TextEncrypter(); textEncrypter.username = tbLogin.Text; textEncrypter.admin = false; textEncrypter.Show(); return; } else { Admin admin = new Admin(); this.Hide(); admin.Show(); return; } }
private void lChangePass_Click(object sender, EventArgs e) { PassChange passChange = new PassChange(); passChange.username = "******"; passChange.Show(); }