コード例 #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;
            }
        }