コード例 #1
0
        /// <summary>
        /// Creates a <see cref="ParameterDefinition"/> list that represents this filter.
        /// </summary>
        public ParameterDefinition[] ToParameterDefinition()
        {
            var result = new List <ParameterDefinition>();

            if (Deep)
            {
                result.Add(ParameterDefinition.Create(DeepParamName, Deep.ToString()));
            }

            if (LimitResult >= 0)
            {
                result.Add(ParameterDefinition.Create(LimitResultParamName, LimitResult.ToString()));
            }

            if (MeasurementUuids != null && MeasurementUuids.Length > 0)
            {
                result.Add(ParameterDefinition.Create(MeasurementUuidsParamName, RestClientHelper.ConvertGuidListToString(MeasurementUuids)));
            }

            if (RequestedMeasurementAttributes != null && RequestedMeasurementAttributes.AllAttributes != AllAttributeSelection.True && RequestedMeasurementAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedMeasurementAttributesParamName, RestClientHelper.ConvertUInt16ListToString(RequestedMeasurementAttributes.Attributes)));
            }

            if (OrderBy != null && OrderBy.Length > 0)
            {
                result.Add(ParameterDefinition.Create(OrderByParamName, OrderByToString(OrderBy)));
            }

            if (SearchCondition != null)
            {
                result.Add(ParameterDefinition.Create(SearchConditionParamName, SearchConditionParser.GenericConditionToString(SearchCondition)));
            }

            if (Statistics != MeasurementStatistics.None)
            {
                result.Add(ParameterDefinition.Create(StatisticsParamName, Statistics.ToString()));
            }

            if (AggregationMeasurements != AggregationMeasurementSelection.Default)
            {
                result.Add(ParameterDefinition.Create(AggregationParamName, AggregationMeasurements.ToString()));
            }

            if (FromModificationDate.HasValue)
            {
                result.Add(ParameterDefinition.Create(FromModificationDateParamName, XmlConvert.ToString(FromModificationDate.Value, XmlDateTimeSerializationMode.RoundtripKind)));
            }

            if (ToModificationDate.HasValue)
            {
                result.Add(ParameterDefinition.Create(ToModificationDateParamName, XmlConvert.ToString(ToModificationDate.Value, XmlDateTimeSerializationMode.RoundtripKind)));
            }

            return(result.ToArray());
        }
コード例 #2
0
        /// <summary>
        /// Creates a <see cref="ParameterDefinition"/> list that represents this filter.
        /// </summary>
        public override ParameterDefinition[] ToParameterDefinition()
        {
            var result = new List <ParameterDefinition>();

            if (PartUuids != null && PartUuids.Length > 0)
            {
                result.Add(ParameterDefinition.Create(PartUuidsParamName, RestClientHelper.ConvertGuidListToString(PartUuids)));
            }

            if (Deep)
            {
                result.Add(ParameterDefinition.Create(DeepParamName, Deep.ToString()));
            }

            if (LimitResult >= 0)
            {
                result.Add(ParameterDefinition.Create(LimitResultParamName, LimitResult.ToString()));
            }

            if (MeasurementUuids != null && MeasurementUuids.Length > 0)
            {
                result.Add(ParameterDefinition.Create(MeasurementUuidsParamName, RestClientHelper.ConvertGuidListToString(MeasurementUuids)));
            }

            if (CharacteristicsUuidList != null && CharacteristicsUuidList.Length > 0)
            {
                result.Add(ParameterDefinition.Create(CharacteristicsUuidListParamName, RestClientHelper.ConvertGuidListToString(CharacteristicsUuidList)));
            }

            if (RequestedValueAttributes != null && RequestedValueAttributes.AllAttributes != AllAttributeSelection.True && RequestedValueAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedValueAttributesParamName, RestClientHelper.ConvertUshortArrayToString(RequestedValueAttributes.Attributes)));
            }

            if (RequestedMeasurementAttributes != null && RequestedMeasurementAttributes.AllAttributes != AllAttributeSelection.True && RequestedMeasurementAttributes.Attributes != null)
            {
                result.Add(ParameterDefinition.Create(RequestedMeasurementAttributesParamName, RestClientHelper.ConvertUshortArrayToString(RequestedMeasurementAttributes.Attributes)));
            }

            if (OrderBy != null && OrderBy.Length > 0)
            {
                result.Add(ParameterDefinition.Create(OrderByParamName, MeasurementFilterAttributes.OrderByToString(OrderBy)));
            }

            if (SearchCondition != null)
            {
                result.Add(ParameterDefinition.Create(SearchConditionParamName, SearchConditionParser.GenericConditionToString(SearchCondition)));
            }

            if (AggregationMeasurements != AggregationMeasurementSelection.Default)
            {
                result.Add(ParameterDefinition.Create(AggregationParamName, AggregationMeasurements.ToString()));
            }

            if (FromModificationDate.HasValue)
            {
                result.Add(ParameterDefinition.Create(FromModificationDateParamName, XmlConvert.ToString(FromModificationDate.Value, XmlDateTimeSerializationMode.RoundtripKind)));
            }

            if (ToModificationDate.HasValue)
            {
                result.Add(ParameterDefinition.Create(ToModificationDateParamName, XmlConvert.ToString(ToModificationDate.Value, XmlDateTimeSerializationMode.RoundtripKind)));
            }

            if (MergeAttributes != null && MergeAttributes.Length > 0)
            {
                result.Add(ParameterDefinition.Create(MergeAttributesParamName, RestClientHelper.ConvertUshortArrayToString(MergeAttributes)));
            }

            if (MergeCondition != MeasurementMergeCondition.MeasurementsInAllParts)
            {
                result.Add(ParameterDefinition.Create(MergeConditionParamName, MergeCondition.ToString()));
            }

            if (MergeMasterPart != null)
            {
                result.Add(ParameterDefinition.Create(MergeMasterPartParamName, MergeMasterPart.ToString()));
            }

            return(result.ToArray());
        }