Example #1
0
 public HeatDataFaking(OenContext oenContext, HotmailHeatContext heatContext, ILog logger)
 {
     _oenContext = oenContext;
     _oenTestContext = new OenTesting();
     _heatContext = heatContext;
     _logger = logger;
 }
Example #2
0
        static void CoBProcess()
        {
            Database.SetInitializer<OenContext>(null);
            var oenContext = new OenContext();
            var heatContext = new HotmailHeatContext();
            var settings = new CancelOnBulkingSettings(oenContext);
            var logger = new Logger();
            var heatTestGen = new HeatDataFaking(oenContext, heatContext, logger);
#if DEBUG
            var emails = new string[] { "*****@*****.**" };
#else
            var emails = settings.NotifyEmails;
#endif
            var jobRepository = new JobRepository(oenContext, logger, true);
            var CoB = new CancelOnBulking(logger,
                                          new MtaAgent(logger, true),
                                          new EmailNotification(logger, jobRepository, emails, settings.SmtpServer),
                                          oenContext,
                                          new EventRepository(oenContext),
                                          jobRepository
                                          );

            heatTestGen.GenerateData(settings.RunIntervalMinutes);

            try
            {
                var nextReset = DateTime.Today.Add(settings.ResetTime);

                if (nextReset < DateTime.Now)
                {
                    nextReset = nextReset.AddDays(1);
                }
                CoB.FindAndCancelBulkingCampaigns(new PmtaRepository(oenContext),
                                                    new DeliveryGroupRepository(oenContext),
                                                    new HeatDataRepository(oenContext, heatContext),
                                                    settings.RunIntervalMinutes,
                                                    settings.MinimumRecords,
                                                    settings.MinimumInboxing,
                                                    nextReset
                                                    );
            }
            catch (Exception ex)
            {

                logger.Error(ex.UnwrapForLog(true));
            }
        }
Example #3
0
        private void RunCancelOnBulking(OenContext oenContext, CancelOnBulkingSettings settings, DateTime nextReset)
        {
            var heatContext = new HotmailHeatContext();
            var coB = GetNewCancelOnBulking(oenContext, settings);

            try
            {
                _logger.Info("Starting Cancel on Bulking process");
                coB.FindAndCancelBulkingCampaigns(new PmtaRepository(oenContext),
                                                    new DeliveryGroupRepository(oenContext),
                                                    new HeatDataRepository(oenContext, heatContext),
                                                    settings.RunIntervalMinutes,
                                                    settings.MinimumRecords,
                                                    settings.MinimumInboxing,
                                                    nextReset);
                _logger.Info("Finished Cancel on Bulking process");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.UnwrapForLog(true));
            }
        }
Example #4
0
        static void CoBReset()
        {
            Database.SetInitializer<OenContext>(null);
            var oenContext = new OenContext();
            var heatContext = new HotmailHeatContext();
            var settings = new CancelOnBulkingSettings(oenContext);
            var logger = new Logger();
#if DEBUG
            var emails = new string[] { "*****@*****.**" };
#else
            var emails = settings.NotifyEmails;
#endif
            var jobRepository = new JobRepository(oenContext, logger, true);
            var CoB = new CancelOnBulking(logger,
                                          new MtaAgent(logger, true),
                                          new EmailNotification(logger, jobRepository, emails, settings.SmtpServer),
                                          oenContext,
                                          new EventRepository(oenContext),
                                          jobRepository
                                          );

            try
            {
                CoB.ResumeMtaQueues();
            }
            catch (Exception ex)
            {
                logger.Error(ex.UnwrapForLog(true));
            }
        }