예제 #1
0
        /// <summary>
        /// This function for the single metric and target metric controls like guage and counter
        /// </summary>
        /// <param name="chart_type"></param>
        /// <param name="chart_id"></param>
        /// <param name="from_date"></param>
        /// <param name="to_date"></param>
        /// <returns></returns>
        public Aggregate_DTO_Metric Get_Aggregate_Data_Signle_Metric(ChartType chart_type, int chart_id, DateTime from_date, DateTime to_date)
        {
            try
            {
                Aggregate_Element_Ids ElementIDs = new Aggregate_Element_Ids();
                double value        = 0.0;
                double target_value = 0.0;
                ElementIDs = _chart_rep.Get_Data_Points_By_Chart(chart_type, chart_id);
                // IEnumerable<long> Target_Element_Ids = _chart_rep.Get_Target_Data_Points_By_Chart(ChartType.Gauge, chart_id);

                value = _aggregare_data.Get_Aggregate(ElementIDs.Element_Ids, ElementIDs.Mertric_Rollup_Function, ElementIDs.Mertric_Unit, from_date, to_date);

                //For counter chart we do not have a target metric thats why we need this condtion
                if (ElementIDs.Target_Element_Ids != null)
                {
                    target_value = _aggregare_data.Get_Aggregate(ElementIDs.Target_Element_Ids, ElementIDs.Mertric_Target_Rollup_Function, ElementIDs.Target_Mertric_Unit, from_date, to_date);
                }

                Aggregate_DTO_Metric aggregate_dto_metric = new Aggregate_DTO_Metric();
                aggregate_dto_metric.Aggregate_Target_Value = target_value;
                aggregate_dto_metric.Aggregate_Value        = value;
                aggregate_dto_metric.Mertric_Unit           = ElementIDs.Mertric_Unit;
                aggregate_dto_metric.Metric_Name            = ElementIDs.Metric_Name;
                aggregate_dto_metric.Rollup_Function        = ElementIDs.Mertric_Rollup_Function;
                aggregate_dto_metric.Target_Mertric_Unit    = ElementIDs.Target_Mertric_Unit;
                aggregate_dto_metric.Target_Metric_Name     = ElementIDs.Target_Metric_Name;

                return(aggregate_dto_metric);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// this is temporary solution for the heat map. generate proper method for group by hour
        /// </summary>
        /// <param name="chart_id"></param>
        /// <param name="from_date"></param>
        /// <param name="to_date"></param>
        /// <returns></returns>
        public Aggregate_DTO_Group_By_Aggregation_Type Get_Aggregate_Data_Raw(int chart_id, DateTime from_date, DateTime to_date)
        {
            try
            {
                Aggregate_Element_Ids ElementIDs = new Aggregate_Element_Ids();

                ElementIDs = _chart_rep.Get_Data_Points_By_Chart(ChartType.HeatMap, chart_id);
                List <Aggregate_DTO_Group_By_Aggregation_Type_Value> _raw_aggregate_data = _aggregare_data.Get_Aggregate(ElementIDs.Element_Ids, ElementIDs.Mertric_Rollup_Function, ElementIDs.Mertric_Unit, AggerationType.Hour, from_date, to_date);

                Aggregate_DTO_Group_By_Aggregation_Type aggregate_data = new Aggregate_DTO_Group_By_Aggregation_Type();
                aggregate_data.Aggregate_Value = _raw_aggregate_data;
                aggregate_data.Metric_Name     = ElementIDs.Metric_Name;
                aggregate_data.Mertric_Unit    = ElementIDs.Mertric_Unit;

                aggregate_data.Rollup_Function = ElementIDs.Mertric_Rollup_Function;
                return(aggregate_data);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public Aggregate_DTO_Group_By_Aggregation_Type Get_Aggregate_Data(ChartType chart_type, int chart_id, DateTime from_date, DateTime to_date)
        {
            Combine_Enum_Tag_Aggregation Group_By = _chart_rep.Get_Group_By(chart_type, chart_id);

            Aggregate_Element_Ids ElementIds = _chart_rep.Get_Data_Points_By_Chart(chart_type, chart_id);

            Aggregate_DTO_Group_By_Aggregation_Type aggregate_dto = new Aggregate_DTO_Group_By_Aggregation_Type();

            aggregate_dto.Metric_Name        = ElementIds.Metric_Name;
            aggregate_dto.Target_Metric_Name = ElementIds.Target_Metric_Name;

            aggregate_dto.Mertric_Unit        = ElementIds.Mertric_Unit;
            aggregate_dto.Target_Mertric_Unit = ElementIds.Target_Mertric_Unit;

            //If there is no group by than default group by is day
            if (Group_By.Tage_Type != 0)
            {
                Tag_Type_Mapping_DTO tag_type_mapping = _tag_rep.Get_Tag_Type_Mapping_By_Tag_Type(Group_By.Tage_Type);

                aggregate_dto.Aggregate_Value        = _aggregare_data.Get_Aggregate(ElementIds.Element_Ids, ElementIds.Mertric_Rollup_Function, ElementIds.Mertric_Unit, tag_type_mapping.Point_Dim_Mapping, from_date, to_date);
                aggregate_dto.Aggregate_Target_Value = _aggregare_data.Get_Aggregate(ElementIds.Target_Element_Ids, ElementIds.Mertric_Target_Rollup_Function, ElementIds.Target_Mertric_Unit, tag_type_mapping.Point_Dim_Mapping, from_date, to_date);

                return(aggregate_dto);
            }
            else if (Group_By.Aggregation_Type != 0)
            {
                aggregate_dto.Aggregate_Value        = _aggregare_data.Get_Aggregate(ElementIds.Element_Ids, ElementIds.Mertric_Rollup_Function, ElementIds.Mertric_Unit, Group_By.Aggregation_Type, from_date, to_date);
                aggregate_dto.Aggregate_Target_Value = _aggregare_data.Get_Aggregate(ElementIds.Target_Element_Ids, ElementIds.Mertric_Target_Rollup_Function, ElementIds.Target_Mertric_Unit, Group_By.Aggregation_Type, from_date, to_date);
                return(aggregate_dto);
            }
            else
            {
                aggregate_dto.Aggregate_Value        = _aggregare_data.Get_Aggregate(ElementIds.Element_Ids, ElementIds.Mertric_Rollup_Function, ElementIds.Mertric_Unit, AggerationType.Day, from_date, to_date);
                aggregate_dto.Aggregate_Target_Value = _aggregare_data.Get_Aggregate(ElementIds.Target_Element_Ids, ElementIds.Mertric_Target_Rollup_Function, ElementIds.Target_Mertric_Unit, AggerationType.Day, from_date, to_date);
                return(aggregate_dto);
            }
        }