Example #1
0
        public int Create(NaesbEventNotification obj)
        {
            //map domain to enitity framework
            tb_naesb_event_notifications entity = new ModelFactory().Map(obj);

            //insert to database
            base.Add(entity);

            return(Convert.ToInt32(entity.Id));
        }
        private static void CreateNaesbEventNotification(List <NaesbEventEmail> objs)
        {
            //create the email body
            string emailBody = CreateEmailBody(objs);

            //create the event notification
            var eventNotification = new NaesbEventNotification
            {
                Source           = "Scheduling Monitor",
                To               = Properties.Settings.Default.EmailTo,
                From             = Properties.Settings.Default.EmailFrom,
                Priority         = MailPriority.Normal.ToString().ToUpper(),
                Subject          = "Naesb Past Due Events",
                Body             = emailBody,
                IsHtml           = true,
                LastUpdateUserId = Properties.Settings.Default.ContentUserId
            };

            //add missed naesb event to naesb event notification
            Container.Resolve <INaesbEventNotificationCreate>().Invoke(eventNotification);
        }
        private static void ProcessEmail(NaesbEventNotification obj)
        {
            try
            {
                var priority = new MailPriority();
                switch (obj.Priority.ToUpper())
                {
                case "HIGH":
                    priority = MailPriority.High;
                    break;

                case "LOW":
                    priority = MailPriority.Low;
                    break;

                default:
                    priority = MailPriority.Normal;
                    break;
                }

                var email = new CS.Common.Utilities.Email.Models.Email
                {
                    Body       = obj.Body,
                    CC         = obj.Cc,
                    From       = obj.From,
                    To         = obj.To,
                    IsBodyHtml = obj.IsHtml,
                    Priority   = priority,
                    Subject    = obj.Subject
                };

                ProcessEmail(email);
            }
            catch (Exception ex)
            {
                CreateIncident(ex);
            }
        }
 public int Invoke(NaesbEventNotification obj)
 {
     return(_repository.Create(obj));
 }