public AddItem(User user, CARD card, Button button, String connectionString) { _card = card; _collection = user.GetCollection(); _button = button; _connectionString = connectionString; _user = user; InitializeComponent(); }
// if the user has inputted the correct verification code, CARD is opened with the user's information private void enterButton_Click(object sender, EventArgs e) { bool isValidCode = verCodeTextBox.Text.Equals(_code); if (isValidCode) { CARD card = new CARD(_username, _email, _password, _login, _connectionString); card.Show(); this.Close(); } }
// checks to see if username, email, and password ar valid. adds new user to database and opens // CARD with the new user information private void button2_Click(object sender, EventArgs e) { bool validName = validUsername(); bool validEm = validEmail(); bool validPass = validPassword(); if (validName && validEm && validPass) { _username = textBox1.Text; _email = textBox2.Text; _password = textBox3.Text; OleDbConnection conn = new OleDbConnection(_connectionString); OleDbCommand addUser = conn.CreateCommand(); conn.Open(); addUser = new OleDbCommand("INSERT INTO Users (Username, Email, [Password]) VALUES('" + _username + "','" + _email + "','" + _password + "')", conn); addUser.ExecuteScalar(); conn.Close(); CARD card = new CARD(_username, _email, _password, _login, _connectionString); card.Show(); moveOn = true; this.Close(); } }