Exemplo n.º 1
0
        protected void BtnRegister_Click1(object sender, EventArgs e)
        {
            try
            {
                if (_pagevalid)
                {
                    _dtouser = new DtoUser();
                    _blluser = new BllUser();

                    var emailRegex    = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
                    var passwordRegex = new Regex("^([a-zA-Z0-9@*#]{8,15})$");


                    if (emailRegex.IsMatch(TxtLEmail.Text) &&
                        passwordRegex.IsMatch(TxtLPassword.Text))
                    {
                        _dtouser.Email    = TxtLEmail.Text;
                        _dtouser.Password = TxtLPassword.Text;
                        _dtouser.Guid     = Guid.NewGuid().ToString();
                        // _dtouser.IsUser = chkuser.SelectedValue == "1" ? true : false;

                        _userid = _blluser.RegisterUser(_dtouser);

                        if (_userid == -1)
                        {
                            LblAutentication.Text    = "Email Already Exists";
                            LblAutentication.Visible = true;
                        }
                        else
                        {
                            var st = SendVerificationEmail(TxtLEmail.Text, _dtouser.Guid);

                            if (st == false)
                            {
                                LblAutentication.Text    = "Email Cannot be Sent at this Time.";
                                LblAutentication.Visible = true;
                            }
                            else
                            {
                                LblAutentication.Text    = "Please Verify Your Email";
                                LblAutentication.Visible = true;
                            }
                        }
                    }
                    else
                    {
                        LblAutentication.Text    = "Incorrect Username Or Password";
                        LblAutentication.Visible = true;
                    }
                }
                else
                {
                    LblAutentication.Visible = true;
                    LblAutentication.Text    = "Captcha Does Match";
                }
            }
            catch (Exception ex)
            {
                ex.ToExceptionless().Submit();
            }
        }