Пример #1
0
        private void registerButton_Click(object sender, EventArgs e)
        {
            DataAccess dbAccess = new DataAccess();

            string username     = usernameTextbox.Text;
            string password     = passwordTextbox.Text;
            string firstName    = firstNameTextbox.Text;
            string lastName     = lastNameTextbox.Text;
            string emailAddress = emailAddressTextbox.Text;

            var account = dbAccess.InsertData(username, password, firstName, lastName, emailAddress);

            if (account == null)
            {
                MessageBox.Show("Register failed !");
            }
            else
            {
                this.Hide();

                profileForm profileForm = new profileForm(account.Username, account.Password);
                profileForm.ShowDialog();

                this.Close();
            }
        }
        private void loginButton_Click(object sender, EventArgs e)
        {
            DataAccess dbAccess = new DataAccess();

            string username = usernameTextbox.Text;
            string password = passwordTextbox.Text;

            if (dbAccess.ExistAccount(username, password))
            {
                this.Hide();
                profileForm profile = new profileForm(username, password);
                profile.ShowDialog();

                this.Close();
            }
            else
            {
                MessageBox.Show("Invalid account !!!");
            }
        }