예제 #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
 public static ProgramManager getInstance()
 {
     if (instance == null)
     {
         instance = new ProgramManager();
     }
     return(instance);
 }
예제 #3
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());
            }
        }
예제 #4
0
 private void btnBack_Click_1(object sender, EventArgs e)
 {
     ProgramManager.getInstance().SwitchScreen(this, new Form1());
 }
예제 #5
0
        private void btnX_Click(object sender, EventArgs e)


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