コード例 #1
0
        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;
            }
        }
コード例 #2
0
        protected Boolean addEmailToMailingList(string emailAddress)
        {
            //check to make sure user is not already registered

            if (isEmailAlreadyRegistered(emailAddress))
            {
                connErrMsg = "Email Address is already registered.";
                return false;
            }

            //create a mySql command object
            MySqlCommand cmd = new MySqlCommand("usp_joinMailingList", mySqlConn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            //set params for stored proc
            MySqlParameter pEmail;
            pEmail = new MySqlParameter("?in_emailAddress", MySqlDbType.VarChar);
            pEmail.Value = emailAddress;
            pEmail.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pEmail);

            try
            {
                if (!isInitialized())
                {
                    cmd.Connection.Open();
                }
                cmd.ExecuteNonQuery();

                cdontsUtil emailObj = new cdontsUtil();
                emailObj.sendEmail("joinMailingList_success", "Thanks for joining our Mailing List", emailAddress);
                return true;
            }
            catch (Exception ee)
            {
                connErrMsg = ee.Message.ToString();
                return false;
            }
        }
コード例 #3
0
        protected Boolean saveInventoryToDB(Dictionary<string, string> uploadInfo)
        {
            //create a mySql command object
            MySqlCommand cmd = new MySqlCommand("usp_uploadInventory", mySqlConn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            //set params for stored proc
            MySqlParameter pEventTitle;
            pEventTitle = new MySqlParameter("?eventTitle", MySqlDbType.VarChar);
            pEventTitle.Value = uploadInfo["Event Title"];
            pEventTitle.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pEventTitle);

            MySqlParameter pVenue;
            pVenue = new MySqlParameter("?venue", MySqlDbType.VarChar);
            pVenue.Value = uploadInfo["Venue"];
            pVenue.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pVenue);

            MySqlParameter pRow;
            pRow = new MySqlParameter("?seatRow", MySqlDbType.VarChar);
            pRow.Value = uploadInfo["Row"];
            pRow.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pRow);

            MySqlParameter pSeatFrom;
            pSeatFrom = new MySqlParameter("?seatFrom", MySqlDbType.VarChar);
            pSeatFrom.Value = !string.IsNullOrEmpty(uploadInfo["Seat From"]) ? uploadInfo["Seat From"] : null;
            pSeatFrom.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pSeatFrom);

            MySqlParameter pSeatThru;
            pSeatThru = new MySqlParameter("?seatThru", MySqlDbType.VarChar);
            pSeatThru.Value = !string.IsNullOrEmpty(uploadInfo["Seat Thru"]) ? uploadInfo["Seat Thru"] : null;
            pSeatThru.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pSeatThru);

            MySqlParameter pSection;
            pSection = new MySqlParameter("?section", MySqlDbType.VarChar);
            pSection.Value = uploadInfo["Section"];
            pSection.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pSection);

            MySqlParameter pQuantity;
            pQuantity = new MySqlParameter("?Quantity", MySqlDbType.VarChar);
            pQuantity.Value = !string.IsNullOrEmpty(uploadInfo["Quantity"]) ? uploadInfo["Quantity"] : "1";
            pQuantity.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pQuantity);

            MySqlParameter pCost;
            pCost = new MySqlParameter("?cost", MySqlDbType.Int16);
            string strCost = uploadInfo["Cost"];
            int ix = strCost.IndexOf('.');
            strCost = ix > 0 ? strCost.Substring(ix) : strCost;
            pCost.Value = Convert.ToInt16(strCost);
            pCost.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pCost);

            MySqlParameter pEventDate;
            pEventDate = new MySqlParameter("?eventDate", MySqlDbType.VarChar);
            pEventDate.Value = uploadInfo["Event Date"];
            pEventDate.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pEventDate);

            MySqlParameter pEventTime;
            pEventTime = new MySqlParameter("?eventTime", MySqlDbType.VarChar);
            pEventTime.Value = uploadInfo["Event Time"];
            pEventTime.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pEventTime);

            MySqlParameter pUserId;
            pUserId = new MySqlParameter("?userId", MySqlDbType.VarChar);
            pUserId.Value = uploadInfo["UserId"];
            pUserId.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pUserId);

            MySqlParameter pNotes;
            pNotes = new MySqlParameter("?notes", MySqlDbType.LongText);
            pNotes.Value = uploadInfo["Notes"];
            pNotes.Direction = System.Data.ParameterDirection.Input;
            cmd.Parameters.Add(pNotes);

            try
            {
                if (!isInitialized())
                {
                    cmd.Connection.Open();
                }
                cmd.ExecuteNonQuery();

                //create the sendMail object here
                cdontsUtil mailObj = new cdontsUtil();
                string emailTo = uploadInfo["EmailAddress"];
                string emailSubj = "Rockstar Seating Ticket Consignment: Please verify your Ticket Seller Account Upload Information";
                mailObj.emailDetails = uploadInfo;

                mailObj.sendEmail("consignmentUpload_success", emailSubj, emailTo);
                mailObj.sendEmail("consignmentUpload_success", emailSubj, "*****@*****.**");
                mailObj.sendEmail("consignmentUpload_success", emailSubj, "*****@*****.**");

                return true;
            }
            catch (Exception ee)
            {
                connErrMsg = ee.Message.ToString();
                return false;
            }
        }
コード例 #4
0
        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;
            }
        }