private void loginButton_Click(object sender, EventArgs e) { connection.Open(); SqlCommand login = new SqlCommand(loginQuery, connection); login.Parameters.AddWithValue("@user", usernameTextbox.Text); login.Parameters.AddWithValue("@pass", passwordTextbox.Text); if (login.ExecuteScalar().ToString() == "1") { SqlCommand loginUser = new SqlCommand(getUser, connection); loginUser.Parameters.AddWithValue("@user", usernameTextbox.Text); using (var reader = loginUser.ExecuteReader()) { while (reader.Read()) { userId = (int)reader[0]; } } accountMain am = new accountMain(userId); am.Location = this.Location; am.Show(); this.Hide(); } else { invalidCredText.Visible = true; } connection.Close(); }
private void backButton1_Click(object sender, EventArgs e) { if (orderPanel1.Visible == true) { accountMain am = new accountMain(userId); am.Show(); am.Location = this.Location; this.Hide(); } if (orderPanel2.Visible == true) { orderPanel1.Visible = true; orderPanel2.Visible = false; } else if (orderPanel3.Visible == true) { orderPanel3.Visible = false; orderPanel2.Visible = true; } else if (orderPanel4.Visible == true) { if (MessageBox.Show("You will be redirected back to Home page", "Redirect", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { accountMain am = new accountMain(userId); am.Show(); am.Location = this.Location; this.Hide(); } } }
private void homeButton_Click(object sender, EventArgs e) { accountMain am = new accountMain(userId); am.Show(); am.Location = this.Location; this.Hide(); }
private void backButton_Click(object sender, EventArgs e) { if (orderPanelMain.Visible == true) { orderPanelMain.Visible = false; orderPanel.Visible = true; } else { accountMain am = new accountMain(userId); am.Show(); am.Location = this.Location; this.Hide(); } }