Example #1
0
        /// <summary>
        /// send email with Excel Attachment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void tbtSendEmailClick(System.Object sender, System.EventArgs e)
        {
            TFrmSendEmailOptionsDialog options = new TFrmSendEmailOptionsDialog(this);

            if (options.ShowDialog() == DialogResult.OK)
            {
                if (!options.AttachExcelFile && !options.AttachCSVFile && !options.AttachPDF)
                {
                    MessageBox.Show(Catalog.GetString("No Email has been sent because there are no attachments"),
                                    Catalog.GetString("No Email has been sent"));
                    return;
                }

                TVerificationResultCollection verification;

                if (FCalculator.SendEmail(options.EmailAddresses, options.AttachExcelFile, options.AttachCSVFile, options.AttachPDF, FWrapColumn,
                                          out verification))
                {
                    MessageBox.Show(Catalog.GetString("Email has been sent successfully"),
                                    Catalog.GetString("Success"));
                }
                else
                {
                    MessageBox.Show(
                        verification.BuildVerificationResultString(),
                        Catalog.GetString("Email was not sent."));
                }
            }
        }
Example #2
0
        /// <summary>
        /// send email with Excel Attachment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void tbtSendEmailClick(System.Object sender, System.EventArgs e)
        {
            TFrmSendEmailOptionsDialog options = new TFrmSendEmailOptionsDialog(this);

            if (options.ShowDialog() == DialogResult.OK)
            {
                if (!options.AttachExcelFile && !options.AttachCSVFile && !options.AttachPDF)
                {
                    MessageBox.Show(Catalog.GetString("No Email has been sent because there are no attachments"),
                        Catalog.GetString("No Email has been sent"));
                    return;
                }

                TVerificationResultCollection verification;

                if (FCalculator.SendEmail(options.EmailAddresses, options.AttachExcelFile, options.AttachCSVFile, options.AttachPDF, FWrapColumn,
                        out verification))
                {
                    MessageBox.Show(Catalog.GetString("Email has been sent successfully"),
                        Catalog.GetString("Success"));
                }
                else
                {
                    MessageBox.Show(
                        verification.BuildVerificationResultString(),
                        Catalog.GetString("Email was not sent."));
                }
            }
        }