Esempio n. 1
0
 private void FormEmailMessageEdit_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (DialogResult == DialogResult.OK)
     {
         return;
     }
     if (IsNew)
     {
         EmailMessages.Delete(MessageCur);
     }
 }
Esempio n. 2
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         //It will be deleted in the FormClosing() Event.
     }
     else
     {
         if (MsgBox.Show(this, true, "Delete this email?"))
         {
             EmailMessages.Delete(MessageCur);
             DialogResult = DialogResult.OK;
         }
     }
 }
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (_emailMessage == null)
            {
                DialogResult = DialogResult.Abort;              //Nothing to do the message doesn't exist.
                return;
            }
            if (!MsgBox.Show(this, true, "Are you sure you want to delete this webmail?"))
            {
                return;
            }
            EmailMessages.Delete(_emailMessage);
            string logText = "";

            logText += "\r\n" + Lan.g(this, "From") + ": " + _emailMessage.FromAddress + ". ";
            logText += "\r\n" + Lan.g(this, "To") + ": " + _emailMessage.ToAddress + ". ";
            if (!String.IsNullOrEmpty(_emailMessage.Subject))
            {
                logText += "\r\n" + Lan.g(this, "Subject") + ": " + _emailMessage.Subject + ". ";
            }
            if (!String.IsNullOrEmpty(_emailMessage.BodyText))
            {
                if (_emailMessage.BodyText.Length > 50)
                {
                    logText += "\r\n" + Lan.g(this, "Body Text") + ": " + _emailMessage.BodyText.Substring(0, 49) + "... ";
                }
                else
                {
                    logText += "\r\n" + Lan.g(this, "Body Text") + ": " + _emailMessage.BodyText;
                }
            }
            if (_emailMessage.MsgDateTime != DateTime.MinValue)
            {
                logText += "\r\n" + Lan.g(this, "Date") + ": " + _emailMessage.MsgDateTime.ToShortDateString() + ". ";
            }
            SecurityLogs.MakeLogEntry(Permissions.WebMailDelete, _emailMessage.PatNum, Lan.g(this, "Web Mail deleted.") + " " + logText);
            DialogResult = DialogResult.Abort;          //We want to abort here to avoid using the email in parent windows when it's been deleted.
        }