private void btnSubmitForgotPassword_Click(object sender, EventArgs e)
        {
            // get the email, password and repeated password
            SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service();
            string email          = lblForgottenEmail.Text;
            string password       = txtForgotPassword.Text;
            string repeatPassword = txtForgotRepeatPassword.Text;

            // check passwords match
            if (password != repeatPassword)
            {
                MessageBox.Show("passwords dont match");
                return;
            }

            // validate password
            if (!ValidatePassword(password))
            {
                return;
            }

            // update password
            register_Service.updateUserPassword(email, SHA512(password));
            MessageBox.Show("Updated password and succesfully logged in");

            // hide these menus en show application
            menuStrip2.Hide();
            pnl_ForgotPasswordPanel.Hide();
            pnl_Login.Hide();
            pnl_Register.Hide();

            role = register_Service.GetRole(email);
            menuStrip1.Show();
            pnl_Dashboard.Show();
        }
        private void btnCheckQandA_Click(object sender, EventArgs e)
        {
            // get the email, question and given answer
            SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service();
            string email     = lblForgottenEmail.Text;
            string sQuestion = lblSecretQuestion.Text;
            string sAwnser   = txtForgotPasswordSecretAwnser.Text;

            // validate the question and given answer
            bool validateQuestionAndAwnser = register_Service.CheckForExistenceSecretQuestion(email, sQuestion, sAwnser);

            if (!validateQuestionAndAwnser)
            {
                // display error message when Q and A dont match
                MessageBox.Show("Wrong Secret question and or anwser");
                return;
            }

            // show the final part where the user can enter a new password
            label14.Show();
            label17.Show();
            txtForgotPassword.Show();
            txtForgotRepeatPassword.Show();
            btnSubmitForgotPassword.Show();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service();

            // get the email and password from textboxes
            string email    = txtLoginEmail.Text;
            string password = txtLoginPassword.Text;

            // validate the user

            // if validuser then show application and hide login and register and password forgotten
            if (register_Service.CheckUserLogin(email, SHA512(password)))
            {
                role = register_Service.GetRole(email);
                menuStrip2.Hide();
                pnl_Login.Hide();

                menuStrip1.Show();
                pnl_Dashboard.Show();
            }
            else
            {
                MessageBox.Show("Wrong email or password!"); // show messagebox with message, application keeps running
                return;
            }
        }
        private void btnForgotValidateEmail_Click(object sender, EventArgs e)
        {
            // get the question for the input email
            SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service();
            lblSecretQuestion.Text = register_Service.GetSecretQuestion(txtForgotPasswordEmail.Text);

            // when there is a result, show the next part of the panel with for answerring the secret question
            if (!String.IsNullOrEmpty(lblSecretQuestion.Text))
            {
                label3.Show();
                label12.Show();
                lblSecretQuestion.Show();
                txtForgotPasswordSecretAwnser.Show();
                btnCheckQandA.Show();

                // make the given email permanent so it cant be changed after the question was given
                txtForgotPasswordEmail.Hide();
                lblForgottenEmail.Text = txtForgotPasswordEmail.Text;
                lblForgottenEmail.Show();
            }
            else
            {
                // give message showing there was nothing found with the given email
                MessageBox.Show("No user found with this email!");
            }
        }
        private void btnRegister_Click(object sender, EventArgs e)
        {
            // user information
            string name  = txtRegisterName.Text;
            string email = txtRegisterEmail.Text;


            // password and repeat
            string password       = txtRegisterWachtwoord.Text;
            string repeatPassword = txtRegisterRepeatWW.Text;

            // question and answer
            string question = txtRegisterQuestion.Text;
            string answer   = txtRegisterAnswer.Text;

            SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service();

            // validate the user
            if (register_Service.CheckForExistence(email))
            {
                MessageBox.Show("User already exists!");
                return;
            }
            if (txtRegisterLicenseKey.Text != "XsZAb-tgz3PsD-qYh69un-WQCEx")
            {
                MessageBox.Show("License Key don't match!");
                return;
            }
            if (password != repeatPassword)
            {
                MessageBox.Show("Passwords don't match!");
                return;
            }

            if (!ValidatePassword(password))
            {
                return;
            }

            // add user
            register_Service.InsertUser(name, email, SHA512(password), question, answer);

            menuStrip1.Show();
            pnl_Dashboard.Show();
            menuStrip2.Hide();
            pnl_Register.Hide();
        }