Пример #1
0
        private void btnAddNote_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtNoteTitle.Text))
            {
                MessageBox.Show("Please enter note title !!!");
                txtNoteTitle.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtNoteContent.Text))
            {
                MessageBox.Show("Please enter note content !!!");
                txtNoteContent.Focus();
                return;
            }
            else
            {
                int categoryId   = (int)cboNoteCategory.SelectedValue;
                int stickyStatus = 0;
                if (chkSticky.Checked)
                {
                    stickyStatus = 1;
                }
                UserBLL userBLL = new UserBLL();
                int     userId  = userBLL.getUserId(FormLoaderClass._username);

                stickyNotesBLL.addNote(txtNoteTitle.Text, categoryId, txtNoteContent.Text, stickyStatus, userId);

                this.Hide();
                FormLoaderClass.loadStickyNotes();
                this.Close();
            }
        }
Пример #2
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();
            }
        }
Пример #3
0
        private void btnChangePassword_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtOldPassword.Text))
            {
                MessageBox.Show("Please enter old password !!!");
                txtOldPassword.Focus();
                return;
            }
            else 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
            {
                UserBLL userBLL = new UserBLL();
                userBLL._username = FormLoaderClass._username;
                userBLL._password = txtOldPassword.Text;
                int userStatus = userBLL.validateUserLogin();

                if (userStatus == 1)
                {
                    userBLL.resetUserPassword(userBLL._username, txtNewPassword.Text);
                    MessageBox.Show("Password changed successfully !!!");
                    this.Hide();
                    FormLoaderClass.loadStickyNotes();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Please enter correct old password !!!");
                    txtOldPassword.Clear();
                    txtNewPassword.Clear();
                    txtConfirmPassword.Clear();
                    txtOldPassword.Focus();
                    return;
                }
            }
        }
Пример #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtUsername.Text))
            {
                MessageBox.Show("Please enter username !!!");
                txtUsername.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtPassword.Text))
            {
                MessageBox.Show("Please enter password !!!");
                txtPassword.Focus();
                return;
            }
            else
            {
                userBLL._username = txtUsername.Text;
                userBLL._password = txtPassword.Text;

                int userStatus = userBLL.validateUserLogin();
                if (userStatus == 1)
                {
                    // store username
                    FormLoaderClass._username = txtUsername.Text;

                    this.Hide();
                    FormLoaderClass.loadDashboard();
                    this.Close();
                }
                else if (userStatus == 0)
                {
                    MessageBox.Show("Invalid user !!!");
                    txtUsername.Clear();
                    txtPassword.Clear();
                    txtUsername.Focus();
                }
                else if (userStatus == 2)
                {
                    MessageBox.Show("User not activated by admin !!!");
                    txtUsername.Clear();
                    txtPassword.Clear();
                    txtUsername.Focus();
                }
            }
        }
Пример #5
0
 private void msiChangePassword_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadChangePassword();
     this.Close();
 }
Пример #6
0
 private void msiDisplayUsers_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadUserDetailAdmin();
     this.Close();
 }
Пример #7
0
 private void msiCreateANote_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadCreateANote();
     this.Close();
 }
Пример #8
0
 private void msiAddUserType_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadUserType();
     this.Close();
 }
Пример #9
0
 private void category_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadCategories();
     this.Close();
 }
Пример #10
0
 private void msiLogout_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadLogin();
     this.Close();
 }
Пример #11
0
 private void lnkRegister_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadRegisterUser();
     this.Close();
 }
Пример #12
0
 private void msiCheckNotesStatus_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadDashboard();
     this.Close();
 }
Пример #13
0
 private void msiAboutStickyNotes_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadAboutStickyNote();
     this.Close();
 }
Пример #14
0
 private void lnkBackToLogin_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadLogin();
     this.Close();
 }
Пример #15
0
        private void btnUpdate_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 || txtUsername.Text == FormLoaderClass._username)
                {
                    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;

                    userBLL.updateUser(userId);
                    FormLoaderClass._username = userBLL._username;   // for updating username

                    MessageBox.Show("User updated successfully !!!");
                    this.Hide();
                    FormLoaderClass.loadStickyNotes();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Username already taken !!!" + "\nChoose another username");
                    txtUsername.Clear();
                    txtUsername.Focus();
                    return;
                }
            }
        }
Пример #16
0
 private void lnkBackToStickyNotes_Click(object sender, EventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadStickyNotes();
     this.Close();
 }
Пример #17
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();
                    }
                }
            }
        }
Пример #18
0
 private void lnkBackToStickyNote_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadStickyNotes();
     this.Close();
 }
Пример #19
0
 private void CreateANote_FormClosed(object sender, FormClosedEventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadStickyNotes();
     this.Close();
 }
Пример #20
0
 private void lnkForgotPassword_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     FormLoaderClass.loadResetPassword();
     this.Close();
 }
Пример #21
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;
                }
            }
        }