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)); } }
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)); } }