Example #1
0
        private void SendInvitationButton_Click(object sender, System.EventArgs e)
        {
            //Init Async call
            ASyncMailing      mail         = new ASyncMailing();
            ASyncMailingState mailingState = new ASyncMailingState(mail, Session.SessionID);
            AsyncCallback     cb           = new AsyncCallback(MailingCallback);

            // Build message to send
            EmailingMessage message;

            message           = new EmailingMessage();
            message.FromEmail = FromTextBox.Text;
            message.FromName  = FromNameTextbox.Text;
            message.Subject   = SubjectTextBox.Text;
            message.Body      = HttpUtility.HtmlDecode(MailingCKEditor.Text);
            message.Format    = EmailFormat.Html;

            // Dummy session variable to init the session in case
            // it was not initialized
            Session["IamADummy"] = "StartIt";

            // Start the mailing
            mail.BeginMailIt(Session.SessionID, SurveyId,
                             AnonymousEntriesCheckBox.Checked, MailingListTextBox.Text,
                             message, cb, mailingState);

            // Open the poll page while the mailing continues
            UINavigator.NavigateToMailingPoll(SurveyId, MenuIndex);
        }
Example #2
0
        public void MailingCallback(IAsyncResult ar)
        {
            // Restore orginial state
            ASyncMailingState mailingState = (ASyncMailingState)ar.AsyncState;

            //retrieve the object on which End needs to be called
            ASyncMailing mailing = mailingState.AsyncMailing;

            mailing.EndMailIt(ar);

            // Let the world know that mailing is finished
            SyncDataStore.SetRecords(mailingState.SessionId, true);
        }
        private void SendInvitationButton_Click(object sender, System.EventArgs e)
        {
            //Init Async call
            ASyncMailing mail = new ASyncMailing();
            ASyncMailingState mailingState = new ASyncMailingState(mail, Session.SessionID);
            AsyncCallback cb = new AsyncCallback(MailingCallback);

            // Build message to send
            EmailingMessage message;
            message = new EmailingMessage();
            message.FromEmail = FromTextBox.Text;
            message.FromName = FromNameTextbox.Text;
            message.Subject = SubjectTextBox.Text;
            message.Body = HttpUtility.HtmlDecode(MailingCKEditor.Text);
            message.Format = EmailFormat.Html;

            // Dummy session variable to init the session in case
            // it was not initialized
            Session["IamADummy"] = "StartIt";

            // Start the mailing
            mail.BeginMailIt(Session.SessionID, SurveyId,
                AnonymousEntriesCheckBox.Checked, MailingListTextBox.Text,
                message, cb, mailingState);

            // Open the poll page while the mailing continues
            UINavigator.NavigateToMailingPoll(SurveyId, MenuIndex);
        }