Ejemplo n.º 1
0
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            if (bundle.JobDetail.JobType == typeof(EmailSendingJob))
            {
                var context = new InfrastructureContext("DDDCinema");
                var notificationRepository = new EfNotificationRepository(context);
                var job = new EmailSendingJob(notificationRepository, new SmtpMailSender());
                return(new TransactionalJob(job, context));
            }

            if (bundle.JobDetail.JobType == typeof(SmsSendingJob))
            {
                var context = new InfrastructureContext("DDDCinema");
                var notificationRepository = new EfNotificationRepository(context);
                var job = new SmsSendingJob(notificationRepository, new GateSmsSender());
                return(new TransactionalJob(job, context));
            }

            throw new InvalidOperationException("Not supported job type");
        }
Ejemplo n.º 2
0
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            if (bundle.JobDetail.JobType == typeof(EmailSendingJob))
            {
                var context = new InfrastructureContext("DDDCinema");
                var notificationRepository = new EfNotificationRepository(context);
                var job = new EmailSendingJob(notificationRepository, new SmtpMailSender());
                return new TransactionalJob(job, context);
            }

            if (bundle.JobDetail.JobType == typeof(SmsSendingJob))
            {
                var context = new InfrastructureContext("DDDCinema");
                var notificationRepository = new EfNotificationRepository(context);
                var job = new SmsSendingJob(notificationRepository, new GateSmsSender());
                return new TransactionalJob(job, context);
            }

            throw new InvalidOperationException("Not supported job type");
        }