Example #1
0
        public IEvent QueueEmailEvent(Dictionary <string, string> toAddresses
                                      , Dictionary <string, string> ccAddresses  = null
                                      , Dictionary <string, string> bccAddresses = null
                                      , string subject         = ""
                                      , string body            = ""
                                      , string fromAddress     = null
                                      , string fromDisplayName = null
                                      , bool formatAsHtml      = true
                                      , MailPriority priority  = MailPriority.Normal
                                      , Dictionary <string, byte[]> attachments = null
                                      , bool sendCcToSystemEmail = true)
        {
            EmailEvent evt = (EmailEvent)EventFactory.CreateEvent((int)EventTypeEnum.Email);

            evt.ToAddresses         = toAddresses;
            evt.CcAddresses         = ccAddresses;
            evt.BccAddresses        = bccAddresses;
            evt.Subject             = subject;
            evt.Body                = body;
            evt.FromAddress         = fromAddress;
            evt.FromDisplayName     = fromDisplayName;
            evt.FormatAsHtml        = formatAsHtml;
            evt.Priority            = priority;
            evt.Attachments         = attachments;
            evt.SendCcToSystemEmail = sendCcToSystemEmail;

            AddDefaultProperties(evt);

            return(QueueEvent(evt));
        }
Example #2
0
        public static IEvent CreateEvent(int eventTypeID)
        {
            IEvent e = null;

            switch (eventTypeID)
            {
            case (int)EventTypeEnum.Email:
                e = new EmailEvent();
                break;

            case (int)EventTypeEnum.CleanEventQueue:
                e = new CleanEventQueueEvent();
                break;

            case (int)EventTypeEnum.RunReport:
                e = new RunReportEvent();
                break;

            case (int)EventTypeEnum.CleanReportQueue:
                e = new CleanReportQueueEvent();
                break;

            default:
                break;
            }

            if (e == null)
            {
                LogUtility.LogError("Invalid EVENT_TYPEID (" + eventTypeID + "). Unable to create event.");
                return(null);
            }

            e.EventTypeID   = eventTypeID;
            e.EventStatusID = (int)EventStatusEnum.Scheduled;
            e.CreatedBy     = null; // system(?)
            e.CreatedDate   = DateTime.Now;


            return(e);
        }