protected void LogMetricRun() { Models.Repositories.IApplicationEventRepository appEventRepository = Models.Repositories.ApplicationEventRepositoryFactory.Create(); Models.ApplicationEvent applicationEvent = new ApplicationEvent(); applicationEvent.ApplicationName = "SPM Website"; applicationEvent.Description = MetricType.ChartName + " Executed"; applicationEvent.SeverityLevel = ApplicationEvent.SeverityLevels.Low; applicationEvent.Timestamp = DateTime.Now; appEventRepository.Add(applicationEvent); }
private void GetChart(DateTime StartDate, DateTime EndDate, CustomReport.Phase phase, string location, int FirstSecondsOfRed, bool ShowFailLines, bool ShowAvgLines, bool ShowPercentFailLines, double?YAxisMax, string chartName, List <string> returnString, bool isPermissivePhase) { MOE.Common.Business.SplitFail.SplitFailChart sfChart = new MOE.Common.Business.SplitFail.SplitFailChart(this, phase); if (isPermissivePhase) { sfChart.chart.BackColor = Color.LightGray; sfChart.chart.Titles[2].Text = "Permissive " + sfChart.chart.Titles[2].Text + " " + phase.Approach.GetDetectorsForMetricType(12).FirstOrDefault().MovementType.Description; } else { sfChart.chart.Titles[2].Text = "Protected " + sfChart.chart.Titles[2].Text + " " + phase.Approach.GetDetectorsForMetricType(12).FirstOrDefault().MovementType.Description; } System.Threading.Thread.Sleep(300); chartName = chartName.Replace(".", (phase.ApproachDirection + ".")); try { sfChart.chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg); } catch { try { sfChart.chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg); } catch { Models.Repositories.IApplicationEventRepository appEventRepository = Models.Repositories.ApplicationEventRepositoryFactory.Create(); Models.ApplicationEvent applicationEvent = new ApplicationEvent(); applicationEvent.ApplicationName = "SPM Website"; applicationEvent.Description = MetricType.ChartName + " Failed While Saving File"; applicationEvent.SeverityLevel = ApplicationEvent.SeverityLevels.Medium; applicationEvent.Timestamp = DateTime.Now; appEventRepository.Add(applicationEvent); } } returnString.Add(MetricWebPath + chartName); }