// Events /// <summary> /// Log in button checks username and password. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogIn_Click(object sender, EventArgs e) { Employee employee1 = new Employee(txtUsername.Text.ToLower(), txtPassword.Text); bool validEmployee = false; SQLValidateUser(employee1, ref validEmployee); // only allow access to application if users credentials check out if (validEmployee) { employee1.SetIsManager(employee1.GetEmployeeType()); MessageBox.Show(this, "Login successful.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information); // set password back to blank value as it is never used again employee1.SetPassword(""); StockFind stockFind = new StockFind(employee1); stockFind.Show(); this.Hide(); } else { MessageBox.Show(this, "Login unsuccessful.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassword.ResetText(); } }
private void findToolStripMenuItem_Click(object sender, EventArgs e) { StockFind stockFind = new StockFind(currentUser); this.Hide(); stockFind.Show(); }