private void goback_Click(object sender, EventArgs e)
        {
            closeProgram = false;

            this.Close();
            ChooseTrainerPage tp = new ChooseTrainerPage(dbManager, stateManager);

            tp.Show();
        }
Exemple #2
0
        /**
         * User Clicked "choose training" on menu.
         * */
        private void chooseTrainingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            closeProgram = false;

            this.Close();
            ChooseTrainerPage lp = new ChooseTrainerPage(dbManager, stateManager);

            lp.Show();
        }
        /**
         * Called when the user clicks the submit button
         */
        private void submitButton_Click(object sender, EventArgs e)
        {
            closeProgram = false;
            //  Check if the user properly logged in
            if (checkLogin())
            {
                // Close this form
                this.Close();

                // Open the choose trainer form
                ChooseTrainerPage tp = new ChooseTrainerPage(dbManager, stateManager);
                tp.Show();
            }
            else
            {
                statusStrip.Text = "Wrong Username/Password!";
                //statusStrip1.Refresh();
            }
        }
        /**
         * Called when the user clicks the submit button.
         */
        private void submitButton_Click_1(object sender, EventArgs e)
        {
            // We want the gui to know we aren't clicking the exit button.
            closeProgram = false;

            string userName = tb_userName.Text;
            string password = tb_password.Text;

            //TODO: Sanitize this sql input.

            // Create our insert Query
            string query = "INSERT INTO user (userName, password) VALUES('" + userName + "', '" + password + "');";

            // Attempt the insert
            if (dbManager.insert(query))
            {
                // Set our username in the state Machine.
                stateManager.setUserName(userName, password);


                // Close this form
                this.Close();

                // Open the choose trainer form
                ChooseTrainerPage tp = new ChooseTrainerPage(dbManager, stateManager);
                tp.Show();
            }
            else
            {
                // Show error to user
                statusBar.Text = "Error, could not register user: " + userName;

                // Hey maybe we will click the exit button next time.
                closeProgram = true;
            }
        }