예제 #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
        }//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
        }//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
예제 #4
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