Exemplo n.º 1
0
        public override List <string> CreateMetric()
        {
            base.CreateMetric();
            MOE.Common.Models.Repositories.ISignalsRepository signalRepository =
                MOE.Common.Models.Repositories.SignalsRepositoryFactory.Create();
            Signal            = signalRepository.GetSignalBySignalID(SignalID);
            this.MetricTypeID = 6;

            Chart  chart    = new Chart();
            string location = GetSignalLocation();

            //SignalPhaseCollection signalphasecollection = new SignalPhaseCollection(
            //    StartDate,
            //    EndDate,
            //    SignalID,
            //    ShowVolumes,
            //    SelectedBinSize,
            //    MetricTypeID);

            //If there are phases in the database add the charts
            //if (signalphasecollection.SignalPhaseList.Count > 0)
            //{
            //    foreach (MOE.Common.Business.SignalPhase signalPhase in signalphasecollection.SignalPhaseList)
            //    {
            //        if (signalPhase.Plans.PlanList.Count > 0)
            //        {
            //            chart = GetNewChart(signalPhase.Approach);
            //            AddDataToChart(chart, signalPhase);
            //            string chartName = CreateFileName();
            //            chart.ImageLocation = MetricFileLocation + chartName;
            //            chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg);
            //            ReturnList.Add(MetricWebPath + chartName);
            //    }

            //}
            List <Approach> metricApproaches = Signal.GetApproachesForSignalThatSupportMetric(this.MetricTypeID);

            if (metricApproaches.Count > 0)
            {
                foreach (Approach approach in metricApproaches)
                {
                    MOE.Common.Business.SignalPhase signalPhase = new SignalPhase(StartDate, EndDate, approach,
                                                                                  ShowVolumes, SelectedBinSize, MetricTypeID);

                    chart = GetNewChart(approach);
                    AddDataToChart(chart, signalPhase);
                    string chartName = CreateFileName();
                    chart.ImageLocation = MetricFileLocation + chartName;
                    chart.SaveImage(MetricFileLocation + chartName, System.Web.UI.DataVisualization.Charting.ChartImageFormat.Jpeg);
                    ReturnList.Add(MetricWebPath + chartName);
                }
            }



            return(ReturnList);
        }
Exemplo n.º 2
0
        public override List <string> CreateMetric()
        {
            base.CreateMetric();
            List <string> returnString = new List <string>();



            MOE.Common.Models.Repositories.ISignalsRepository sr = MOE.Common.Models.Repositories.SignalsRepositoryFactory.Create();
            MOE.Common.Models.Signal signal = sr.GetSignalBySignalID(SignalID);



            //for (int x = 1; x < maxPhase + 1; x++)
            List <Approach> metricApproaches = signal.GetApproachesForSignalThatSupportMetric(this.MetricTypeID);

            if (metricApproaches.Count > 0)
            {
                foreach (Approach approach in metricApproaches)
                {
                    //MOE.Common.Business.CustomReport.Phase phase = new MOE.Common.Business.CustomReport.Phase(detectors, x, SignalID, StartDate, EndDate, new List<int> { 1, 4, 5, 6, 7, 8, 9, 10, 61, 63, 64 }, 1);
                    MOE.Common.Business.CustomReport.Phase phase = new MOE.Common.Business.CustomReport.Phase(approach, StartDate, EndDate, new List <int> {
                        1, 4, 5, 6, 7, 8, 9, 10, 61, 63, 64
                    }, 1, false);

                    phase.ApproachDirection = approach.DirectionType.Description;

                    string location  = GetSignalLocation();
                    string chartName = CreateFileName();


                    if (phase.PhaseNumber > 0)
                    {
                        GetChart(StartDate, EndDate, phase, location, FirstSecondsOfRed,
                                 ShowFailLines, ShowAvgLines, ShowPercentFailLines, YAxisMax, chartName, returnString, false);
                    }

                    if (approach.PermissivePhaseNumber != null && approach.PermissivePhaseNumber > 0)
                    {
                        string permChartName = CreateFileName();

                        MOE.Common.Business.CustomReport.Phase permPhase = new MOE.Common.Business.CustomReport.Phase(approach, StartDate,
                                                                                                                      EndDate, new List <int> {
                            1, 4, 5, 6, 7, 8, 9, 10, 61, 63, 64
                        }, 1, true);

                        permPhase.ApproachDirection = approach.DirectionType.Description;

                        GetChart(StartDate, EndDate, permPhase, location, FirstSecondsOfRed,
                                 ShowFailLines, ShowAvgLines, ShowPercentFailLines, YAxisMax, permChartName, returnString, true);
                    }
                }
            }
            return(returnString);
        }