protected Boolean saveUserInfo(Dictionary<string, string> userInfo, Boolean skipSendEmail = false) { //check to make sure user is not already registered if (authenticateUser(userInfo["Email"].ToString(), "", true)) { connErrMsg = "already registered"; return false; } SaltUtility saltTool = new SaltUtility(); StringBuilder myStr = new StringBuilder(); //create a mySql command object MySqlCommand cmd = new MySqlCommand("usp_registerUser", mySqlConn); cmd.CommandType = System.Data.CommandType.StoredProcedure; //set params for stored proc MySqlParameter pFirstName; pFirstName = new MySqlParameter("?firstname", MySqlDbType.VarChar); pFirstName.Value = userInfo["First Name"]; pFirstName.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pFirstName); MySqlParameter pLastName; pLastName = new MySqlParameter("?lastname", MySqlDbType.VarChar); pLastName.Value = userInfo["Last Name"]; pLastName.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pLastName); MySqlParameter pEmail; pEmail = new MySqlParameter("?loginId", MySqlDbType.VarChar); pEmail.Value = userInfo["Email"]; pEmail.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pEmail); MySqlParameter pPhoneNum; pPhoneNum = new MySqlParameter("?phoneNumber", MySqlDbType.VarChar); pPhoneNum.Value = !string.IsNullOrEmpty(userInfo["Phone Number"]) ? userInfo["Phone Number"] : null; pPhoneNum.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pPhoneNum); MySqlParameter pAddress1; pAddress1 = new MySqlParameter("?address1", MySqlDbType.VarChar); pAddress1.Value = !string.IsNullOrEmpty(userInfo["Address1"]) ? userInfo["Address1"] : null; pAddress1.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pAddress1); MySqlParameter pAddress2; pAddress2 = new MySqlParameter("?address2", MySqlDbType.VarChar); pAddress2.Value = !string.IsNullOrEmpty(userInfo["Address2"]) ? userInfo["Address2"] : null; pAddress2.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pAddress2); MySqlParameter pCity; pCity = new MySqlParameter("?city", MySqlDbType.VarChar); pCity.Value = !string.IsNullOrEmpty(userInfo["City"]) ? userInfo["City"] : null; pCity.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pCity); MySqlParameter pState; pState = new MySqlParameter("?state", MySqlDbType.VarChar); pState.Value = !string.IsNullOrEmpty(userInfo["State"]) ? userInfo["State"] : null; pState.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pState); MySqlParameter pZip; pZip = new MySqlParameter("?zip", MySqlDbType.Int32); if (!string.IsNullOrEmpty(userInfo["Zip"])) { pZip.Value = Convert.ToInt32(userInfo["Zip"]); } else { pZip.Value = null; } pZip.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pZip); MySqlParameter pZip2; pZip2 = new MySqlParameter("?zip2", MySqlDbType.Int16); if (!string.IsNullOrEmpty(userInfo["Zip2"])) { pZip2.Value = Convert.ToInt16(userInfo["Zip2"]); } else { pZip.Value = null; } pZip2.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pZip2); MySqlParameter pOptIn; pOptIn = new MySqlParameter("?mailingList", MySqlDbType.Bit); if (!string.IsNullOrEmpty(userInfo["OptIn"])) { try { Boolean optingIn = Convert.ToBoolean(userInfo["OptIn"]); pOptIn.Value = optingIn ? 1 : 0; } catch { pOptIn.Value = 0; } pOptIn.Direction = System.Data.ParameterDirection.Input; } cmd.Parameters.Add(pOptIn); MySqlParameter pLoginPass; pLoginPass = new MySqlParameter("?loginPass", MySqlDbType.VarChar); pLoginPass.Value = saltTool.seasonIt(userInfo["Password"], userInfo["LoginHash"], userInfo["LoginV"]); pLoginPass.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pLoginPass); MySqlParameter pLoginHash; pLoginHash = new MySqlParameter("?loginHash", MySqlDbType.VarChar); pLoginHash.Value = saltTool.seasonIt(userInfo["LoginHash"]); pLoginHash.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pLoginHash); MySqlParameter pLoginV; pLoginV = new MySqlParameter("?loginV", MySqlDbType.VarChar); pLoginV.Value = saltTool.seasonIt(userInfo["LoginV"]); pLoginV.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pLoginV); MySqlParameter pAcceptedAgreement; pAcceptedAgreement = new MySqlParameter("?acceptedAgreement", MySqlDbType.Bit); pAcceptedAgreement.Value = Convert.ToBoolean(userInfo["AcceptedAgreement"]); pAcceptedAgreement.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pAcceptedAgreement); Boolean acceptedAgreement = Convert.ToBoolean(userInfo["AcceptedAgreement"]); //**This is the approval code for consingment application submissions. user should get this in email when they sign up to be a ticketSeller. Our Rep will ask for that code upon initial contact. MySqlParameter pConsignorCode; pConsignorCode = new MySqlParameter("?consignorCode", MySqlDbType.VarChar); pConsignorCode.Value = saltTool.seasonIt(userInfo["ConsignorCode"]); pConsignorCode.Direction = System.Data.ParameterDirection.Input; cmd.Parameters.Add(pConsignorCode); try { if (!isInitialized()) { cmd.Connection.Open(); } cmd.ExecuteNonQuery(); /* * Never want to send email locally or if autoRegister occurs from joining mailing list. */ if (!skipSendEmail && sWebServer.ToLower().IndexOf("localhost") < 0 && acceptedAgreement) { cdontsUtil emailObj = new cdontsUtil(); emailObj.emailDetails = userInfo; emailObj.sendEmail("consignorApp_Verify", "RockstarSeating.com User Registration Success", userInfo["Email"]); emailObj.sendEmail("consignorApp_Approve", "New Ticket Consignment Registration", "*****@*****.**"); emailObj.sendEmail("consignorApp_Approve", "New Ticket Consignment Registration", "*****@*****.**"); } return true; } catch (Exception ee) { connErrMsg = ee.Message.ToString(); return false; } }
protected Boolean sendTicketRequestForm(Dictionary<string, string> formDetails) { try { //need to provide an autogenerated password and store it encrypted in the db SaltUtility saltTool = new SaltUtility(); string loginHash = saltTool.randomString(16); string loginV = saltTool.randomString(16); //food param = plainText password(randomString(16)) string autoGeneratedPassword = saltTool.randomString(16); autoGeneratedPassword = saltTool.seasonIt(autoGeneratedPassword, loginHash, loginV); //password stored = seasoned_autoGeneratedPassword formDetails.Add("Password", autoGeneratedPassword); formDetails.Add("LoginHash", loginHash); formDetails.Add("LoginV", loginV); //now add misc fields for saveUserInfo formDetails.Add("OptIn", "true"); formDetails.Add("Zip2", ""); formDetails.Add("ConsignorCode", ""); Boolean alreadyRegistered = false; //this should save user info unless fail if (!saveUserInfo(formDetails, true)) { //need to passThru if user is already registered, it's a fake fail if (connErrMsg == "already registered") { alreadyRegistered = true; } else { return false; } } //now send emails cdontsUtil emailObj = new cdontsUtil(); emailObj.emailDetails = formDetails; //send email to user emailObj.sendEmail("userTicketRequest_success", "Ticket Request Submission at RockstarSeating.com", formDetails["Email"]); //send email to admin if (!alreadyRegistered) { emailObj.sendEmail("userTicketRequest_notify", "New Member Ticket Request Submission", formDetails["Email"]); } else { emailObj.sendEmail("userTicketRequest_alreadyRegistered_notify", "Registered Member Ticket Request Submission", formDetails["Email"]); } return true; } catch (Exception ee) { connErrMsg = ee.Message.ToString(); return false; } }