private void Verify() { string studLecy = tbxUsername.Text; // Make the error label invisible lblError.Visible = false; DatabaseConnector qwd = new DatabaseConnector(); List<string> test = qwd.LoginConnect("db_owner.SELECT_ID",tbxUsername.Text,tbxPassword.Text); // If the count of test is greater than 0 then that means something was returned if (test.Count() > 0) { // If login code returns results this.Hide(); frmCourseInfo courseInfo = new frmCourseInfo(test[0], test[1]); courseInfo.ShowDialog(); this.Close(); } else { // Error label made visible lblError.Visible = true; // Text in the password textbox is cleared tbxPassword.Text = ""; // The password textbox is made the focus of the form tbxPassword.Focus(); } }
/// <summary> /// Verifies the username and password input with the database /// </summary> private void Verify() { // Temporary string to hold the username field string username = tbxUsername.Text; // Make the error label invisible lblError.Visible = false; // List of string objects are returned from database query (via the LoginConnect method) List<string> verify = DatabaseConnector.LoginConnect("db_owner.SELECT_ID", tbxUsername.Text, tbxPassword.Text); // If the count of test is greater than 0 then that means something was returned if (verify.Count() > 0) { // Hide this form this.Hide(); // Create a new course info form and set it up with verify's results frmCourseInfo courseInfo = new frmCourseInfo(verify[0], verify[1]); // courseInfo is opened in modal courseInfo.ShowDialog(); // this current form is closed this.Close(); } // else nothing was returned else { // Error label made visible lblError.Visible = true; // Text in the password textbox is cleared tbxPassword.Text = ""; // The password textbox is made the focus of the form tbxPassword.Focus(); } }