Exemplo n.º 1
0
        private void msiDeleteAccount_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure ?", "Confirm Delete", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                UserBLL userBLL       = new UserBLL();
                int     currentUserId = userBLL.getUserId(FormLoaderClass._username);
                userBLL.deleteUser(currentUserId);
                FormLoaderClass.loadLogin();
                this.Close();
            }
        }
Exemplo n.º 2
0
 private void msiLogout_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadLogin();
     this.Close();
 }
Exemplo n.º 3
0
 private void lnkBackToLogin_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadLogin();
     this.Close();
 }
Exemplo n.º 4
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (btnReset.Text == "Check")
            {
                if (String.IsNullOrEmpty(txtUsername.Text))
                {
                    MessageBox.Show("Please enter username !!!");
                    txtUsername.Focus();
                    return;
                }
                else if (String.IsNullOrEmpty(txtEmail.Text))
                {
                    MessageBox.Show("Please enter email address !!!");
                    txtEmail.Focus();
                    return;
                }
                else if (String.IsNullOrEmpty(txtContactNumber.Text))
                {
                    MessageBox.Show("Please enter contact number !!!");
                    txtContactNumber.Focus();
                    return;
                }
                else
                {
                    bool userStatus = userBLL.validateUser(txtUsername.Text, txtEmail.Text, txtContactNumber.Text);

                    if (userStatus)
                    {
                        txtUsername.Enabled    = txtEmail.Enabled = txtContactNumber.Enabled = false;
                        txtNewPassword.Enabled = txtConfirmPassword.Enabled = true;
                        btnReset.Text          = "Reset";
                        txtNewPassword.Focus();
                        return;
                    }
                    else
                    {
                        MessageBox.Show("Please enter correct details !!!");
                        txtUsername.Clear();
                        txtEmail.Clear();
                        txtContactNumber.Clear();
                        txtUsername.Focus();
                        return;
                    }
                }
            }
            else if (btnReset.Text == "Reset")
            {
                if (String.IsNullOrEmpty(txtNewPassword.Text))
                {
                    MessageBox.Show("Please enter new password !!!");
                    txtNewPassword.Focus();
                    return;
                }
                else if (String.IsNullOrEmpty(txtConfirmPassword.Text))
                {
                    MessageBox.Show("Please confirm the password !!!");
                    txtConfirmPassword.Focus();
                    return;
                }
                else
                {
                    if (txtNewPassword.Text != txtConfirmPassword.Text)
                    {
                        MessageBox.Show("Password didn't match !!!");
                        txtNewPassword.Clear();
                        txtConfirmPassword.Clear();
                        txtNewPassword.Focus();
                        return;
                    }
                    else
                    {
                        userBLL.resetUserPassword(txtUsername.Text, txtEmail.Text, txtContactNumber.Text, txtNewPassword.Text);
                        MessageBox.Show("Password reset successfully !!!");
                        this.Hide();
                        FormLoaderClass.loadLogin();
                        this.Close();
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtFirstName.Text))
            {
                MessageBox.Show("Please enter first name !!!");
                txtFirstName.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtLastName.Text))
            {
                MessageBox.Show("Please enter last name !!!");
                txtLastName.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtAddress.Text))
            {
                MessageBox.Show("Please enter address !!!");
                txtAddress.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtEmail.Text))
            {
                MessageBox.Show("Please enter email address !!!");
                txtEmail.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtContactNumber.Text))
            {
                MessageBox.Show("Please enter contact number !!!");
                txtContactNumber.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("Please enter username !!!");
                txtUsername.Focus();
                return;
            }
            else
            {
                bool usernameAvailibilty = userBLL.isUsernameAvailable(txtUsername.Text);

                if (usernameAvailibilty)
                {
                    userBLL._firstName = txtFirstName.Text;

                    userBLL._lastName = txtLastName.Text;

                    userBLL._dob = dtpDOB.Text;

                    userBLL._address = txtAddress.Text;

                    userBLL._email = txtEmail.Text;

                    userBLL._contactNumber = txtContactNumber.Text;

                    userBLL._username = txtUsername.Text;

                    Service service = new ServiceImpl();
                    userBLL._password = service.getRandomCode(10);

                    userBLL.insertUser();
                    MessageBox.Show("Your password is: " + userBLL._password);

                    this.Hide();
                    FormLoaderClass.loadLogin();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Username already taken !!!" + "\nChoose another username");
                    txtUsername.Clear();
                    txtUsername.Focus();
                    return;
                }
            }
        }