示例#1
0
 public NotificationJob SaveNotificationJob(NotificationJob job, string auditUser)
 {
     job.CreatedOn     = DateTime.UtcNow;
     job.Status        = NotificationJobStatus.SCHEDULED;
     job.StartDateTime = job.StartDateTime.ToUniversalTime();
     Context.NotificationJobs.Add(job);
     Context.LogValidationFailSaveChanges(auditUser);
     NotificationTopicSender.GetHandle().NotifyNotificationInserted();
     return(job);
 }
    protected override void OnUpdate()
    {
        NotificationJob notificationJob = new NotificationJob
        {
            animalTag   = GetComponentDataFromEntity <AnimalTag>(),
            mvmtData    = GetComponentDataFromEntity <AnimalMovementData>(),
            translation = GetComponentDataFromEntity <Translation>(),
        };

        Dependency = notificationJob.Schedule(stepPhysicsWorld.Simulation, ref buildPhysicsWorld.PhysicsWorld, Dependency);
        Dependency.Complete();
    }
示例#3
0
        protected void Application_Start()
        {
            resolver = new AutofacResolver();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            _notificationJob = new NotificationJob(resolver.Container);

            Task.Factory.StartNew(() => _notificationJob.Start());
        }
 public void SetUp()
 {
     _mockEmailService     = new Mock <IEmployerEmailTemplatesService>();
     _mockNotificationApi  = new Mock <INotificationsApi>();
     _providerEmailService = new Mock <IProviderEmailTemplatesService>();
     _sur = new NotificationJob(
         _mockEmailService.Object,
         _providerEmailService.Object,
         _mockNotificationApi.Object,
         Mock.Of <ILog>(),
         new CommitmentNotificationConfiguration {
         SendEmail = true
     });
 }
示例#5
0
        public async Task ShouldNotCallProviderAlertEmailServiceToSendEmailsWhenConfigSendEmailIsFalse()
        {
            _sur = new NotificationJob(
                _mockEmailService.Object,
                _providerEmailService.Object,
                _sendingEmployerTransferRequestEmailService.Object,
                _mockNotificationApi.Object,
                Mock.Of <ILog>(),
                new CommitmentNotificationConfiguration {
                SendEmail = false
            });

            await _sur.RunProviderAlertSummaryNotification("JobId");

            _providerEmailService.Verify(m => m.SendAlertSummaryEmails(It.IsAny <string>()), Times.Never);
        }
示例#6
0
        public void SetUp()
        {
            _mockEmailService     = new Mock <IEmployerAlertSummaryEmailService>();
            _mockNotificationApi  = new Mock <INotificationsApi>();
            _providerEmailService = new Mock <IProviderAlertSummaryEmailService>();
            _sendingEmployerTransferRequestEmailService = new Mock <ISendingEmployerTransferRequestEmailService>();

            _sur = new NotificationJob(
                _mockEmailService.Object,
                _providerEmailService.Object,
                _sendingEmployerTransferRequestEmailService.Object,
                _mockNotificationApi.Object,
                Mock.Of <ILog>(),
                new CommitmentNotificationConfiguration {
                SendEmail = true
            });
        }
        /// <summary>
        /// Parse a DateTime from a string.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public bool TryParse(string[] input, string author, out NotificationJob notification)
        {
            notification = null;
            if (string.IsNullOrEmpty(string.Join(' ', input)))
            {
                return(false);
            }

            Lexer.Lex(input);
            ParseState state = ParseState.Time;

            bool timeDone    = false;
            bool channelDone = false;

            string        message  = "";
            DateTime      dateTime = DateTime.UtcNow;
            TimeSpan      timeSpan = new TimeSpan();
            List <string> channels = new List <string>();

            Token <TokenType> token = Lexer.GetToken();

            while (token != null)
            {
                if (token.Type == TokenType.Separator)
                {
                    if (!TryChangeState(token, out state, out _))
                    {
                        return(false);
                    }

                    Lexer.NextToken();
                }

                switch (state)
                {
                case ParseState.Date:
                    timeDone = true;
                    if (!TryParseDateTime(Lexer, Config.InputTimeFormats, out dateTime, out _))
                    {
                        return(false);
                    }

                    break;

                case ParseState.Time:
                    timeDone = true;
                    if (!TryParseTimespan(Lexer, out timeSpan, out _))
                    {
                        return(false);
                    }

                    break;

                case ParseState.Channel:
                    channelDone = true;
                    if (!TryParseChannel(Lexer, out channels, out _))
                    {
                        return(false);
                    }

                    break;

                case ParseState.Text:
                    if (timeDone && channelDone)
                    {
                        if (!TryParseText(Lexer, out message))
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }

                    break;
                }

                // Update token
                token = Lexer.GetToken();
            }

            notification = new NotificationJob(author, timeSpan, message, channels);
            return(true);
        }