示例#1
0
        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);
            }
        }
示例#2
0
        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());
            }
        }
示例#3
0
 private void btnBack_Click_1(object sender, EventArgs e)
 {
     ProgramManager.getInstance().SwitchScreen(this, new Form1());
 }
示例#4
0
        private void btnX_Click(object sender, EventArgs e)


        {
            ProgramManager.getInstance().Exit();
        }
示例#5
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().Close(this);
 }
示例#6
0
 private void returnBooksToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().OpenScreen(new ReturnBookForm());
 }
示例#7
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().OpenScreen(new btnIssueBook());
 }
示例#8
0
 private void viewStudentInfoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().OpenScreen(new ViewStudentsForm());
 }
示例#9
0
 private void addNewBookToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().OpenScreen(new AddBookForm());
 }
示例#10
0
 private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().LogOut(this, new Form1());
 }
示例#11
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().Exit();
 }
示例#12
0
 private void btnSignUp_Click(object sender, EventArgs e)
 {
     ProgramManager.getInstance().SwitchScreen(this, new SignUp());
 }