Example #1
0
    /// <summary>
    /// Gets the attachments for the specified e-mail message.
    /// </summary>
    private void GetAttachments()
    {
        // Get basic info about all attachments attached to current e-mail
        DataSet ds = EmailAttachmentInfoProvider.GetEmailAttachmentInfos(emailId, null, -1, "AttachmentID, AttachmentName, AttachmentSize");

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            plcAttachments.Visible = true;
            if (ds.Tables.Count > 0)
            {
                int i = 0;
                EmailAttachmentInfo eai = null;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (i > 0)
                    {
                        pnlAttachmentsList.Controls.Add(new LiteralControl("<br />"));
                    }
                    eai = new EmailAttachmentInfo(dr);
                    pnlAttachmentsList.Controls.Add(new LiteralControl(HTMLHelper.HTMLEncode(eai.AttachmentName) + "&nbsp;(" + DataHelper.GetSizeString(eai.AttachmentSize) + ")"));
                    i++;
                }
            }
        }
        else
        {
            plcAttachments.Visible = false;
        }
    }
 /// <summary>
 /// Gets the attachments for the specified e-mail message.
 /// </summary>
 private void GetAttachments()
 {
     // Get basic info about all attachments attached to current e-mail
     DataSet ds = EmailAttachmentInfoProvider.GetEmailAttachmentInfos(emailId, null, -1, "AttachmentID, AttachmentName, AttachmentSize");
     if (!DataHelper.DataSourceIsEmpty(ds))
     {
         plcAttachments.Visible = true;
         if (ds.Tables.Count > 0)
         {
             int i = 0;
             EmailAttachmentInfo eai = null;
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 if (i > 0)
                 {
                     pnlAttachmentsList.Controls.Add(new LiteralControl("<br />"));
                 }
                 eai = new EmailAttachmentInfo(dr);
                 pnlAttachmentsList.Controls.Add(new LiteralControl(HTMLHelper.HTMLEncode(eai.AttachmentName) + "&nbsp;(" + DataHelper.GetSizeString(eai.AttachmentSize) + ")"));
                 i++;
             }
         }
     }
     else
     {
         plcAttachments.Visible = false;
     }
 }