Ejemplo n.º 1
0
    /// <summary>
    ///     Last step button event handler
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSignup_OnClick(object sender, EventArgs e)
    {
        if (txtEmail.Text != "" && txtName.Text != "" && txtPassword.Text != "")
        {
            if (MailValidator.EmailIsValid(txtEmail.Text))
            {
                if (!_myFunction.CheckUserExist(txtName.Text.ToLower().Trim()))
                {
                    _myFunction.AddSignIn(txtName.Text.ToLower().Trim(), txtEmail.Text.ToLower().Trim(),
                                          ImageUpload().Item1, ImageUpload().Item2, _ghgNumber);
                    if (Glitch.GlichEnabler)
                    {
                        _step            = 0;
                        txtEmail.Text    = "";
                        txtName.Text     = "";
                        txtPassword.Text = "";
                        txtPassword.Attributes["value"] = "";

                        Response.Redirect("~/StaticNoise.aspx");
                    }

                    if (!Glitch.GlichEnabler)
                    {
                        _step            = 0;
                        txtEmail.Text    = "";
                        txtName.Text     = "";
                        txtPassword.Text = "";
                        txtPassword.Attributes["value"] = "";

                        Response.Redirect("Default.aspx");

                        Label5.Text = "Thank you for supporting Arcadia. We will contact you soon with further info";
                    }
                }
                else
                {
                    Label5.Text = "Sorry that name has already signed up";
                }
            }
            else
            {
                Label5.Text = "Insert a valid mail";
            }
        }
        else
        {
            Label5.Text = "Incorrect info, please enter info in all the fields";
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    ///     Method for the eventhandler on the button
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSend_Click(object sender, EventArgs e)
    {
        //try catch to make sure it won't do a error when sending the mail. if pop3 is missin on the server
        try
        {
            if (MailValidator.EmailIsValid(txtEmail.Text)) //validate mail
            {
                _random = new Random();

                var randomNumber = _random.Next(0, 2);
                var mailMessage  = new MailMessage();
                mailMessage.To.Add(txtEmail.Text);
                mailMessage.From = new MailAddress("*****@*****.**");
                //send a mail to the person who wrote instanely with a random respone.
                //can be changed to a real contact form
                if (randomNumber == 0)
                {
                    //put in a random
                    mailMessage.Subject = txtSubject.Text.Trim();
                    mailMessage.Body    = txtMsg.Text.Trim();
                }
                else
                {
                    mailMessage.Subject = txtSubject.Text.Trim();
                    mailMessage.Body    = txtMsg.Text.Trim();
                }
                var smtpClient = new SmtpClient("smtp.your-isp.com");
                smtpClient.Send(mailMessage);
                litError.Text = "E-mail sent!";
            }
            else
            {
                litError.Text = "Invalid e-mail adresse";
            }
        }
        catch (Exception)
        {
            litError.Text = "An error happen and the mail wasn't able to get send, please try again later";
        }
    }