private void btnLogin_Click(object sender, EventArgs e) { casino.username = tbUsername.Text; casino.password = tbPassword.Text; //dtUser = oper.loginUser(casino); dtCasino = oper.loginCasino(casino); if (dtUser.Rows.Count == 1) { foreach (DataRow row in dtUser.Rows) { string fname = row["FirstName"].ToString(); string lname = row["LastName"].ToString(); acName = fname + " " + lname; } foreach (DataRow row in dtCasino.Rows) { acCasino = row["CasinoName"].ToString(); } Operations.lastFrom = "Login"; acLabel = "You have succesfully logged in."; AdminCreated adminCreated = new AdminCreated(); adminCreated.Show(); } else { MessageBox.Show("Something Went Wrong"); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(tbFirst.Text)) { MessageBox.Show("All fields must be filled out"); } else if (String.IsNullOrWhiteSpace(tbLast.Text)) { MessageBox.Show("All fields must be filled out"); } else if (String.IsNullOrWhiteSpace(tbUsername.Text)) { MessageBox.Show("All fields must be filled out"); } else if (String.IsNullOrWhiteSpace(tbEmail.Text)) { MessageBox.Show("All fields must be filled out"); } else if (String.IsNullOrWhiteSpace(tbCasino.Text)) { MessageBox.Show("All fields must be filled out"); } else if (String.IsNullOrWhiteSpace(tbClub.Text)) { MessageBox.Show("All fields must be filled out"); } else if (String.IsNullOrWhiteSpace(tbLocation.Text)) { MessageBox.Show("All fields must be filled out"); } else { if (tbPassword.Text.Length >= 8) { if (tbPassword.Text == tbConfirmPW.Text) { Guid userGuid = System.Guid.NewGuid(); string hashedPassword = Security.HashSHA1(tbPassword.Text + userGuid.ToString()); casino.firstname = tbFirst.Text; casino.lastname = tbLast.Text; casino.username = tbUsername.Text; casino.password = hashedPassword; casino.email = tbEmail.Text;; casino.casinoname = tbCasino.Text; casino.clubname = tbClub.Text; casino.casinolocation = tbLocation.Text; casino.userguid = userGuid; int rowsc = oper.insertCasino(casino); if (rowsc > 0) { Operations.lastFrom = "AdminReg"; acLabel = "You have created a new casino."; AdminCreated adminCreated = new AdminCreated(); adminCreated.Show(); } } else { MessageBox.Show("Your passwords do not match"); } } else { MessageBox.Show("Your password must be at least 8 characters"); } } }