private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textSubject.Text == "" && textBodyText.Text == "")
     {
         MsgBox.Show(this, "Both the subject and body of the template cannot be left blank.");
         return;
     }
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Please enter a description.");
         return;
     }
     ETcur.Subject     = textSubject.Text;
     ETcur.BodyText    = textBodyText.Text;
     ETcur.Description = textDescription.Text;
     if (IsNew)
     {
         EmailTemplates.Insert(ETcur);
     }
     else
     {
         EmailTemplates.Update(ETcur);
     }
     foreach (EmailAttach attachment in _listEmailAttachDisplayed)
     {
         attachment.EmailTemplateNum = ETcur.EmailTemplateNum;
     }
     //Sync the email attachments and pass in an emailMessageNum of 0 because we will be providing _listEmailAttachOld.
     EmailAttaches.Sync(0, _listEmailAttachDisplayed, _listEmailAttachOld);
     DialogResult = DialogResult.OK;
 }
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textSubject.Text == "" && textBodyText.Text == "")
     {
         MsgBox.Show(this, "Both the subject and body of the template cannot be left blank.");
         return;
     }
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Please enter a description.");
         return;
     }
     ETcur.Subject     = textSubject.Text;
     ETcur.BodyText    = textBodyText.Text;       //always save as plain text version. We will translate to html on loading.
     ETcur.Description = textDescription.Text;
     if (!webBrowserHtml.Visible)
     {
         ETcur.TemplateType = EmailType.Regular;
     }
     else
     {
         ETcur.TemplateType = EmailType.Html;
         if (_isRaw)
         {
             ETcur.TemplateType = EmailType.RawHtml;
         }
     }
     if (IsNew)
     {
         EmailTemplates.Insert(ETcur);
     }
     else
     {
         EmailTemplates.Update(ETcur);
     }
     foreach (EmailAttach attachment in _listEmailAttachDisplayed)
     {
         attachment.EmailTemplateNum = ETcur.EmailTemplateNum;
     }
     //Sync the email attachments and pass in an emailMessageNum of 0 because we will be providing _listEmailAttachOld.
     EmailAttaches.Sync(0, _listEmailAttachDisplayed, _listEmailAttachOld);
     DialogResult = DialogResult.OK;
 }