コード例 #1
0
        protected override void AddSpecifiedAttributes()
        {
            AddAttribute(RoutingMode);

            if (Start != null) AddAttribute(Start);
            if (Destination != null) AddAttribute(Destination);

            AddAttribute(PropertyHelper.GetDescription(() => Ranges), string.Join(",", Ranges));
            AddAttribute(PropertyHelper.GetDescription(() => RangeType), EnumHelper.GetDescription(RangeType));

            if (JsonAttributes != null)
                AddAttribute(JsonAttributes);
            else
                AddAttribute(new JsonRepresentation(JsonAttribute.Include_TypeElement, JsonAttribute.UsePluralNamingForCollections, JsonAttribute.SupressJsonResponseObjectWrapper));

            if (ConsumptionModel != null) AddAttribute(ConsumptionModel);
            if (CustomConsumptionDetails != null) AddAttribute(CustomConsumptionDetails);

            if (RequestId != null) AddAttribute(PropertyHelper.GetDescription(() => RequestId), RequestId);

            if (SingleComponent != null) AddAttribute(PropertyHelper.GetDescription(() => SingleComponent), SingleComponent.ToString().ToLower());
            if (Resolution != null) AddAttribute(PropertyHelper.GetDescription(() => Resolution), Resolution.ToString());
            if (MaxPoints != null) AddAttribute(PropertyHelper.GetDescription(() => MaxPoints), MaxPoints.ToString());
            if (Quality != null) AddAttribute(PropertyHelper.GetDescription(() => Quality), Quality.ToString());

            if (Departure != null) AddAttribute(PropertyHelper.GetDescription(() => Departure), ((DateTime)Departure).ToString("s"));
            if (Arrival != null) AddAttribute(PropertyHelper.GetDescription(() => Arrival), ((DateTime)Arrival).ToString("s"));

            if (JsonCallback != null) AddAttribute(PropertyHelper.GetDescription(() => JsonCallback), JsonCallback);

            if (TruckType != null) AddAttribute(PropertyHelper.GetDescription(() => TruckType), EnumHelper.GetDescription(TruckType));
            if (TrailersCount != null) AddAttribute(PropertyHelper.GetDescription(() => TrailersCount), TrailersCount.ToString());

            if (ShippedHazardousGoods != null) AddAttribute(PropertyHelper.GetDescription(() => ShippedHazardousGoods), string.Join(",", ShippedHazardousGoods.Select(sg => EnumHelper.GetDescription(sg))));

            if (LimitedWeight != null) AddAttribute(PropertyHelper.GetDescription(() => LimitedWeight), LimitedWeight.Value.ToString(HereAPISession.Culture));
            if (WeightPerAxle != null) AddAttribute(PropertyHelper.GetDescription(() => WeightPerAxle), WeightPerAxle.Value.ToString(HereAPISession.Culture));
            if (Height != null) AddAttribute(PropertyHelper.GetDescription(() => Height), Height.Value.ToString(HereAPISession.Culture));
            if (Width != null) AddAttribute(PropertyHelper.GetDescription(() => Width), Width.Value.ToString(HereAPISession.Culture));
            if (Length != null) AddAttribute(PropertyHelper.GetDescription(() => Length), Length.Value.ToString(HereAPISession.Culture));

            if (TunnelCategory != null) AddAttribute(PropertyHelper.GetDescription(() => TunnelCategory), EnumHelper.GetDescription(TunnelCategory));
        }
コード例 #2
0
 public override string ToString()
 {
     try {
         return(Name + " [" + MaxPoints.ToString() + "]\r\n" + Description[0]);
     } catch (Exception) { return("Failed to convert PetTalentDataAttribute to string."); }
 }