public virtual EmailAttachmentContainer SelectChildrenByAttachmentOfEmail(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     EmailAttachmentContainer result;
     DataSet entitySet = m_DataContext.ndihdAttachmentOfEmailSelectBy(IDVal);
     result = new EmailAttachmentContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
        // -------------------------------------------------------------------------------------
        /// <summary>
        /// fill edit window controls
        /// </summary>
        // -------------------------------------------------------------------------------------
        private void RetrieveData()
        {
            try
              {
            IEmailAttachmentService attSrv = ServiceFactory.GetEmailAttachmentService();
            IEmailService srv = ServiceFactory.GetEmailService();

            // Get data
            if (m_currentMail == null)
            {
              m_currentMail = srv.EmailSelect(CurrentID);
            }
            m_currentMail.EmailAttachments = srv.SelectChildrenByAttachmentOfEmail(CurrentID);
            EmailAttachmentContainer avaiableFiles = new EmailAttachmentContainer();
            foreach (EmailAttachment file in m_currentMail.EmailAttachments.All)
            {
              EmailAttachment oldFile = attSrv.EmailAttachmentSelectFile(file.ID);
              if (oldFile.FileData != null && oldFile.FileData.Length > 0)
              {
            file.FileData = oldFile.FileData;
            file.FileSize = oldFile.FileSize;
            if (!avaiableFiles.All.Items.Contains(file))
            {
              avaiableFiles.Add(file);
            }
              }
            }
            m_currentMail.EmailAttachments = avaiableFiles;
            // Fill the controls
            if (! m_currentMail.To.IsNull)
            {
              string[] sTos = ((string) m_currentMail.To.ToString()).Split(';');
              Array arTo = (Array) sTos;
              for (int i = 0; i < arTo.Length; i ++)
              {
            lstTo.Items.Add((object) arTo.GetValue(i));
              }
            }
            txtCC.Text = m_currentMail.Cc;
            txtSubject.Text = m_currentMail.Subject;
            txtMailBody.Text = m_currentMail.MailBody;

            IEmailTemplateService srvTemplate = ServiceFactory.GetEmailTemplateService();

            txtCategory.Text = srvTemplate.EmailTemplateSelect(m_currentMail.Category.ToString()).Name;
            if (!m_currentMail.Category.Equals(EmailCategory.Newsmail))
            {
              tabPageAttachment.Parent.Controls.Remove(tabPageAttachment);
              m_IsNewsMail = false;
              btnOk.Visible = false;
              txtMailBody.Enabled = false;
              txtSubject.Enabled = false;
              grpCategory.Enabled = false;
              cbxOrgActOther.Enabled = false;
              cbxOrgActPrevention.Enabled = false;
              cbxOrgActRehabilitation.Enabled = false;
              cbxOrgActResearch.Enabled = false;
              cbxAll.Enabled = false;
            }
            else
            {
              grpCategory.Enabled = true;
              cbxOrgActOther.Checked = m_currentMail.ActivityOther;
              cbxOrgActPrevention.Checked = m_currentMail.ActivityPrevention;
              cbxOrgActRehabilitation.Checked = m_currentMail.ActivityRehabilitation;
              cbxOrgActResearch.Checked = m_currentMail.ActivityResearch;
              cbxAll.Checked = m_currentMail.ActivityAll;

              GetEmailRecipients();
            }
            if (!m_currentMail.Sent.IsNull)
            {
              txtSent.Text = m_currentMail.Sent.ToString();
              btnSend.Visible = false;
              btnOk.Visible = false;
              btnCancel.Text = "Bezár";
              txtMailBody.Enabled = false;
              txtSubject.Enabled = false;
              grpCategory.Enabled = false;
              cbxOrgActOther.Enabled = false;
              cbxOrgActPrevention.Enabled = false;
              cbxOrgActRehabilitation.Enabled = false;
              cbxOrgActResearch.Enabled = false;
              cbxAll.Enabled = false;
              if (tabPageAttachment != null)
              {
            tabPageAttachment.Enabled = false;
              }
            }
            FillDatagrid(DBGuid.Null);
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Hiba lépett fel az adatok lekérdezése során", ex);
            //	---	invisible btnOk button
            btnOk.Visible = false;
              }
        }
 public virtual EmailAttachmentContainer EmailAttachmentSelectAll()
 {
     TraceCallEnterEvent.Raise();
       try
       {
     EmailAttachmentContainer result;
     DataSet entitySet = m_DataContext.ndihdEmailAttachmentSelectAll();
     result = new EmailAttachmentContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }