コード例 #1
0
ファイル: MetricDelegates.cs プロジェクト: Levrum/Levrum
        public override object Calculate(Dictionary <object, List <IncidentData> > data, CalculationDelegate calculation = null, string category = "", object categoryValue = null)
        {
            Dictionary <object, object> output = new Dictionary <object, object>();

            foreach (KeyValuePair <object, List <IncidentData> > kvp in data)
            {
                List <double> minutesOfDay = new List <double>();

                foreach (IncidentData incident in kvp.Value)
                {
                    minutesOfDay.Add(incident.Time.Hour * 60 + incident.Time.Minute + (incident.Time.Second / 60));
                }

                if (calculation == null)
                {
                    output[kvp.Key] = minutesOfDay;
                }
                else
                {
                    output[kvp.Key] = calculation.Calculate(minutesOfDay);
                }
            }

            return(output);
        }
コード例 #2
0
ファイル: MetricDelegates.cs プロジェクト: Levrum/Levrum
        public override object Calculate(Dictionary <object, List <IncidentData> > data, CalculationDelegate calculation = null, string category = "", object categoryValue = null)
        {
            Dictionary <object, object> output = new Dictionary <object, object>();

            foreach (KeyValuePair <object, List <IncidentData> > datum in data)
            {
                List <double> fullComplements = new List <double>();

                foreach (IncidentData incident in datum.Value)
                {
                    double fullComplement = double.MinValue;
                    foreach (ResponseData response in incident.Responses)
                    {
                        double fullComplementBmk = (from TimingData bmk in response.TimingData
                                                    where bmk.Name == "FullComplement"
                                                    select bmk.Value).FirstOrDefault();

                        if (fullComplementBmk != default)
                        {
                            fullComplement = fullComplementBmk;
                            break;
                        }

                        double onScene = (from TimingData bmk in response.TimingData
                                          where bmk.Name == "OnScene"
                                          select bmk.Value).FirstOrDefault();

                        if (onScene > fullComplement)
                        {
                            fullComplement = onScene;
                        }
                    }

                    if (fullComplement != double.MinValue)
                    {
                        fullComplements.Add(fullComplement);
                    }
                }

                if (fullComplements.Count == 0)
                {
                    continue;
                }

                if (calculation == null)
                {
                    output[datum.Key] = fullComplements;
                }
                else
                {
                    output[datum.Key] = calculation.Calculate(fullComplements);
                }
            }

            return(output);
        }
コード例 #3
0
ファイル: MetricDelegates.cs プロジェクト: Levrum/Levrum
        public override object Calculate(Dictionary <object, List <IncidentData> > data, CalculationDelegate calculation = null, string category = "", object categoryValue = null)
        {
            Dictionary <object, object> output = new Dictionary <object, object>();

            foreach (KeyValuePair <object, List <IncidentData> > kvp in data)
            {
                List <double> sceneTimes = new List <double>();

                foreach (IncidentData incident in kvp.Value)
                {
                    foreach (ResponseData response in incident.Responses)
                    {
                        double onScene = (from TimingData bmk in response.TimingData
                                          where bmk.Name == "OnScene"
                                          select bmk.Value).FirstOrDefault();

                        if (onScene == default)
                        {
                            continue;
                        }

                        double clearScene = (from TimingData bmk in response.TimingData
                                             where bmk.Name == "ClearScene"
                                             select bmk.Value).FirstOrDefault();

                        if (clearScene == default)
                        {
                            continue;
                        }

                        sceneTimes.Add(clearScene - onScene);
                    }
                }

                if (calculation == null)
                {
                    output[kvp.Key] = sceneTimes;
                }
                else
                {
                    output[kvp.Key] = calculation.Calculate(sceneTimes);
                }
            }

            return(output);
        }
コード例 #4
0
ファイル: MetricDelegates.cs プロジェクト: Levrum/Levrum
        public override object Calculate(Dictionary <object, List <IncidentData> > data, CalculationDelegate calculation = null, string category = "", object categoryValue = null)
        {
            Dictionary <object, object> output = new Dictionary <object, object>();

            foreach (KeyValuePair <object, List <IncidentData> > datum in data)
            {
                List <double> committedTime = new List <double>();

                foreach (IncidentData incident in datum.Value)
                {
                    foreach (ResponseData response in incident.Responses)
                    {
                        double committedHours = (from TimingData bmk in response.TimingData
                                                 where bmk.Name == "CommittedHours"
                                                 select bmk.Value).FirstOrDefault();

                        if (committedHours != default)
                        {
                            committedTime.Add(committedHours * 60.0);
                            continue;
                        }

                        double dispatched = (from TimingData bmk in response.TimingData
                                             where bmk.Name == "Assigned"
                                             select bmk.Value).FirstOrDefault();

                        if (dispatched == default)
                        {
                            continue;
                        }

                        double clearScene = (from TimingData bmk in response.TimingData
                                             where bmk.Name == "ClearScene"
                                             select bmk.Value).FirstOrDefault();

                        if (clearScene == default)
                        {
                            continue;
                        }

                        committedTime.Add(clearScene - dispatched);
                    }
                }

                if (committedTime.Count == 0)
                {
                    continue;
                }

                if (calculation == null)
                {
                    output[datum.Key] = committedTime;
                }
                else
                {
                    output[datum.Key] = calculation.Calculate(committedTime);
                }
            }

            return(output);
        }