private void SignUpBtnClick() { string username = tbUserName.Text; string password = tbPassword.Text; string passwordRepeat = tbPasswordRepeat.Text; string query = "SELECT * FROM loginTable WHERE username = '******'"; if (tbUserName.Text.Length > 0 && tbPassword.Text.Length > 0) { if (dbHandler.RowExist(query) == false) { if (password == passwordRepeat) { dbHandler.Insert("INSERT INTO loginTable (username, password) VALUES ('" + username + "', '" + password + "')"); MessageBox.Show("User successfully registered!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); ProgramManager.getInstance().SwitchScreen(this, new Form1()); } else { MessageBox.Show("Passwords aren't matching!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Username already exists!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please enter username or password!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void login() { mDataSet = new DataSet(); string userName = tbUserName.Text; string password = tbPassword.Text; mDataSet = DbHandler.getInstance().Select("SELECT * FROM loginTable WHERE username = '******' AND password = '******'"); if (mDataSet.Tables[0].Rows.Count == 0) { MessageBox.Show("Wrong username or password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { UserHelper.getInstance().userID = int.Parse(mDataSet.Tables[0].Rows[0][0].ToString()); ProgramManager.getInstance().SwitchScreen(this, new Dashboard()); } }
private void btnBack_Click_1(object sender, EventArgs e) { ProgramManager.getInstance().SwitchScreen(this, new Form1()); }
private void btnX_Click(object sender, EventArgs e) { ProgramManager.getInstance().Exit(); }
private void btnCancel_Click(object sender, EventArgs e) { ProgramManager.getInstance().Close(this); }
private void returnBooksToolStripMenuItem_Click(object sender, EventArgs e) { ProgramManager.getInstance().OpenScreen(new ReturnBookForm()); }
private void toolStripMenuItem1_Click(object sender, EventArgs e) { ProgramManager.getInstance().OpenScreen(new btnIssueBook()); }
private void viewStudentInfoToolStripMenuItem_Click(object sender, EventArgs e) { ProgramManager.getInstance().OpenScreen(new ViewStudentsForm()); }
private void addNewBookToolStripMenuItem_Click(object sender, EventArgs e) { ProgramManager.getInstance().OpenScreen(new AddBookForm()); }
private void logOutToolStripMenuItem_Click(object sender, EventArgs e) { ProgramManager.getInstance().LogOut(this, new Form1()); }
private void exitToolStripMenuItem_Click(object sender, EventArgs e) { ProgramManager.getInstance().Exit(); }
private void btnSignUp_Click(object sender, EventArgs e) { ProgramManager.getInstance().SwitchScreen(this, new SignUp()); }