Пример #1
0
        /// <summary>
        /// This method sends a verification email to the user at the email address they entered in the form.
        /// </summary>
        /// <param name="emailAddress">
        /// The email address
        /// </param>
        /// <param name="item">
        /// The item.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private bool SendEmail(string emailAddress, EventData item)
        {
            string emailBody = GetEmailMessage(item);

            this.HttpContext.Session["Message"] = emailBody;
            string emailTo = Properties.Settings.Default.devMode
                              ? Properties.Settings.Default.simulatedEmail
                              : emailAddress;
            EmailProcess ep = new EmailProcess(
                Properties.Settings.Default.EmailHost,
                Properties.Settings.Default.EmailPort,
                Properties.Settings.Default.EmailFrom);

            return(ep.SendEmail(emailTo, Properties.Settings.Default.EmailSubject, emailBody));
        }
Пример #2
0
        public ActionResult Index(Form data)
        {
            RecaptchaVerificationHelper recaptchaHelper = this.GetRecaptchaVerificationHelper();

            if (string.IsNullOrEmpty(recaptchaHelper.Response))
            {
                this.ModelState.AddModelError(string.Empty, "Captcha answer cannot be empty.");

                return(this.View(data));
            }

            RecaptchaVerificationResult recaptchaResult = recaptchaHelper.VerifyRecaptchaResponse();

            if (recaptchaResult != RecaptchaVerificationResult.Success)
            {
                this.ModelState.AddModelError(string.Empty, "Incorrect captcha answer.");

                return(this.View(data));
            }

            FormValidator validator = new FormValidator();

            validator.Validate(data);

            if (!this.ModelState.IsValid)
            {
                return(this.View(data));
            }

            string emailBody = string.Empty;

            // If at least half of the interest questions were "Agreed" or "Strongly Agreed".
            if (this.CalculateScore(data) >= 6)
            {
                data.IsPotentialStudent = true;

                emailBody  = "Results to Software Development Quiz<br/><br/>";
                emailBody += "Congratulations! It sounds like training for a career in software development could be a good fit for you. We offer a few options that may work well for you.<br/><br/>";
                emailBody += "DEGREES (TWO YEARS)<br/>";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/information-technology/programming-and-development/programming-development-at-tri-c.html{Properties.Settings.Default.TrackingQueryString}\">Programming and Development</a><br/><br/>";
                emailBody += "SHORT-TERM AND POST DEGREE CERTIFICATES (JUST OVER A YEAR)<br/>";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/information-technology/programming-and-development/certificate-in-mobile-application-development.html{Properties.Settings.Default.TrackingQueryString}\">Mobile Application Development</a><br />";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/information-technology/programming-and-development/certificate-in-web-application-development.html{Properties.Settings.Default.TrackingQueryString}\">Web Application Development</a><br/>";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/information-technology/programming-and-development/net-programming.html{Properties.Settings.Default.TrackingQueryString}\">.NET Programming</a><br/>";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/information-technology/programming-and-development/post-degree-certificate-in-programming-and-development.html{Properties.Settings.Default.TrackingQueryString}\">Programming and Development</a><br/><br/>";
                emailBody += "FAST TRACK TRAINING (3-6 MONTHS)<br/>";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/information-technology/programming-and-development/clevelandcodes.html{Properties.Settings.Default.TrackingQueryString}\">Cleveland Codes Software Developers Academy</a><br/><br/>";

                if (Convert.ToBoolean(data.StartNow))
                {
                    emailBody += "One of our staff will be reaching out to you within 48 hours to discuss program options and enrollment procedures.";
                }
                else
                {
                    emailBody += "You indicated that you are not quite ready to begin a training program. We will keep your name on our email list and share program information about upcoming courses.<br/><br/>";
                    emailBody += "If you don’t want future training opportunities emailed to you, please <a href=\"mailto:[email protected]?subject=%20Unsubscribe%20from%20email%20list\">unsubscribe</a>.";
                }
            }
            else
            {
                data.IsPotentialStudent = false;

                emailBody  = "Results to Software Development Quiz<br/><br/>";
                emailBody += "Based on the interests that you self-reported, it sounds like a career in software development might not be the best fit for you. Tri-C offers many different programs so you can find one that’s the right fit for you.<br/><br/>";
                emailBody += "If you like computers, take our <a href=\"https://forms.tri-c.edu/NetworkingQuiz\">computer networking quiz</a> to see if this area is a better match with your interests.<br/><br/>";
                emailBody += "We also offer programs that include technology applications as part of the coursework, such as business technology and entrepreneurial technology. In addition, the Gill and Tommy LiPuma Center for Creative Arts offers 3D design, digital video editing, game design and motion graphics, to name a few.<br /><br />";
                emailBody += $"<a href=\"https://www.tri-c.edu/programs/{Properties.Settings.Default.TrackingQueryString}\">View All Available Programs</a>";
            }

            EmailProcess ep = new EmailProcess(Properties.Settings.Default.EmailHost, Properties.Settings.Default.EmailPort, Properties.Settings.Default.EmailFrom);

            if (!ep.SendEmail(data.Email, "Tri-C Software Development Quiz Confirmation", emailBody))
            {
                return(this.RedirectToAction("Error"));
            }

            ListProcess lp = new ListProcess(
                Properties.Settings.Default.Site,
                Properties.Settings.Default.List,
                AppDBConnection.KwebConnection);

            if (!lp.Add(data))
            {
                return(this.RedirectToAction("Error"));
            }

            return(this.RedirectToAction("Thanks"));
        }