private void button2_Click(object sender, EventArgs e) { this.Close(); AuthPage auth = new AuthPage(); auth.Show(); }
public static string GetName(int id) { string conString = "Data source = MANUCHO; initial catalog=MTUCI; integrated security=true"; SqlConnection connection = new SqlConnection(conString); string result = null; try { connection.Open(); SqlCommand command = connection.CreateCommand(); command.CommandText = "use MTUCI"; var auth = new AuthPage(); command.CommandText = $"select * from Users where Id = {id}"; SqlDataReader Reader = command.ExecuteReader(); while (Reader.Read()) { result = (string)Reader["FirstName"]; connection.Close(); return(result); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(result); }
private void button1_Click(object sender, EventArgs e) { //need to add pass change in DB this.Close(); AuthPage auth = new AuthPage(); auth.Show(); }
private void loginBtn_Click(object sender, EventArgs e) { string user = loginTxtbx.Text; string pass = passwordTxtbx.Text; int isInBase = IsInBase(user, pass); if (isInBase > 0) { MessageBox.Show($"Здравствуй {GetName(isInBase)}"); AuthPage auth = new AuthPage(); auth.Show(); this.Hide(); } else { MessageBox.Show("Неверный ввод!"); } }