Ejemplo n.º 1
0
    protected void btnDeleteSubscribedUser_OnClick(object sender, EventArgs e)
    {
        var mail    = (string)Session["mailNewsLetter"];
        var isValid = Helper.IsValidMailAddress(mail);

        if (isValid)
        {
            var       taNewsLetter = new DataSetMateraArredamentiTableAdapters.NewsLetterTableAdapter();
            DataTable dtNewsLetter = taNewsLetter.GetEmail(mail);
            if (dtNewsLetter.Rows.Count > 0)
            {
                taNewsLetter.Delete(mail);
                lblNewslOK.Text          = Resource.NewsletterMessageDeleteMessageSuccess;
                notificationSucc.Visible = true;
                notificationpnl.Visible  = false;
                CheckBoxcons.Checked     = false;
            }
            else
            {
                lblErr.Text              = Resource.NewsletterMessageDeleteMessageError;
                notificationpnl.Visible  = true;
                notificationSucc.Visible = false;
                CheckBoxcons.Checked     = false;
            }
        }
        else
        {
            lblErr.Text              = Resource.WrongMailFormatMessage;
            notificationpnl.Visible  = true;
            notificationSucc.Visible = false;
        }
    }
Ejemplo n.º 2
0
    private void SubscriveSignedCustomerToNewsLetter()
    {
        var       taNewsLetter = new DataSetMateraArredamentiTableAdapters.NewsLetterTableAdapter();
        DataTable dtNewsLetter = taNewsLetter.GetEmail(CreateUserWizard1.Email);

        if (dtNewsLetter.Rows.Count == 0)
        {
            taNewsLetter.Insert(CreateUserWizard1.Email);
        }
    }
Ejemplo n.º 3
0
    protected void btnIscrivi_Click(object sender, EventArgs e)
    {
        var mail    = (string)Session["mailNewsLetter"];
        var isValid = Helper.IsValidMailAddress(mail);

        if (!isValid)
        {
            lblErr.Text              = Resource.WrongMailFormatMessage;
            notificationpnl.Visible  = true;
            notificationSucc.Visible = false;
            return;
        }
        if (CheckBoxcons.Checked)
        {
            var       taNewsLetter = new DataSetMateraArredamentiTableAdapters.NewsLetterTableAdapter();
            DataTable dtNewsLetter = taNewsLetter.GetEmail(mail);
            if (dtNewsLetter.Rows.Count > 0)
            {
                lblErr.Text              = Resource.NewsletterMessageAlreadySubscribed;
                notificationpnl.Visible  = true;
                notificationSucc.Visible = false;
                CheckBoxcons.Checked     = false;
                return;
            }
            taNewsLetter.Insert(mail);
            lblNewslOK.Text          = Resource.NewsletterSubscribeMessageSuccess;
            notificationSucc.Visible = true;
            notificationpnl.Visible  = false;
            CheckBoxcons.Checked     = false;

            try
            {
                SendNotificationMail(mail);
            }
            catch (Exception Ex)
            {
                lblNewslOK.Text          = Ex.Message;
                notificationpnl.Visible  = true;
                notificationSucc.Visible = false;
            }
        }
        else
        {
            lblErr.Text              = Resource.NewsletterMessageAccord;
            notificationpnl.Visible  = true;
            notificationSucc.Visible = false;
        }
    }