Example #1
0
        /// <summary>
        /// Send notification email to specific users on process of title job
        /// </summary>
        /// <param name="notificationTYpe">Type of notification o send</param>
        /// <param name="jobStatus">Success or Failure</param>
        public void SendJobNotification(JobNotificationType notificationTYpe, JobStatus jobStatus)
        {
            dlxMailMessage dlxMessage = DeluxeOM.Services.Common.Mapper.GetMailMessageModel(_repository.GetNotificationMessage(notificationTYpe));

            //bool isSuccess = jobStatus.Success;
            //int jobId = jobStatus.JobId ;

            if (!App.Config.EnableEmailNotifications || !dlxMessage.IsActive)
            {
                return;
            }
            if (string.IsNullOrEmpty(dlxMessage.To))
            {
                return;
            }
            string recordImporetd = jobStatus.Success ? jobStatus.NoOfRecordsImported.ToString() : string.Empty;
            string body           = jobStatus.Success ? dlxMessage.SuccessBody : dlxMessage.FailureBody;

            body = string.Format(body, jobStatus.FileName, recordImporetd, DateTime.Now.ToString());
            dlxMessage.SuccessBody = body;

            string subject = jobStatus.Success ? dlxMessage.SuccessSubject : dlxMessage.FailureSubject;

            dlxMessage.SuccessSubject = subject;

            SendEmail(dlxMessage);
        }
        public NotificationEntity GetNotificationMessage(JobNotificationType notificationType)
        {
            string type = string.Empty;

            switch (notificationType)
            {
            case JobNotificationType.LoadAnnouncementNotification:
                type = "LoadAnnounceemnt";
                break;

            case JobNotificationType.LoadPriceReportNotification:
                type = "LoadPriceReport";
                break;

            case JobNotificationType.LoadQCReportNotification:
                type = "LoadQCReport";
                break;

            case JobNotificationType.LoadPipelineOrderNotification:
                type = "LoadPipelineOrder";
                break;

            case JobNotificationType.NewTitlesNotification:
                type = "NewTitles";
                break;
            }

            using (var _context = new DeluxeOrderManagementEntities())
            {
                var nfnEty = _context.NotificationEntities
                             .FirstOrDefault(x => x.Type == type);

                return(nfnEty);
            }
        }
Example #3
0
 private void OnJobNotify(JobRunContext jobContext, JobNotificationType notificationType, Exception exception = null)
 {
     Notify?.Invoke(this, new JobNotificationEventArgs()
     {
         JobRunContext = jobContext, NotificationType = notificationType, Exception = exception
     });
 }
Example #4
0
 public void AddJob(UpdateJob jobToMonitor, JobNotificationType notifyType)
 {
     jobToMonitor.NotifyInterface = callback;
     jobToMonitor.NotifyFlags     = notifyType;
 }