/// <summary> /// Constructor /// </summary> public TaskRecorder(Guid pTaskID, string pName) { _taskID = pTaskID; _name = pName; _recorder = ObjectFactory.Container.GetInstance<iEventRecorder>(); }
/// <summary> /// Called by the worker thread. /// </summary> public override void Execute(JobContext pContext, iEventRecorder pEventRecorder) { EmailSettings settings = (EmailSettings)pContext.PluginSettings; /* IEnumerable<iJobReport> jobReports = from jobID in _jobService.getJobIDs() select _jobService.getJobReport(jobID, true); IEnumerable<IGrouping<string, iJobReport>> plugins = from report in jobReports group report by report.Plugin into plugin select plugin; Report.Report data = new Report.Report(from plugin in plugins select new Plugin( plugin.Key, from job in plugin select new Job( job.Name, from t in job.Tasks select new Report.Task( t.Name, from e in t.EventRecorder.getEvents() select new Event(e.Message) ) ) )); */ /* Dictionary<string, List<Dictionary<string, object>>> data = new Dictionary<string, List<Dictionary<string, object>>>(); data.Add("Reports", new List<Dictionary<string, object>>()); data["Reports"].Add(new Dictionary<string, object>()); data["Reports"][0].Add("title", "This is a title"); data["Reports"][0].Add("summary", "This is a summary"); */ DataReport report = new DataReport(new[]{"Name","When","Value"}) {Title = "This is a title", Summary = "This is a summary"}; report.Tables[0].Add(new[] {"Mathew", "10/10/10", "1203"}); DataReports reports = new DataReports(); reports.Reports.Add(report); StringWriter outWriter = new StringWriter(); _template.Render(reports, outWriter, null, null); string output = _markdown.Transform(outWriter.ToString()); MailAddress from = new MailAddress(settings.AdminEmail, settings.AdminName); _emailService.Start(from, from, settings.Subject, null, output); foreach (MailAddress who in _mailingList.getMailingList()) { _emailService.To(who); } _emailService.Send(); }
/// <summary> /// Constructor /// </summary> public TaskEntry(iTask pTask, iEventRecorder pEventRecorder) { if (pTask == null || pEventRecorder == null) { throw new NullReferenceException(); } ID = Guid.NewGuid(); Task = pTask; Recorder = pEventRecorder; }
/// <summary> /// Constructor /// </summary> protected JobContext([NotNull] PluginSettings pPluginSettings, [CanBeNull] iDataSource pDataSource, [NotNull] iEventFactory pEventFactory) { if (pPluginSettings == null) { throw new ArgumentNullException("pPluginSettings"); } if (pEventFactory == null) { throw new ArgumentNullException("pEventFactory"); } Source = pDataSource; PluginSettings = pPluginSettings; _eventFactory = pEventFactory; _eventRecorder = null; }
/// <summary> /// Called by the worker thread. /// </summary> public void Execute(JobContext pContext, iEventRecorder pEventRecorder) { Thread.Sleep(5000); }
/// <summary> /// Constructor /// </summary> public TaskReport(Guid pTaskID, string pName, iEventRecorder pEventRecorder) { ID = pTaskID; Name = pName; EventRecorder = pEventRecorder; }
/// <summary> /// Assigns an exception recorder to the current context. /// </summary> public void setEventRecorder(iEventRecorder pRecorder) { _eventRecorder = pRecorder; }
/// <summary> /// Called by the worker thread. /// </summary> public abstract void Execute(JobContext pContext, iEventRecorder pEventRecorder);