예제 #1
0
        private string Validate()
        {
            var errorMsg = String.Empty;

            if (String.IsNullOrEmpty(this.EmailAddress) || !this.EmailAddress.Contains("@"))
            {
                errorMsg += "Invalid email address. ";
            }

            if (String.IsNullOrEmpty(this.Name))
            {
                errorMsg += "Invalid name. ";
            }


            Captcha captcha = new Bll.Captcha();

            if (!captcha.IsValid(this))
            {
                errorMsg += "Invalid captcha. ";
            }


            return(errorMsg);
        }
예제 #2
0
        public ActionResult Plan(Models.PlanViewModel model)
        {
            //we can't return View(model) because we'd have to send all the objects again, such as Instrument.AllInstruments, whcih is hassle

            var captch = new Bll.Captcha();

            if (!captch.IsValid(model.Contact))
            {
                return(RedirectToAction("ThankYou", "Home", new { header = "Oh dear...we didn't send your stage plan!", msg1 = "Sadly the captcha wasn't correct, please click back in your browser and try again" }));
            }

            if (!ModelState.IsValid)
            {
                return(RedirectToAction("ThankYou", "Home", new { header = "Oh dear...we didn't send your stage plan!", msg1 = "Sadly the details you provided were either missing or incorrect. Please click back in your browser and try again" }));
            }

            if (!String.IsNullOrEmpty(model.Contact.Band))
            {
                model.Contact.Send(model.Contact.Band + " has shared their stage plot");
            }
            else
            {
                model.Contact.Send(model.Contact.Name + " has shared their stage plot");
            }


            if (!model.Contact.DidSend)
            {
                Utilies.Email.SendFaultEmail("*****@*****.**", "fault with Stage plan", false, "Failed to send to venue/engineer. sp23U39");

                return(RedirectToAction("ThankYou", "Home", new { header = "Oh dear...we didn't send your stage plan!", msg1 = "Sadly we were not able to send the email - please confirm the email you've provided is correct - if it is, then there is a fault with our website, so we've already let the web team know and they are busy trying to fix it! If you can email us via our contact page to tell us what made it go wrong it may help us to fix it for you." }));
            }


            //    //var email = "*****@*****.**";
            //var x = Utilies.Email.SendEmail(false, "mail.stage-plan.com", false, 25, email, GetPassword(), email, new List<string> { model.Email }, null, new List<string> { email }, "Email from Stage-Plan", true, GetBody(model));
            ////todo verification
            return(RedirectToAction("ThankYou", "Home", new { header = "Hurray...we've sent your stage plan!", msg1 = "Your plan has been sent but we do suggest you check (some times, emails don't go through or can be blocked as spam)." }));
        }