Beispiel #1
0
        protected void lnkButnNewsLtr_Click(object sender, EventArgs e)
        {
            string email = txtEmail.Text;

            if (!string.IsNullOrEmpty(txtEmail.Text))
            {
                bool isValid = mailClass.isCorrectEmail(txtEmail.Text);

                if (isValid)
                {
                    bool UserExistsCms = UserExistCms(email);

                    if (UserExistsCms)
                    {
                        int FK_userTable = newsLetterClass.getFkFromEmail(email);
                        newsLetterClass.UpadateCustomTableNewsLetter(FK_userTable);
                        newsLetterClass.addNewsLetter(email, FK_userTable);
                        setViewPanels(false, true);
                    }
                    else
                    {
                        bool UserExistsNewsLetter = UserExistNewsLetter(email);

                        if (UserExistsNewsLetter)
                        {
                            lblerror.Text = UserAlreadyExistsError;
                        }
                        else
                        {
                            newsLetterClass.addNewsLetter(email);
                            setViewPanels(false, true);
                        }
                    }
                }
                else
                {
                    lblerror.Text = incorrectEmailError;
                }
            }
            else
            {
                lblerror.Text = fillInFields;
            }
        }
Beispiel #2
0
        protected void btnForgotPassword_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtEmailForgotPassword.Text))
            {
                bool isValid = emailClass.isCorrectEmail(txtEmailForgotPassword.Text);

                if (isValid)
                {
                    bool isUser = userClass.isUserByEmail(txtEmailForgotPassword.Text);
                    if (isUser)
                    {
                        string BaseUrl = HttpContext.Current.Request.Url.Host;

                        var webCmsUser = userClass.getCmsMemberUserByEmail(txtEmailForgotPassword.Text);
                        int webCmsFK;
                        webCmsFK = webCmsUser.FK_User_Table ?? default(int);
                        var webCustomUser = userClass.getUserCustomMember(webCmsFK);

                        memberClass.member_UserName     = webCmsUser.LoginName;
                        memberClass.member_EmailAddress = txtEmailForgotPassword.Text;
                        emailClass.afdsl_FilePath       = Server.MapPath("/Email_Templates/Forgot_Password/Password_Template.html");

                        string email_Body = emailClass.populateForgotPasswordEmailTemplate(emailClass.afdsl_FilePath, memberClass.member_UserName, BaseUrl, webCustomUser.Guid.ToString());
                        emailClass.SendMail("*****@*****.**", txtEmailForgotPassword.Text, "Forgot Password", email_Body);
                    }
                    else
                    {
                        lblerror.Text = "The email is not registered with AFDSL";
                    }
                }
                else
                {
                    lblerror.Text = "The Email you entered is incorrect";
                }
            }
            else
            {
                lblerror.Text = "You have not filled in the email field.";
            }
        }