Esempio n. 1
0
        }//end event

        protected void btnCreate_Click(object sender, EventArgs e)
        {
            if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
            {
                HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                Session sessionObject = new Session();
                FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
                string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                cookie.Expires = newTicket.Expiration;
                Response.Cookies.Add(cookie);

            }//end if

            CreatePassword passwordObject = new CreatePassword();

            string password = passwordObject.Create_Password(8);

            string firstName = txtFirstName.Text;
            string lastName = txtLastName.Text;
            string username = txtUsername.Text;
            string role = ddlRole.SelectedValue;
            string verified = "N";
            string counselor = ddlCounselor.SelectedValue;
            DateTime dateCreated = DateTime.Today;
            int numberOfLogins = 0;
            string securityQuestion = ddlSecurityQuestion.SelectedValue;
            string securityAnswer = txtSecurityAnswer.Text;

            txtFirstName.Text = string.Empty;
            txtLastName.Text = string.Empty;
            txtUsername.Text = string.Empty;
            ddlSecurityQuestion.SelectedValue = string.Empty;
            txtSecurityAnswer.Text = string.Empty;
            txtConfirm.Text = string.Empty;

            if (role == "Counselor")
            {
                role = "Admin";

            }//end if

            string errorMessage;

            Select selectObject = new Select();

            string counselorName;

            counselorName = Select.Select_Counselor_Name(counselor);

            errorMessage = selectObject.getErrorMessage();

            if (errorMessage != null)
            {
                lblError.Text = errorMessage;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.SQLServerErrorMessage);

            }//end if

            else
            {
                Validate validationObject = new Validate();

                username = validationObject.Truncate(username, 100);
                firstName = validationObject.Truncate(firstName, 100);
                lastName = validationObject.Truncate(lastName, 100);
                password = validationObject.Truncate(password, 100);
                role = validationObject.Truncate(role, 100);
                verified = validationObject.Truncate(verified, 900);
                counselor = validationObject.Truncate(counselor, 900);
                counselorName = validationObject.Truncate(counselorName, 100);
                securityQuestion = validationObject.Truncate(securityQuestion, 100);
                securityAnswer = validationObject.Truncate(securityAnswer, 100);

                Aes encryptionObject = Aes.Create();

                byte[] AesKey = encryptionObject.Key;

                byte[] AesIV = encryptionObject.IV;

                string AesKeyString = Convert.ToBase64String(AesKey);

                string AesIVString = Convert.ToBase64String(AesIV);

                byte[] MasterKey = Encryption.GetMasterKey();

                byte[] MasterIV = Encryption.GetMasterIV();

                byte[] encryptedFirstName = Encryption.Encrypt_AES(firstName, AesKey, AesIV);

                string encryptedFirstNameString = Convert.ToBase64String(encryptedFirstName);

                byte[] encryptedLastName = Encryption.Encrypt_AES(lastName, AesKey, AesIV);

                string encryptedLastNameString = Convert.ToBase64String(encryptedLastName);

                byte[] encryptedRole = Encryption.Encrypt_AES(role, AesKey, AesIV);

                string encryptedRoleString = Convert.ToBase64String(encryptedRole);

                byte[] encryptedPassword = Encryption.Encrypt_AES(password, AesKey, AesIV);

                string encryptedPasswordString = Convert.ToBase64String(encryptedPassword);

                byte[] encryptedSecurityQuestion = Encryption.Encrypt_AES(securityQuestion, AesKey, AesIV);

                string encryptedSecurityQuestionString = Convert.ToBase64String(encryptedSecurityQuestion);

                byte[] encryptedSecurityAnswer = Encryption.Encrypt_AES(securityAnswer, AesKey, AesIV);

                string encryptedSecurityAnswerString = Convert.ToBase64String(encryptedSecurityAnswer);

                byte[] encryptedAesKey = Encryption.Encrypt_AES(AesKeyString, MasterKey, MasterIV);

                byte[] encryptedAesIV = Encryption.Encrypt_AES(AesIVString, MasterKey, MasterIV);

                string encryptedAesKeyString = Convert.ToBase64String(encryptedAesKey);

                string encryptedAesIVString = Convert.ToBase64String(encryptedAesIV);

                byte[] encryptedCounselorName = Encryption.Encrypt_AES(counselorName, AesKey, AesIV);

                string encryptedCounselorNameString = Convert.ToBase64String(encryptedCounselorName);

                bool recordExists;

                string errorMessage2;

                Select selectObject2 = new Select();

                recordExists = Select.User_Exists(username);

                errorMessage2 = selectObject2.getErrorMessage();

                if (errorMessage2 != null)
                {
                    lblError.Text = errorMessage2;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.SQLServerErrorMessage);

                }//end if

                if (recordExists == true)
                {
                    MsgBox("Invalid username. An account for this username already exists. Please try again.");

                }//end if

                else if (recordExists == false)
                {
                    string errorMessage3;

                    errorMessage3 = Insert.Insert_BESTPATH_USER(encryptedFirstNameString, encryptedLastNameString, username, encryptedPasswordString, encryptedRoleString, verified, counselor, encryptedCounselorNameString, dateCreated, numberOfLogins, encryptedSecurityQuestionString, encryptedSecurityAnswerString, encryptedAesKeyString, encryptedAesIVString);

                    if (errorMessage3 != null)
                    {
                        lblError.Text = errorMessage3;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else
                    {
                        string errorMessage4;

                        errorMessage4 = Insert.Insert_BESTPATH_STATUS(username);

                        if (errorMessage4 != null)
                        {
                            lblError.Text = errorMessage4;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.SQLServerErrorMessage);

                        }//end if

                        else
                        {
                            string urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
                            string registrationUrl = "/PL/Membership/Registration.aspx";
                            string fullPath = urlBase + registrationUrl;
                            string AppPath = Request.PhysicalApplicationPath;
                            StreamReader sr = new StreamReader(AppPath + "SA/Email_Templates/Welcome.txt");

                            Email emailObject = new Email();

                            string errorMessage5;

                            errorMessage5 = Email.Email_Welcome(counselor, firstName, username, password, fullPath, sr);

                            if (errorMessage5 != null)
                            {
                                lblError.Text = errorMessage5;
                                lblError.Visible = true;

                                ErrorMessage message = new ErrorMessage();

                                MsgBox(message.EmailErrorMessage);

                            }//end if

                            else
                            {
                                MsgBox("Account created successfully. An email has just been sent to the client who will need to check their email for his/her login credentials and further instructions, in order to login to the website.");

                            }//end else

                        }//end else

                    }//end else

                }//end else if

            }//end else

        }//end event
Esempio n. 2
0
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string username = TextBox1.Text;
            string password = TextBox2.Text;
            string newPassword = TextBox3.Text;
            string firstName = TextBox5.Text;
            string lastName = TextBox6.Text;
            string DOB = TextBox7.Text;
            string streetAddress = TextBox8.Text;
            string city = TextBox9.Text;
            string state = txtState.Text;
            string zipCode = TextBox10.Text;
            string country = txtCountry.Text;
            string phone = TextBox11.Text;

            username = username.Trim();

            password = password.Trim();

            Validate validationObject = new Validate();

            newPassword = validationObject.Truncate(newPassword, 100);
            firstName = validationObject.Truncate(firstName, 100);
            lastName = validationObject.Truncate(lastName, 100);
            DOB = validationObject.Truncate(DOB, 100);
            streetAddress = validationObject.Truncate(streetAddress, 100);
            city = validationObject.Truncate(city, 100);
            state = validationObject.Truncate(state, 100);
            zipCode = validationObject.Truncate(zipCode, 100);
            country = validationObject.Truncate(country, 100);
            phone = validationObject.Truncate(phone, 100);

            if (PasswordPolicy.IsValid(newPassword) == false)
            {
                MsgBox("Invalid new password. New password must be a strong password.");

            }//end if

            else
            {
                bool authenticated;

                string errorMessage;

                Select selectObject = new Select();

                authenticated = Select.Authenticate_User(username, password);

                errorMessage = selectObject.getErrorMessage();

                if (errorMessage != null)
                {
                    lblError.Text = errorMessage;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.SQLServerErrorMessage);

                }//end if

                else if (authenticated == false)
                {
                    MsgBox("Invalid credentials. Please try again.");

                }//end else if

                else if (authenticated == true)
                {
                    bool clientExists;
                    
                    string _errorMessage;

                    Select _selectObject = new Select();

                    clientExists = Select.Client_Exists(username);

                    _errorMessage = _selectObject.getErrorMessage();

                    if (_errorMessage != null)
                    {
                        lblError.Text = errorMessage;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else if (clientExists == true)
                    {
                        MsgBox("Invalid username. The client with the username you provided has already registered. If the username provided is correct, you may now login using your username and the password you created when you registered previously. Otherwise, please register with your correct username and password.");

                    }//end else if

                    else if (clientExists == false)
                    {
                        Aes encryptionObject = Aes.Create();

                        byte[] AesKey = encryptionObject.Key;

                        byte[] AesIV = encryptionObject.IV;

                        string AesKeyString = Convert.ToBase64String(AesKey);

                        string AesIVString = Convert.ToBase64String(AesIV);

                        byte[] MasterKey = Encryption.GetMasterKey();

                        byte[] MasterIV = Encryption.GetMasterIV();

                        ArrayList roleData = new ArrayList();

                        roleData = Select.Select_Role_Data(username);

                        string encryptedKey = roleData[1].ToString();

                        string encryptedIV = roleData[2].ToString();

                        byte[] encryptedKeyArray = Convert.FromBase64String(encryptedKey);

                        byte[] encryptedIVArray = Convert.FromBase64String(encryptedIV);

                        string decryptedKey = Encryption.Decrypt_AES(encryptedKeyArray, MasterKey, MasterIV);

                        string decryptedIV = Encryption.Decrypt_AES(encryptedIVArray, MasterKey, MasterIV);

                        byte[] decryptedKeyArray = Convert.FromBase64String(decryptedKey);

                        byte[] decryptedIVArray = Convert.FromBase64String(decryptedIV);

                        byte[] encryptedPassword = Encryption.Encrypt_AES(newPassword, decryptedKeyArray, decryptedIVArray);

                        string encryptedPasswordString = Convert.ToBase64String(encryptedPassword);

                        byte[] encryptedAesKey = Encryption.Encrypt_AES(AesKeyString, MasterKey, MasterIV);

                        byte[] encryptedAesIV = Encryption.Encrypt_AES(AesIVString, MasterKey, MasterIV);

                        string encryptedAesKeyString = Convert.ToBase64String(encryptedAesKey);

                        string encryptedAesIVString = Convert.ToBase64String(encryptedAesIV);

                        byte[] encryptedFirstName = Encryption.Encrypt_AES(firstName, AesKey, AesIV);

                        string encryptedFirstNameString = Convert.ToBase64String(encryptedFirstName);

                        byte[] encryptedLastName = Encryption.Encrypt_AES(lastName, AesKey, AesIV);

                        string encryptedLastNameString = Convert.ToBase64String(encryptedLastName);

                        byte[] encryptedDOB = Encryption.Encrypt_AES(DOB, AesKey, AesIV);

                        string encryptedDOBString = Convert.ToBase64String(encryptedDOB);

                        byte[] encryptedStreetAddress = Encryption.Encrypt_AES(streetAddress, AesKey, AesIV);

                        string encryptedStreetAddressString = Convert.ToBase64String(encryptedStreetAddress);

                        byte[] encryptedCity = Encryption.Encrypt_AES(city, AesKey, AesIV);

                        string encryptedCityString = Convert.ToBase64String(encryptedCity);

                        byte[] encryptedState = Encryption.Encrypt_AES(state, AesKey, AesIV);

                        string encryptedStateString = Convert.ToBase64String(encryptedState);

                        byte[] encryptedZipCode = Encryption.Encrypt_AES(zipCode, AesKey, AesIV);

                        string encryptedZipCodeString = Convert.ToBase64String(encryptedZipCode);

                        byte[] encryptedCountry = Encryption.Encrypt_AES(country, AesKey, AesIV);

                        string encryptedCountryString = Convert.ToBase64String(encryptedCountry);

                        byte[] encryptedPhone = Encryption.Encrypt_AES(phone, AesKey, AesIV);

                        string encryptedPhoneString = Convert.ToBase64String(encryptedPhone);

                        string errorMessage2;

                        Insert insertObject = new Insert();

                        errorMessage2 = Insert.Insert_CLIENT(username, encryptedFirstNameString, encryptedLastNameString, encryptedDOBString, encryptedStreetAddressString, encryptedCityString, encryptedStateString, encryptedZipCodeString, encryptedCountryString, encryptedPhoneString, encryptedAesKeyString, encryptedAesIVString);

                        if (errorMessage2 != null)
                        {
                            lblError.Text = errorMessage2;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.SQLServerErrorMessage);

                        }//end if

                        else
                        {
                            string errorMessage3;

                            Update updateObject = new Update();

                            errorMessage3 = Update.Update_Password(username, encryptedPasswordString);

                            if (errorMessage3 != null)
                            {
                                lblError.Text = errorMessage3;
                                lblError.Visible = true;

                                ErrorMessage message = new ErrorMessage();

                                MsgBox(message.SQLServerErrorMessage);

                            }//end if

                            else
                            {
                                string errorMessage4;

                                errorMessage4 = Update.Update_Verify_New_User(username);

                                errorMessage4 = selectObject.getErrorMessage();

                                if (errorMessage4 != null)
                                {
                                    lblError.Text = errorMessage4;
                                    lblError.Visible = true;

                                    ErrorMessage message = new ErrorMessage();

                                    MsgBox(message.SQLServerErrorMessage);

                                }//end if

                                else
                                {
                                    Session["JustRegistered"] = "true";

                                    Response.Redirect("~/PL/Membership/Login.aspx");

                                }//end else

                            }//end else

                        }//end else

                    }//end else if

                }//end else

            }//end else
          
        }//end event
Esempio n. 3
0
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (PasswordPolicy.IsValid(txtPassword.Text) == false)
            {
                MsgBox("Invalid password. Password must be a strong password.");

            }//end if

            else
            {
                string username = txtUsername.Text;
                string password = txtPassword.Text;
                string firstName = txtFirstName.Text;
                string lastName = txtLastName.Text;
                string age = txtAge.Text;
                string streetAddress = txtStreetAddress.Text;
                string city = txtCity.Text;
                string state = txtState.Text;
                string zipCode = txtZipCode.Text;
                string country = txtCountry.Text;
                string phoneNumber = txtPhoneNumber.Text;
                string securityQuestion = ddlSecurityQuestion.SelectedValue;
                string securityAnswer = txtSecurityAnswer.Text;
                string referralSource = ddlReferralSource.SelectedValue;
                string referralName = txtReferralName.Text;
                string RUGAPCEmailAddress = txtRUGAPCEmailAddress.Text;

                string role = "Client";
                string verified = "N";
                string counselor = "*****@*****.**";
                int numberOfLogins = 0;
                DateTime dateCreated = DateTime.Today;

                if (RUGAPCEmailAddress != "")
                {
                    counselor = RUGAPCEmailAddress;

                    bool isRUGAPC;

                    string errorMessage30;

                    Select selectObject30 = new Select();

                    isRUGAPC = Select.Is_User_RUG_APC(RUGAPCEmailAddress);

                    errorMessage30 = selectObject30.getErrorMessage();

                    if(errorMessage30 != null)
                    {
                        lblError.Text = errorMessage30;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else if(isRUGAPC == false)
                    {
                        MsgBox("Invalid. User specified for RUG APC is not a RUG APC in the system. Please confer with Jim Davis, founder.");

                        return;

                    }//end else if

                }//end if

                Validate validationObject = new Validate();

                username = validationObject.Truncate(username, 100);
                password = validationObject.Truncate(password, 100);
                firstName = validationObject.Truncate(firstName, 100);
                lastName = validationObject.Truncate(lastName, 100);
                age = validationObject.Truncate(age, 100);
                streetAddress = validationObject.Truncate(streetAddress, 100);
                city = validationObject.Truncate(city, 100);
                state = validationObject.Truncate(state, 100);
                zipCode = validationObject.Truncate(zipCode, 100);
                country = validationObject.Truncate(country, 100);
                phoneNumber = validationObject.Truncate(phoneNumber, 100);
                securityQuestion = validationObject.Truncate(securityQuestion, 100);
                securityAnswer = validationObject.Truncate(securityAnswer, 100);
                referralSource = validationObject.Truncate(referralSource, 900);
                referralName = validationObject.Truncate(referralName, 900);
                RUGAPCEmailAddress = validationObject.Truncate(RUGAPCEmailAddress, 900);

                bool CLIENT_Exists_Counselor;

                string errorMessage20;

                Select selectObject20 = new Select();

                CLIENT_Exists_Counselor = Select.Client_Exists(counselor);

                errorMessage20 = selectObject20.getErrorMessage();

                if (errorMessage20 != null)
                {
                    lblError.Text = errorMessage20;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.SQLServerErrorMessage);

                }//end if

                else if (CLIENT_Exists_Counselor == false)
                {
                    MsgBox("Invalid. The RUG Authorized Personal Counselor (APC) email address does not exist in the system. Please check the spelling of that email address. Thank you.");

                }//end else if

                else if (CLIENT_Exists_Counselor == true)
                {
                    bool BESTPATH_USER_Exists_Counselor;

                    string errorMessage21;

                    Select selectObject21 = new Select();

                    BESTPATH_USER_Exists_Counselor = Select.User_Exists(counselor);

                    errorMessage21 = selectObject21.getErrorMessage();

                    if (errorMessage21 != null)
                    {
                        lblError.Text = errorMessage21;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else if (BESTPATH_USER_Exists_Counselor == false)
                    {
                        MsgBox("Invalid. The RUG Authorized Personal Counselor (APC) email address does not exist in the system. Please check the spelling of that email address. Thank you.");

                    }//end else if

                    else if (BESTPATH_USER_Exists_Counselor == true)
                    {
                        string errorMessage;

                        Select selectObject = new Select();

                        ArrayList counselorData = new ArrayList();

                        counselorData = Select.Select_Counselor_Data(counselor);

                        errorMessage = selectObject.getErrorMessage();

                        if (errorMessage != null)
                        {
                            lblError.Text = errorMessage;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.SQLServerErrorMessage);

                        }//end if

                        else
                        {
                            string counselorName = counselorData[0].ToString();

                            string counselorPhoneNumber = counselorData[1].ToString();

                            bool CLIENT_Exists;

                            string errorMessage4;

                            Select selectObject4 = new Select();

                            CLIENT_Exists = Select.Client_Exists(username);

                            errorMessage4 = selectObject4.getErrorMessage();

                            if (errorMessage4 != null)
                            {
                                lblError.Text = errorMessage4;
                                lblError.Visible = true;

                                ErrorMessage message = new ErrorMessage();

                                MsgBox(message.SQLServerErrorMessage);

                            }//end if

                            else if (CLIENT_Exists == true)
                            {
                                MsgBox("Invalid. You have already registered. You may now login with your username and password that you created on this page previously.");

                            }//end else if

                            else if (CLIENT_Exists == false)
                            {
                                bool BESTPATH_USER_Exists;

                                string errorMessage5;

                                Select selectObject5 = new Select();

                                BESTPATH_USER_Exists = Select.User_Exists(username);

                                errorMessage5 = selectObject5.getErrorMessage();

                                if (errorMessage5 != null)
                                {
                                    lblError.Text = errorMessage5;
                                    lblError.Visible = true;

                                    ErrorMessage message = new ErrorMessage();

                                    MsgBox(message.SQLServerErrorMessage);

                                }//end if

                                else if (BESTPATH_USER_Exists == true)
                                {
                                    MsgBox("Invalid. You have already registered. You may now login with your username and password that you created on this page previously.");

                                }//end else if

                                else if (BESTPATH_USER_Exists == false)
                                {
                                    Aes encryptionObject = Aes.Create();

                                    byte[] AesKey = encryptionObject.Key;

                                    byte[] AesIV = encryptionObject.IV;

                                    string AesKeyString = Convert.ToBase64String(AesKey);

                                    string AesIVString = Convert.ToBase64String(AesIV);

                                    byte[] MasterKey = Encryption.GetMasterKey();

                                    byte[] MasterIV = Encryption.GetMasterIV();

                                    byte[] encryptedAesKey = Encryption.Encrypt_AES(AesKeyString, MasterKey, MasterIV);

                                    byte[] encryptedAesIV = Encryption.Encrypt_AES(AesIVString, MasterKey, MasterIV);

                                    string encryptedAesKeyString = Convert.ToBase64String(encryptedAesKey);

                                    string encryptedAesIVString = Convert.ToBase64String(encryptedAesIV);

                                    byte[] encryptedPassword = Encryption.Encrypt_AES(password, AesKey, AesIV);

                                    string encryptedPasswordString = Convert.ToBase64String(encryptedPassword);

                                    byte[] encryptedFirstName = Encryption.Encrypt_AES(firstName, AesKey, AesIV);

                                    string encryptedFirstNameString = Convert.ToBase64String(encryptedFirstName);

                                    byte[] encryptedLastName = Encryption.Encrypt_AES(lastName, AesKey, AesIV);

                                    string encryptedLastNameString = Convert.ToBase64String(encryptedLastName);

                                    byte[] encryptedAge = Encryption.Encrypt_AES(age, AesKey, AesIV);

                                    string encryptedAgeString = Convert.ToBase64String(encryptedAge);

                                    byte[] encryptedStreetAddress = Encryption.Encrypt_AES(streetAddress, AesKey, AesIV);

                                    string encryptedStreetAddressString = Convert.ToBase64String(encryptedStreetAddress);

                                    byte[] encryptedCity = Encryption.Encrypt_AES(city, AesKey, AesIV);

                                    string encryptedCityString = Convert.ToBase64String(encryptedCity);

                                    byte[] encryptedState = Encryption.Encrypt_AES(state, AesKey, AesIV);

                                    string encryptedStateString = Convert.ToBase64String(encryptedState);

                                    byte[] encryptedZipCode = Encryption.Encrypt_AES(zipCode, AesKey, AesIV);

                                    string encryptedZipCodeString = Convert.ToBase64String(encryptedZipCode);

                                    byte[] encryptedCountry = Encryption.Encrypt_AES(country, AesKey, AesIV);

                                    string encryptedCountryString = Convert.ToBase64String(encryptedCountry);

                                    byte[] encryptedPhoneNumber = Encryption.Encrypt_AES(phoneNumber, AesKey, AesIV);

                                    string encryptedPhoneNumberString = Convert.ToBase64String(encryptedPhoneNumber);

                                    byte[] encryptedSecurityQuestion = Encryption.Encrypt_AES(securityQuestion, AesKey, AesIV);

                                    string encryptedSecurityQuestionString = Convert.ToBase64String(encryptedSecurityQuestion);

                                    byte[] encryptedSecurityAnswer = Encryption.Encrypt_AES(securityAnswer, AesKey, AesIV);

                                    string encryptedSecurityAnswerString = Convert.ToBase64String(encryptedSecurityAnswer);

                                    byte[] encryptedRole = Encryption.Encrypt_AES(role, AesKey, AesIV);

                                    string encryptedRoleString = Convert.ToBase64String(encryptedRole);

                                    byte[] encryptedCounselorName = Encryption.Encrypt_AES(counselorName, AesKey, AesIV);

                                    string encryptedCounselorNameString = Convert.ToBase64String(encryptedCounselorName);

                                    string errorMessage7;

                                    errorMessage7 = Insert.Insert_Registration_Transaction(username, encryptedPasswordString, encryptedFirstNameString, encryptedLastNameString, encryptedAgeString, encryptedStreetAddressString, encryptedCityString, encryptedStateString, encryptedZipCodeString, encryptedCountryString, encryptedPhoneNumberString, encryptedAesKeyString, encryptedAesIVString, encryptedRoleString, verified, counselor, encryptedCounselorNameString, dateCreated, numberOfLogins, encryptedSecurityQuestionString, encryptedSecurityAnswerString, referralSource, referralName, RUGAPCEmailAddress);

                                    if (errorMessage7 != null)
                                    {
                                        lblError.Text = errorMessage7;
                                        lblError.Visible = true;

                                        ErrorMessage message = new ErrorMessage();

                                        MsgBox(message.SQLServerErrorMessage);

                                    }//end if

                                    else
                                    {
                                        string urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;

                                        string verificationUrl = "PL/Membership/VerifyNewUser.aspx";

                                        string queryString = "?username="******"SA/Email_Templates/Verification.txt");

                                        string errorMessage8;

                                        errorMessage8 = Email.Email_Verification(username, firstName, fullPath, sr);

                                        if (errorMessage8 != null)
                                        {
                                            lblError.Text = errorMessage8;
                                            lblError.Visible = true;

                                            ErrorMessage message = new ErrorMessage();

                                            MsgBox(message.SQLServerErrorMessage);

                                        }//end if

                                        else
                                        {
                                            StreamReader sr2 = new StreamReader(appPath + "SA/Email_Templates/NewClient.txt");

                                            string date = String.Format(System.DateTime.Today.ToShortDateString());

                                            string errorMessage9;

                                            errorMessage9 = Email.Email_New_Client(date, username, firstName, lastName, phoneNumber, sr2, counselor, counselorName, counselorPhoneNumber);

                                            if (errorMessage9 != null)
                                            {
                                                lblError.Text = errorMessage9;
                                                lblError.Visible = true;

                                                ErrorMessage message = new ErrorMessage();

                                                MsgBox(message.SQLServerErrorMessage);

                                            }//end if

                                            else if(RUGAPCEmailAddress != "")
                                            {
                                                StreamReader sr3 = new StreamReader(appPath + "SA/Email_Templates/PayAPC.txt");

                                                string dateToday = String.Format(System.DateTime.Today.ToShortDateString());

                                                DateTime dateToPay = DateTime.Now.AddDays(4);

                                                string errorMessage40;

                                                errorMessage40 = Email.Email_Pay_APC(dateToday, username, firstName, lastName, phoneNumber, sr3, counselor, counselorName, counselorPhoneNumber, dateToPay);

                                                if (errorMessage40 != null)
                                                {
                                                    lblError.Text = errorMessage40;
                                                    lblError.Visible = true;

                                                    ErrorMessage message = new ErrorMessage();

                                                    MsgBox(message.SQLServerErrorMessage);

                                                }//end if

                                            }//end else

                                            MsgBox("Please check your email to complete the registration process.");

                                        }//end else

                                    }//end else

                                }//end else

                            }//end else

                        }//end else

                    }//end else

                }//end else if

            }//end else if

        }//end event
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
            Session sessionObject = new Session();
            FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
            string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
            cookie.Expires = newTicket.Expiration;
            Response.Cookies.Add(cookie);

            string username = ticket.Name;

            string Q1 = txtQ1.InnerText;
            string Q2 = txtQ2.InnerText;
            string Q3 = txtQ3.InnerText;
            string Q4 = txtQ4.InnerText;
            string Q5 = txtQ5.InnerText;
            string Q6 = txtQ6.InnerText;
            string Q7 = txtQ7.InnerText;
            string Q8 = txtQ8.InnerText;
            string Q9 = txtQ9.InnerText;
            string Q10 = txtQ10.InnerText;
            string Q11 = txtQ11.InnerText;
            string Q12 = txtQ12.InnerText;
            string Q13 = txtQ13.InnerText;

            Validate validationObject = new Validate();

            Q1 = validationObject.Truncate(Q1, 900);
            Q2 = validationObject.Truncate(Q2, 900);
            Q3 = validationObject.Truncate(Q3, 900);
            Q4 = validationObject.Truncate(Q4, 900);
            Q5 = validationObject.Truncate(Q5, 900);
            Q6 = validationObject.Truncate(Q6, 900);
            Q7 = validationObject.Truncate(Q7, 900);
            Q8 = validationObject.Truncate(Q8, 900);
            Q9 = validationObject.Truncate(Q9, 900);
            Q10 = validationObject.Truncate(Q10, 900);
            Q11 = validationObject.Truncate(Q11, 900);
            Q12 = validationObject.Truncate(Q12, 900);
            Q13 = validationObject.Truncate(Q13, 900);

            bool recordExists;

            string errorMessage;

            Select selectObject = new Select();

            recordExists = Select.Select_Focus_Experience8(username);

            errorMessage = selectObject.getErrorMessage();

            if (errorMessage != null)
            {
                lblError.Text = errorMessage;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.SQLServerErrorMessage);

            }//end if

            else
            {
                if (recordExists == true)
                {

                }//end if

                else if (recordExists == false)
                {
                    string errorMessage2;

                    errorMessage2 = Insert.Insert_Focus_Experience8(username, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13);

                    if (errorMessage2 != null)
                    {
                        lblError.Text = errorMessage2;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else
                    {
                        string errorMessage3;

                        errorMessage3 = Update.Update_Focus_Experience8_Status(username);

                        if (errorMessage3 != null)
                        {
                            lblError.Text = errorMessage3;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.SQLServerErrorMessage);

                        }//end if

                        else
                        {
                            Response.Redirect("~/PL/FOP/FOP_ProgressMenu.aspx");

                        }//end else

                    }//end else

                }//end else if

            }//end else

        }//end event
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DateTime today = DateTime.Today;

            string firstName = txtFirstName.Text;
            string lastName = txtLastName.Text;
            string emailAddress = txtEmailAddress.Text;
            string phoneNumber = txtPhoneNumber.Text;
            string Q5 = rblQ5.SelectedValue;
            string Q6 = txtQ6.InnerText;
            string Q7 = txtQ7.InnerText;
            string Q8 = txtQ8.InnerText;
            string Q9 = rblQ9.SelectedValue;
            string Q10 = txtQ10.InnerText;
            string Q11 = rblQ11.SelectedValue;
            string Q12 = rblQ12.SelectedValue;
            string Q13 = txtQ13.InnerText;
            string Q14 = txtQ14.InnerText;
            string Q15 = txtQ15.InnerText;
            string Q16 = txtQ16.InnerText;
            string Q17 = txtQ17.InnerText;
            string Q18 = txtQ18.InnerText;
            string Q19 = txtQ19.InnerText;
            string Q20 = txtQ20.InnerText;
            string Q21 = txtQ21.InnerText;
            string Q22 = txtQ22.InnerText;
            string Q23 = txtQ23.InnerText;
            string Q24 = txtQ24.InnerText;
            string Q25 = txtQ25.InnerText;
            string Q26 = txtQ26.InnerText;
            string Q27 = txtQ27.InnerText;
            string Q28 = txtQ28.InnerText;
            string Q29 = txtQ29.InnerText;
            string Q30 = txtQ30.InnerText;
            string Q31 = txtQ31.InnerText;
            string Q32 = txtQ32.InnerText;
            string Q33 = txtQ33.InnerText;
            string Q34 = txtQ34.InnerText;
            string Q35 = txtQ35.InnerText;
            string Q36 = rblQ36.SelectedValue;
            string Q37 = txtQ37.InnerText;
            string Q38 = txtQ38.InnerText;
            string Q39 = txtQ39.InnerText;
            string Q40 = txtQ40.InnerText;
            string Q41 = txtQ41.InnerText;
            string Q42 = txtQ42.InnerText;
            string Q43 = txtQ43.InnerText;
            string Q44 = txtQ44.InnerText;
            string Q45 = txtQ45.InnerText;
            string Q46 = txtQ46.InnerText;
            string referralSource = ddlReferralSource.SelectedValue;
            string referralName = txtReferralName.Text;
            string RUGAPCEmailAddress = txtRUGAPCEmailAddress.Text;

            Validate validationObject = new Validate();

            firstName = validationObject.Truncate(firstName, 900);
            lastName = validationObject.Truncate(lastName, 900);
            emailAddress = validationObject.Truncate(emailAddress, 900);
            phoneNumber = validationObject.Truncate(phoneNumber, 900);
            Q5 = validationObject.Truncate(Q5, 900);
            Q6 = validationObject.Truncate(Q6, 900);
            Q7 = validationObject.Truncate(Q7, 900);
            Q8 = validationObject.Truncate(Q8, 900);
            Q9 = validationObject.Truncate(Q9, 900);
            Q10 = validationObject.Truncate(Q10, 900);
            Q11 = validationObject.Truncate(Q11, 900);
            Q12 = validationObject.Truncate(Q12, 900);
            Q13 = validationObject.Truncate(Q13, 900);
            Q14 = validationObject.Truncate(Q14, 900);
            Q15 = validationObject.Truncate(Q15, 900);
            Q16 = validationObject.Truncate(Q16, 900);
            Q17 = validationObject.Truncate(Q17, 900);
            Q18 = validationObject.Truncate(Q18, 900);
            Q19 = validationObject.Truncate(Q19, 900);
            Q20 = validationObject.Truncate(Q20, 900);
            Q21 = validationObject.Truncate(Q21, 900);
            Q22 = validationObject.Truncate(Q22, 900);
            Q23 = validationObject.Truncate(Q23, 900);
            Q24 = validationObject.Truncate(Q24, 900);
            Q25 = validationObject.Truncate(Q25, 900);
            Q26 = validationObject.Truncate(Q26, 900);
            Q27 = validationObject.Truncate(Q27, 900);
            Q28 = validationObject.Truncate(Q28, 900);
            Q29 = validationObject.Truncate(Q29, 900);
            Q30 = validationObject.Truncate(Q30, 900);
            Q31 = validationObject.Truncate(Q31, 900);
            Q32 = validationObject.Truncate(Q32, 900);
            Q33 = validationObject.Truncate(Q33, 900);
            Q34 = validationObject.Truncate(Q34, 900);
            Q35 = validationObject.Truncate(Q35, 900);
            Q36 = validationObject.Truncate(Q36, 900);
            Q37 = validationObject.Truncate(Q37, 900);
            Q38 = validationObject.Truncate(Q38, 900);
            Q39 = validationObject.Truncate(Q39, 900);
            Q40 = validationObject.Truncate(Q40, 900);
            Q41 = validationObject.Truncate(Q41, 900);
            Q42 = validationObject.Truncate(Q42, 900);
            Q43 = validationObject.Truncate(Q43, 900);
            Q44 = validationObject.Truncate(Q44, 900);
            Q45 = validationObject.Truncate(Q45, 900);
            Q46 = validationObject.Truncate(Q46, 900);
            referralSource = validationObject.Truncate(referralSource, 900);
            referralName = validationObject.Truncate(referralName, 900);
            RUGAPCEmailAddress = validationObject.Truncate(RUGAPCEmailAddress, 900);

            string errorMessage;

            Select selectObject = new Select();

            bool preliminaryNeedsAssessmentExists;

            preliminaryNeedsAssessmentExists = Select.Preliminary_Needs_Assessment_Exists(emailAddress);

            errorMessage = selectObject.getErrorMessage();

            if (errorMessage != null)
            {
                lblError.Text = errorMessage;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.GenericErrorMessage);

            }//end if

            else if (preliminaryNeedsAssessmentExists == true)
            {
                MsgBox("Invalid. This assessment has already been submitted.");

            }//end else if

            else if (preliminaryNeedsAssessmentExists == false)
            {
                if (RUGAPCEmailAddress != "")
                {
                    bool isRUGAPC;

                    string errorMessage30;

                    Select selectObject30 = new Select();

                    isRUGAPC = Select.Is_User_RUG_APC(RUGAPCEmailAddress);

                    errorMessage30 = selectObject30.getErrorMessage();

                    if (errorMessage30 != null)
                    {
                        lblError.Text = errorMessage30;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else if (isRUGAPC == false)
                    {
                        MsgBox("Invalid. User specified for RUG APC is not a RUG APC in the system. Please confer with Jim Davis, founder.");

                        return;

                    }//end else if

                }//end if

                string errorMessage2;

                errorMessage2 = Insert.Insert_Preliminary_Needs_Assessment(today, emailAddress, firstName, lastName, phoneNumber, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q19, Q20, Q21, Q22, Q23, Q24, Q25, Q26, Q27, Q28, Q29, Q30, Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, Q39, Q40, Q41, Q42, Q43, Q44, Q45, Q46, referralSource, referralName, RUGAPCEmailAddress);

                if (errorMessage2 != null)
                {
                    lblError.Text = errorMessage2;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.GenericErrorMessage);

                }//end if

                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Thank you very much for taking the time to share this information with us. Now, the next step for you is to complete the Career Marketability Assessment. May God richly bless you and your life path endeavors!');window.location ='../../Home.aspx';", true);

                }//end else

            }//end else if

        }//end event
Esempio n. 6
0
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
            {
                HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                Session sessionObject = new Session();
                FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
                string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
                HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                cookie.Expires = newTicket.Expiration;
                Response.Cookies.Add(cookie);

            }//end if
            
            string username = TextBox1.Text;
            string _dateOfIncident = TextBox5.Text;
            DateTime dateOfIncident = Convert.ToDateTime(_dateOfIncident);
            string descriptionOfProblem = TextBox3.InnerText;

            Validate validationObject = new Validate();

            descriptionOfProblem = validationObject.Truncate(descriptionOfProblem, 900);

            string clientName = "";

            string errorMessage3;

            Select selectObject = new Select();

            if (username != "")
            {
                clientName = Select.Select_Client_Name(username);

            }//end if

            errorMessage3 = selectObject.getErrorMessage();

            if (errorMessage3 != null)
            {
                lblError.Text = errorMessage3;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.SQLServerErrorMessage);

            }//end if

            else
            {
                string errorMessage;

                errorMessage = Insert.Insert_Help_Log(username, clientName, dateOfIncident, descriptionOfProblem);

                if (errorMessage != null)
                {
                    lblError.Text = errorMessage;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.SQLServerErrorMessage);

                }//end if

                else
                {
                    string AppPath = Request.PhysicalApplicationPath;
                    StreamReader sr = new StreamReader(AppPath + "SA/Email_Templates/NewHelpRequest.txt");

                    Email emailObject = new Email();

                    string errorMessage2;

                    errorMessage2 = Email.Email_Help(username, clientName, _dateOfIncident, descriptionOfProblem, sr);

                    if (errorMessage2 != null)
                    {
                        lblError.Text = errorMessage2;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.EmailErrorMessage);

                    }//end if

                    else
                    {
                        MsgBox("This form has been submitted to the System Administrator. We will respond to your request as soon as we are able. Thank you.");

                    }//end else

                }//end else

            }//end else

        }//end event
Esempio n. 7
0
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DateTime dateCompleted2 = DateTime.Today;

            string emailAddress = txtEmailAddress.Text;
            string Q1 = txtQ1.Text;
            string Q2 = txtQ2.Text;
            string Q3 = txtQ3.Text;
            string Q4 = txtQ4.Text;
            string Q5 = txtQ5.Text;
            string Q6 = txtQ6.Text;
            string Q7 = txtQ7.Text;
            string Q8 = txtQ8.Text;
            string Q9 = txtQ9.Text;
            string Q10 = txtQ10.Text;
            string Q11 = txtQ11.Text;
            string Q12 = txtQ12.Text;
            string Q13 = txtQ13.Text;
            string Q14 = txtQ14.Text;
            string Q15 = txtQ15.Text;
            string Q16 = txtQ16.Text;
            string Q17 = txtQ17.Text;
            string Q18 = txtQ18.Text;
            string Q19 = txtQ19.Text;
            string Q20 = txtQ20.Text;

            Validate validationObject = new Validate();

            emailAddress = validationObject.Truncate(emailAddress, 900);
            Q1= validationObject.Truncate(Q1, 1);
            Q2 = validationObject.Truncate(Q2, 1);
            Q3 = validationObject.Truncate(Q3, 1);
            Q4 = validationObject.Truncate(Q4, 1);
            Q5 = validationObject.Truncate(Q5, 1);
            Q6 = validationObject.Truncate(Q6, 1);
            Q7 = validationObject.Truncate(Q7, 1);
            Q8 = validationObject.Truncate(Q8, 1);
            Q9 = validationObject.Truncate(Q9, 1);
            Q10 = validationObject.Truncate(Q10, 1);
            Q11 = validationObject.Truncate(Q11, 1);
            Q12 = validationObject.Truncate(Q12, 1);
            Q13 = validationObject.Truncate(Q13, 1);
            Q14 = validationObject.Truncate(Q14, 1);
            Q15 = validationObject.Truncate(Q15, 1);
            Q16 = validationObject.Truncate(Q16, 1);
            Q17 = validationObject.Truncate(Q17, 1);
            Q18 = validationObject.Truncate(Q18, 1);
            Q19 = validationObject.Truncate(Q19, 1);
            Q20 = validationObject.Truncate(Q20, 1);

            long _Q1 = Convert.ToInt64(Q1);
            long _Q2 = Convert.ToInt64(Q2);
            long _Q3 = Convert.ToInt64(Q3);
            long _Q4 = Convert.ToInt64(Q4);
            long _Q5 = Convert.ToInt64(Q5);
            long _Q6 = Convert.ToInt64(Q6);
            long _Q7 = Convert.ToInt64(Q7);
            long _Q8 = Convert.ToInt64(Q8);
            long _Q9 = Convert.ToInt64(Q9);
            long _Q10 = Convert.ToInt64(Q10);
            long _Q11 = Convert.ToInt64(Q11);
            long _Q12 = Convert.ToInt64(Q12);
            long _Q13 = Convert.ToInt64(Q13);
            long _Q14 = Convert.ToInt64(Q14);
            long _Q15 = Convert.ToInt64(Q15);
            long _Q16 = Convert.ToInt64(Q16);
            long _Q17 = Convert.ToInt64(Q17);
            long _Q18 = Convert.ToInt64(Q18);
            long _Q19 = Convert.ToInt64(Q19);
            long _Q20 = Convert.ToInt64(Q20);

            long score = _Q1 + _Q2 + _Q3 + _Q4 + _Q5 + _Q6 + _Q7 + _Q8 + _Q9 + _Q10 + _Q11 + _Q12 + _Q13 + _Q14 + _Q15 + _Q16 + _Q17 + _Q18 + _Q19 + _Q20;

            lblScore.Text = score.ToString();

            string errorMessage5;

            Select selectObject5 = new Select();

            ArrayList data = new ArrayList();

            data = Select.Select_PRELIMINARY_NEEDS_ASSESSMENT_Data(emailAddress);

            errorMessage5 = selectObject5.getErrorMessage();

            if (errorMessage5 != null)
            {
                lblError.Text = errorMessage5;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.SQLServerErrorMessage);

            }//end if

            else
            {
                string dateCompleted = data[1].ToString();
                string firstName = data[2].ToString();
                string lastName = data[3].ToString();
                string phoneNumber = data[4].ToString();
                string q5 = data[5].ToString();
                string q6 = data[6].ToString();
                string q7 = data[7].ToString();
                string q8 = data[8].ToString();
                string q9 = data[9].ToString();
                string q10 = data[10].ToString();
                string q11 = data[11].ToString();
                string q12 = data[12].ToString();
                string q13 = data[13].ToString();
                string q14 = data[14].ToString();
                string q15 = data[15].ToString();
                string q16 = data[16].ToString();
                string q17 = data[17].ToString();
                string q18 = data[18].ToString();
                string q19 = data[19].ToString();
                string q20 = data[20].ToString();
                string q21 = data[21].ToString();
                string q22 = data[22].ToString();
                string q23 = data[23].ToString();
                string q24 = data[24].ToString();
                string q25 = data[25].ToString();
                string q26 = data[26].ToString();
                string q27 = data[27].ToString();
                string q28 = data[28].ToString();
                string q29 = data[29].ToString();
                string q30 = data[30].ToString();
                string q31 = data[31].ToString();
                string q32 = data[32].ToString();
                string q33 = data[33].ToString();
                string q34 = data[34].ToString();
                string q35 = data[35].ToString();
                string q36 = data[36].ToString();
                string q37 = data[37].ToString();
                string q38 = data[38].ToString();
                string q39 = data[39].ToString();
                string q40 = data[40].ToString();
                string q41 = data[41].ToString();
                string q42 = data[42].ToString();
                string q43 = data[43].ToString();
                string q44 = data[44].ToString();
                string q45 = data[45].ToString();
                string q46 = data[46].ToString();
                string referralSource = data[47].ToString();
                string referralName = data[48].ToString();
                string RUGAPCEmailAddress = data[49].ToString();

                string counselor = "*****@*****.**";

                if (RUGAPCEmailAddress != "")
                {
                    counselor = RUGAPCEmailAddress;

                    bool isRUGAPC;

                    string errorMessage30;

                    Select selectObject30 = new Select();

                    isRUGAPC = Select.Is_User_RUG_APC(RUGAPCEmailAddress);

                    errorMessage30 = selectObject30.getErrorMessage();

                    if (errorMessage30 != null)
                    {
                        lblError.Text = errorMessage30;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else if (isRUGAPC == false)
                    {
                        MsgBox("Invalid. User specified for RUG APC is not a RUG APC in the system. Please confer with Jim Davis, founder.");

                        return;

                    }//end else if

                }//end if

                        string errorMessage;

                        Select selectObject = new Select();

                        bool careerMarketabilityAssessmentExists;

                        careerMarketabilityAssessmentExists = Select.Career_Marketability_Assessment_Exists(emailAddress);

                        errorMessage = selectObject.getErrorMessage();

                        if (errorMessage != null)
                        {
                            lblError.Text = errorMessage;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.GenericErrorMessage);

                        }//end if

                        else if (careerMarketabilityAssessmentExists == true)
                        {
                            MsgBox("Invalid. This assessment has already been submitted.");

                        }//end else if

                        else if (careerMarketabilityAssessmentExists == false)
                        {
                            string errorMessage2;

                            errorMessage2 = Insert.Insert_Career_Marketability_Assessment(emailAddress, dateCompleted2, _Q1, _Q2, _Q3, _Q4, _Q5, _Q6, _Q7, _Q8, _Q9, _Q10, _Q11, _Q12, _Q13, _Q14, _Q15, _Q16, _Q17, _Q18, _Q19, _Q20, score);

                            if (errorMessage2 != null)
                            {
                                lblError.Text = errorMessage2;
                                lblError.Visible = true;

                                ErrorMessage message = new ErrorMessage();

                                MsgBox(message.GenericErrorMessage);

                            }//end if

                            else
                            {
                                string AppPath = Request.PhysicalApplicationPath;
                                StreamReader sr = new StreamReader(AppPath + "SA/Email_Templates/NeedsAssessmentPackage.txt");

                                string errorMessage3;

                                string _dateCompleted2 = dateCompleted2.ToString();

                                string _score = score.ToString();

                                errorMessage3 = Email.Email_Needs_Assessment_Package(dateCompleted, firstName, lastName, emailAddress, phoneNumber, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, q21, q22, q23, q24, q25, q26, q27, q28, q29, q30, q31, q32, q33, q34, q35, q36, q37, q38, q39, q40, q41, q42, q43, q44, q45, q46, referralSource, referralName, RUGAPCEmailAddress, _dateCompleted2, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q19, Q20, _score, sr);

                                if (errorMessage3 != null)
                                {
                                    lblError.Text = errorMessage3;
                                    lblError.Visible = true;

                                    ErrorMessage message = new ErrorMessage();

                                    MsgBox(message.GenericErrorMessage);

                                }//end if

                                else
                                {
                                    DateTime _dateCompleted;

                                    DateTime.TryParse(dateCompleted, out _dateCompleted);

                                    string errorMessage4;

                                    errorMessage4 = Insert.Insert_Needs_Assessment_Package(_dateCompleted, firstName, lastName, emailAddress, phoneNumber, q5, q6, q7, q8, q9, q10, q11, q12, q13, q14, q15, q16, q17, q18, q19, q20, q21, q22, q23, q24, q25, q26, q27, q28, q29, q30, q31, q32, q33, q34, q35, q36, q37, q38, q39, q40, q41, q42, q43, q44, q45, q46, referralSource, referralName, RUGAPCEmailAddress, dateCompleted2, _Q1, _Q2, _Q3, _Q4, _Q5, _Q6, _Q7, _Q8, _Q9, _Q10, _Q11, _Q12, _Q13, _Q14, _Q15, _Q16, _Q17, _Q18, _Q19, _Q20, score);

                                    if (errorMessage4 != null)
                                    {
                                        lblError.Text = errorMessage4;
                                        lblError.Visible = true;

                                        ErrorMessage message = new ErrorMessage();

                                        MsgBox(message.GenericErrorMessage);

                                    }//end if

                                    else
                                    {
                                        MsgBox("Thank you very much for taking the time to share this information with us. We have now received both your Preliminary Needs and Career Marketability Assessments, and these have been emailed to Jim Davis, or your RUG APC, and we will get back with you as soon as we are able. May God richly bless you and your life path endeavors!");

                                        MultiView1.SetActiveView(View2);

                                    }//end else

                                }//end else

                            }//end else

                        }//end else if

                    }//end else

        }//end event
Esempio n. 8
0
        }//end event

        protected void btnCreate_Click(object sender, EventArgs e)
        {
 

            CreatePassword passwordObject = new CreatePassword();

            string password = passwordObject.Create_Password(8);

            string firstName = txtFirstName.Text;
            string lastName = txtLastName.Text;
            string username = txtUsername.Text;
            string role = ddlRole.SelectedValue;
            string verified = "N";
            string counselor = "N/A";
            DateTime dateCreated = DateTime.Today;
            int numberOfLogins = 0;
            string securityQuestion = ddlSecurityQuestion.SelectedValue;
            string securityAnswer = txtSecurityAnswer.Text;

            txtFirstName.Text = string.Empty;
            txtLastName.Text = string.Empty;
            txtUsername.Text = string.Empty;
            ddlSecurityQuestion.SelectedValue = string.Empty;
            txtSecurityAnswer.Text = string.Empty;
            txtConfirm.Text = string.Empty;

            //string errorMessage;

            //Select selectObject = new Select();

            //string counselorName;

            //counselorName = Select.Select_Counselor_Name(counselor);

            //errorMessage = selectObject.getErrorMessage();

            //if (errorMessage != null)
            //{
            //    lblError.Text = errorMessage;
            //    lblError.Visible = true;

            //    ErrorMessage message = new ErrorMessage();

            //    MsgBox(message.SQLServerErrorMessage);

            //}//end if

            //else
            //{
                Validate validationObject = new Validate();

                username = validationObject.Truncate(username, 100);
                firstName = validationObject.Truncate(firstName, 100);
                lastName = validationObject.Truncate(lastName, 100);
                password = validationObject.Truncate(password, 100);
                role = validationObject.Truncate(role, 100);
                verified = validationObject.Truncate(verified, 900);
                counselor = validationObject.Truncate(counselor, 900);
                securityQuestion = validationObject.Truncate(securityQuestion, 100);
                securityAnswer = validationObject.Truncate(securityAnswer, 100);

                Aes encryptionObject = Aes.Create();

                byte[] AesKey = encryptionObject.Key;

                byte[] AesIV = encryptionObject.IV;

                string AesKeyString = Convert.ToBase64String(AesKey);

                string AesIVString = Convert.ToBase64String(AesIV);

                byte[] MasterKey = Encryption.GetMasterKey();

                byte[] MasterIV = Encryption.GetMasterIV();

                byte[] encryptedFirstName = Encryption.Encrypt_AES(firstName, AesKey, AesIV);

                string encryptedFirstNameString = Convert.ToBase64String(encryptedFirstName);

                byte[] encryptedLastName = Encryption.Encrypt_AES(lastName, AesKey, AesIV);

                string encryptedLastNameString = Convert.ToBase64String(encryptedLastName);

                byte[] encryptedRole = Encryption.Encrypt_AES(role, AesKey, AesIV);

                string encryptedRoleString = Convert.ToBase64String(encryptedRole);

                byte[] encryptedPassword = Encryption.Encrypt_AES(password, AesKey, AesIV);

                string encryptedPasswordString = Convert.ToBase64String(encryptedPassword);

                byte[] encryptedSecurityQuestion = Encryption.Encrypt_AES(securityQuestion, AesKey, AesIV);

                string encryptedSecurityQuestionString = Convert.ToBase64String(encryptedSecurityQuestion);

                byte[] encryptedSecurityAnswer = Encryption.Encrypt_AES(securityAnswer, AesKey, AesIV);

                string encryptedSecurityAnswerString = Convert.ToBase64String(encryptedSecurityAnswer);

                byte[] encryptedAesKey = Encryption.Encrypt_AES(AesKeyString, MasterKey, MasterIV);

                byte[] encryptedAesIV = Encryption.Encrypt_AES(AesIVString, MasterKey, MasterIV);

                string encryptedAesKeyString = Convert.ToBase64String(encryptedAesKey);

                string encryptedAesIVString = Convert.ToBase64String(encryptedAesIV);

                bool recordExists;

                string errorMessage2;

                Select selectObject2 = new Select();

                recordExists = Select.User_Exists(username);

                errorMessage2 = selectObject2.getErrorMessage();

                if (errorMessage2 != null)
                {
                    lblError.Text = errorMessage2;
                    lblError.Visible = true;

                    ErrorMessage message = new ErrorMessage();

                    MsgBox(message.SQLServerErrorMessage);

                }//end if

                if (recordExists == true)
                {
                    MsgBox("Invalid username. An account for this username already exists. Please try again.");

                }//end if

                else if (recordExists == false)
                {
                    string errorMessage3;

                    errorMessage3 = Insert.Insert_BESTPATH_USER(encryptedFirstNameString, encryptedLastNameString, username, encryptedPasswordString, encryptedRoleString, verified, counselor, "N/A", dateCreated, numberOfLogins, encryptedSecurityQuestionString, encryptedSecurityAnswerString, encryptedAesKeyString, encryptedAesIVString);

                    if (errorMessage3 != null)
                    {
                        lblError.Text = errorMessage3;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else
                    {
                        string errorMessage4;

                        errorMessage4 = Insert.Insert_BESTPATH_STATUS(username);

                        if (errorMessage4 != null)
                        {
                            lblError.Text = errorMessage4;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.SQLServerErrorMessage);

                        }//end if

                        else
                        {
                            //string urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
                            //string registrationUrl = "/PL/Membership/Registration.aspx";
                            //string fullPath = urlBase + registrationUrl;
                            //string AppPath = Request.PhysicalApplicationPath;
                            //StreamReader sr = new StreamReader(AppPath + "SA/Email_Templates/Welcome.txt");

                            //Email emailObject = new Email();

                            //string errorMessage5;

                            //errorMessage5 = Email.Email_Welcome(counselor, firstName, username, password, fullPath, sr);

                            //if (errorMessage5 != null)
                            //{
                            //    lblError.Text = errorMessage5;
                            //    lblError.Visible = true;

                            //    ErrorMessage message = new ErrorMessage();

                            //    MsgBox(message.EmailErrorMessage);

                            //}//end if

                            //else
                            //{
                                MsgBox(password);

                            //}//end else

                    }//end else

                }//end else if

            }//end else

        }//end event
Esempio n. 9
0
        }//end event

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
            Session sessionObject = new Session();
            FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
            string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
            HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
            cookie.Expires = newTicket.Expiration;
            Response.Cookies.Add(cookie);

            string username = ticket.Name;

            string Q1 = TextBox4.InnerText;
            string Q2 = TextBox1.Text;
            string Q3 = TextBox2.Text;
            string Q4 = TextBox3.Text;

            Validate validationObject = new Validate();

            Q1 = validationObject.Truncate(Q1, 900);
            Q2 = validationObject.Truncate(Q2, 900);
            Q3 = validationObject.Truncate(Q3, 900);
            Q4 = validationObject.Truncate(Q4, 900);

            bool recordExists;

            string errorMessage;

            Select selectObject = new Select();

            recordExists = Select.Select_Natural_Talents(username);

            errorMessage = selectObject.getErrorMessage();

            if (errorMessage != null)
            {
                lblError.Text = errorMessage;
                lblError.Visible = true;

                ErrorMessage message = new ErrorMessage();

                MsgBox(message.SQLServerErrorMessage);

            }//end if

            else
            {
                if (recordExists == false)
                {
                    string errorMessage2;

                    errorMessage2 = Insert.Insert_Natural_Talents(username, Q1, Q2, Q3, Q4);

                    if (errorMessage2 != null)
                    {
                        lblError.Text = errorMessage2;
                        lblError.Visible = true;

                        ErrorMessage message = new ErrorMessage();

                        MsgBox(message.SQLServerErrorMessage);

                    }//end if

                    else
                    {
                        string errorMessage3;

                        errorMessage3 = Update.Update_Natural_Talents_Status(username);

                        if (errorMessage3 != null)
                        {
                            lblError.Text = errorMessage3;
                            lblError.Visible = true;

                            ErrorMessage message = new ErrorMessage();

                            MsgBox(message.SQLServerErrorMessage);

                        }//end if

                        else
                        {
                            Response.Redirect("~/PL/FOP/FOP_ProgressMenu.aspx");

                        }//end else

                    }//end else

                }//end if

            }//end else

        }//end event