Exemplo n.º 1
0
        private void btnCreateProfile_Click(object sender, EventArgs e)
        {
            int status;

            if (textBoxNewUserFName.Text == "" ||
                textBoxNewUserLName.Text == "" ||
                textBoxNewUserPW.Text == "" ||
                textBoxNewUserUsername.Text == "" ||
                textBoxNewUserPWVerify.Text == "" ||
                textBoxNewUserEmail.Text == "")
            {
                MessageBox.Show("ERROR: EMPTY FIELD");
                return;
            }
            else if (textBoxNewUserPW.Text.Equals(textBoxNewUserPWVerify.Text) == false)
            {
                MessageBox.Show("ERROR: PASSWORDS DO NOT MATCH");
                return;
            }
            userAccount newUser = new userAccount();

            status = newUser.createAccount(textBoxNewUserUsername.Text,
                                           textBoxNewUserFName.Text,
                                           textBoxNewUserLName.Text,
                                           textBoxNewUserEmail.Text,
                                           textBoxNewUserPW.Text);

            if (status == 0) // Account alreadys exists
            {
                MessageBox.Show("ERROR: An account with this username already exists.");
                return;
            }
            else if (status == 1) //Account made successfully
            {
                MessageBox.Show("Account created successfully.");
                this.Close();
            }
            else
            {
                MessageBox.Show("ERROR: This is not good.");
            }
        }
Exemplo n.º 2
0
        private void btnMainLogin_Click(object sender, EventArgs e)
        {
            if (mainUNTextbox.Text == "" || mainPWTextbox.Text == "")
            {
                MessageBox.Show("ERROR: Empty Field");
                return;
            }
            userAccount userLogin  = new userAccount();
            int         loginCheck = userLogin.accountLogin(mainUNTextbox.Text, mainPWTextbox.Text);

            switch (loginCheck)
            {
            case 0:
                MessageBox.Show("ERROR: Incorrect Login");
                mainUNTextbox.Clear();
                mainPWTextbox.Clear();
                break;

            case 1:
                //academicInfo academicInfo = new academicInfo();
                //academicInfo.Show();
                username_current = mainUNTextbox.Text;
                tabControl1.Show();
                tabControl1.SelectedTab = tabPage2;
                textBoxUniversitySearcher.Show();
                btnUniversitySearcher.Show();
                break;

            case 2:
                MessageBox.Show("ERROR: Multiple accounts with the same username detected");
                break;

            default:
                MessageBox.Show("ERROR: UNHANDLED EXCEPTION");
                break;
            }
        }
Exemplo n.º 3
0
        private void btnUpdateProfile_Click(object sender, EventArgs e)
        {
            if (textBoxUpdateUserPW.Text == "" &&
                textBoxUpdateUserPWVerify.Text == "" &&
                textBoxUpdateUserEmail.Text == "")
            {
                MessageBox.Show("ERROR: ALL FIELDS EMPTY");
                return;
            }

            if (textBoxUpdateUserPW.Text.Equals(textBoxUpdateUserPWVerify.Text) == false)
            {
                MessageBox.Show("ERROR: PASSWORDS DO NOT MATCH");
                return;
            }

            userAccount update = new userAccount();

            update.updateAccount(textBoxUpdateUserEmail.Text,
                                 textBoxUpdateUserPW.Text,
                                 username_current);

            tabControl1.SelectedTab = tabPage2;
        }