Пример #1
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            string newUsername = UsernameTextBox.Text;
            string newEmail    = EmailTextBox.Text;
            string newPassword = PasswordTextBox.Text;

            if (ValidateDate.EmailPasswordUsername(newEmail, newPassword, newUsername))
            {
                string query = $"Update Users SET Username = '******', Email = '{@newEmail}', Password = '******' where ID = '{currentUser.id}'";

                SqlCommand updateCommand = new SqlCommand(query);

                updateCommand.Parameters.AddWithValue("@newUsername", newUsername);
                updateCommand.Parameters.AddWithValue("@newEmail", newEmail);
                updateCommand.Parameters.AddWithValue("@newPassword", newPassword);

                int row = dbAccess.ExecuteQuery(updateCommand);

                if (row == 1)
                {
                    MessageBox.Show("Account Updated Successfully!");
                }
                else
                {
                    MessageBox.Show("Something Went Wrong. Sorry :(");
                }
            }
        }
Пример #2
0
        bool CheckEnteredValues()
        {
            if (!ValidateDate.Username(username))
            {
                MessageBox.Show("Please enter your name");
            }
            else if (!ValidateDate.Email(email))
            {
                MessageBox.Show("Your email is incorrect");
            }
            else if (!ValidateDate.Password(password))
            {
                MessageBox.Show("Your password is too short");
            }
            else if (country == "")
            {
                MessageBox.Show("Please select a country");
            }
            else
            {
                return(true);
            }

            return(false);
        }
Пример #3
0
        bool CheckEnteredValues()
        {
            if (!ValidateDate.Email(email))
            {
                MessageBox.Show("Your email is incorrect");
            }
            else if (!ValidateDate.Password(password))
            {
                MessageBox.Show("Your password is too short");
            }
            else
            {
                return(true);
            }

            return(false);
        }