Пример #1
0
        /// <summary>
        /// 获取尖、峰、平、谷四个费率的合计数据。
        /// </summary>
        /// <returns></returns>
        public decimal?GetSum()
        {
            decimal?decSum = null;

            foreach (int intEnumValue in Enum.GetValues(typeof(RatesOptions)))
            {
                RatesOptions enumValue = (RatesOptions)intEnumValue;
                if (enumValue != RatesOptions.Total)
                {
                    if (this[enumValue] != null)
                    {
                        if (decSum == null)
                        {
                            decSum = this[enumValue];
                        }
                        else
                        {
                            decSum += this[enumValue];
                        }
                    }
                }
            }

            return(decSum);
        }
Пример #2
0
        /// <summary>
        /// 获取或设置指定费率的数据。
        /// </summary>
        /// <param name="rates"></param>
        /// <returns></returns>
        public decimal?this[RatesOptions rates]
        {
            get
            {
                switch (rates)
                {
                case RatesOptions.Total:
                    return(this.Total);

                case RatesOptions.Pike:
                    return(this.Pike);

                case RatesOptions.Peak:
                    return(this.Peak);

                case RatesOptions.Flat:
                    return(this.Flat);

                case RatesOptions.Vale:
                    return(this.Vale);

                default:
                    return(null);
                }
            }
            set
            {
                switch (rates)
                {
                case RatesOptions.Total:
                    this.Total = value;
                    break;

                case RatesOptions.Pike:
                    this.Pike = value;
                    break;

                case RatesOptions.Peak:
                    this.Peak = value;
                    break;

                case RatesOptions.Flat:
                    this.Flat = value;
                    break;

                case RatesOptions.Vale:
                    this.Vale = value;
                    break;
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 获取费率对应的费率数。
        /// </summary>
        /// <param name="rates"></param>
        /// <returns></returns>
        public int GetRatesNumber(RatesOptions rates)
        {
            if (rates == RatesOptions.Total)
            {
                return(0);
            }

            foreach (System.Collections.Generic.KeyValuePair <int, RatesOptions> kvp in this.dicRates)
            {
                if (kvp.Value == rates)
                {
                    return(kvp.Key);
                }
            }
            throw new Exception("无" + rates.GetDescription() + "费率对应的费率数。");
        }
Пример #4
0
        /// <summary>
        /// 获取费率的文字说明。
        /// </summary>
        /// <param name="rates">费率</param>
        /// <returns>费率的文字说明</returns>
        public static string GetDescription(this RatesOptions rates)
        {
            switch (rates)
            {
            case RatesOptions.Total:
                return("总");

            case RatesOptions.Pike:
                return("尖");

            case RatesOptions.Peak:
                return("峰");

            case RatesOptions.Flat:
                return("平");

            case RatesOptions.Vale:
                return("谷");

            default:
                throw new NotImplementedException("尚未实现该枚举。");
            }
        }
Пример #5
0
 /// <summary>
 /// 费率、功效类型及相位组合的曲线值。
 /// </summary>
 /// <param name="rates">该数据的费率。</param>
 /// <param name="efficacy">该数据的功效类型。</param>
 /// <param name="phase">曲线数据的相位。</param>
 /// <param name="values">数据数组。数据数组的长度必须符合 CurvePointOptions 中定义的长度。</param>
 public RatesEfficacyPhaseCurveValue(RatesOptions rates, EfficacyOptions efficacy, PhaseOptions phase, decimal?[] values)
     : base(efficacy, phase, values)
 {
     this.Rates = rates;
 }
Пример #6
0
 /// <summary>
 /// 费率、功效类型及相位组合的曲线值。
 /// </summary>
 /// <param name="rates">该数据的费率。</param>
 /// <param name="efficacy">该数据的功效类型。</param>
 /// <param name="phase">曲线数据的相位。</param>
 /// <param name="curvePoint">该曲线的点数。</param>
 public RatesEfficacyPhaseCurveValue(RatesOptions rates, EfficacyOptions efficacy, PhaseOptions phase, CurvePointOptions curvePoint)
     : base(efficacy, phase, curvePoint)
 {
     this.Rates = rates;
 }
 /// <summary>
 /// 费率、功效类型及相位组合的曲线段值。
 /// </summary>
 /// <param name="rates">该数据的费率。</param>
 /// <param name="efficacy">该数据的功效类型。</param>
 /// <param name="phase">曲线数据的相位。</param>
 /// <param name="startTimeNum">第一个点的数值所对应的时间(hhmmss)。</param>
 /// <param name="endTimeNum">最后一个点的数值所对应的时间(hhmmss)。</param>
 /// <param name="values">曲线段各点数据。</param>
 public RatesEfficacyPhaseCurvePartValue(RatesOptions rates, EfficacyOptions efficacy, PhaseOptions phase, int startTimeNum, int endTimeNum, decimal?[] values)
     : base(efficacy, phase, startTimeNum, endTimeNum, values)
 {
     this.Rates = rates;
 }
 /// <summary>
 /// 费率、功效类型及相位组合的曲线段值。
 /// </summary>
 /// <param name="rates">该数据的费率。</param>
 /// <param name="efficacy">该数据的功效类型。</param>
 /// <param name="phase">曲线数据的相位。</param>
 /// <param name="curvePoint">曲线点数,该参数为 0:00:00 至 23:59:59 完整的曲线数据点数。</param>
 /// <param name="startTimeNum">第一个点的数值所对应的时间(hhmmss)。</param>
 /// <param name="endTimeNum">最后一个点的数值所对应的时间(hhmmss)。</param>
 public RatesEfficacyPhaseCurvePartValue(RatesOptions rates, EfficacyOptions efficacy, PhaseOptions phase, CurvePointOptions curvePoint, int startTimeNum, int endTimeNum)
     : base(efficacy, phase, curvePoint, startTimeNum, endTimeNum)
 {
     this.Rates = rates;
 }