private static void AddEmailActivity(AutoRemindCaseInfo CurrentCase, Notification rowNotiication) { bool sent = false; string sError = "Failed to send E-mail."; try { var sender = TemplateNotificationGenerator.Create(CurrentCase, rowNotiication.NotificationID.Value); sender.MailAccountId = (rowNotiication.NFrom.HasValue) ? rowNotiication.NFrom.Value : PX.Data.EP.MailAccountManager.DefaultMailAccountID; sender.RefNoteID = CurrentCase.NoteID; sender.To = CurrentCase.EMail; sender.Owner = CurrentCase.OwnerID; sent |= sender.Send().Any(); } catch (Exception Err) { sent = false; sError = Err.Message; } if (!sent) { throw new PXException(sError); } }
protected virtual IEnumerable records() { List <AutoRemindCaseInfo> results = new List <AutoRemindCaseInfo>(); foreach (PXResult <AutoRemindCaseInfo> result in PXSelect <AutoRemindCaseInfo> .Select(this)) { AutoRemindCaseInfo rec = result.GetItem <AutoRemindCaseInfo>(); if (((!rec.UsrReminderCount.HasValue || rec.UsrReminderCount == 0) && (rec.LastActivityAge > rec.UsrTimeReactionReminder1)) || ((rec.UsrReminderCount == 1) && (rec.LastActivityAge > rec.UsrTimeReactionReminder2)) || ((rec.UsrReminderCount == 2) && (rec.LastActivityAge > rec.UsrTimeReactionReminder3)) || ((rec.UsrReminderCount == 3) && (rec.LastActivityAge > rec.UsrTimeReactionAutoClose))) { results.Add(result); } } return(results); }