Пример #1
0
        public EmailPending(EmailDraft draft)
            : base()
        {
            _CCList = new List<string>();
            _BccList = new List<string>();
            _AttachmentFileList = new List<string>();

            EmailDraftID = draft.ID;
            Subject = draft.Subject;
            FromAddress = draft.FromAddress;
            Message = draft.Message;
            NotificationID = draft.NotificationID;
            ToAddress = "";
            Retry = 0;
            Status = "Pending";
            LastRetryAt = DateTime.UtcNow;
            TimeToSend = DateTime.UtcNow;

            ID = SequentialGuid.NewDbGuid();
            CompanyID = draft.CompanyID;
            UserID = draft.UserID;
            Priority = draft.Priority;
        }
 //. IM-3927
 private EmailDraft CreateEmailDraft(string template, string fromAddress, string subject, Guid notifyID, string companyID, string userID, string tzid, string data, byte priority)
 {
     EmailDraft draft = new EmailDraft();
     draft.ID = SequentialGuid.NewDbGuid();
     draft.CompanyID = new Guid(companyID);
     draft.UserID = new Guid(userID);
     draft.FromAddress = string.IsNullOrEmpty(fromAddress) ? _EmailSenderAddress : fromAddress;
     draft.NotificationID = notifyID;
     draft.Message = FillInTemplate(draft.CompanyID, draft.UserID, tzid, template, data);
     string prefix = draft.Message.StartsWith("i360") ? string.Empty : "i360 - ";
     if (string.IsNullOrEmpty(subject)) subject = MakeSubjectLineFromContent(prefix, draft.Message);
     draft.Subject = subject;
     draft.Priority = priority;
     SaveEmailDraft(new SaveRequest<EmailDraft>(draft));
     return draft;
 }