Пример #1
0
        public override decimal GetChargeUnitFee(DateTime beginning)
        {
            decimal fee = 0;

            if (DayTimezone.IsIn(beginning))
            {
                fee += DayTimezone.CalculateFee(DayTimezone.RegularCharge.Minutes);//收取一个单元分钟数费用
                if (DayTimezone.LimiteFee.HasValue && DayTimezone.LimiteFee > 0 && fee > DayTimezone.LimiteFee)
                {
                    fee = DayTimezone.LimiteFee.Value;
                }
            }
            else if (NightTimezone.IsIn(beginning))
            {
                fee += NightTimezone.CalculateFee(DayTimezone.RegularCharge.Minutes);//收取一个单元分钟数费用
                if (NightTimezone.LimiteFee.HasValue && NightTimezone.LimiteFee > 0 && fee > NightTimezone.LimiteFee)
                {
                    fee = NightTimezone.LimiteFee.Value;
                }
            }

            if (FeeOf24Hour > 0 && fee > FeeOf24Hour)
            {
                fee = FeeOf24Hour;
            }

            if (FeeOfMax > 0 && fee > FeeOfMax)
            {
                fee = FeeOfMax;                                //有封顶费用
            }
            return(fee);
        }
Пример #2
0
        public override decimal CalcalateCycleFee(double calMins, DateTime beginning, DateTime ending)
        {
            decimal fee      = 0;
            double  minmutes = 0;

            minmutes = DayTimezone.TimeZoneTotalMinutes();
            fee     += DayTimezone.CalculateFee(minmutes);

            minmutes = NightTimezone.TimeZoneTotalMinutes();
            fee     += NightTimezone.CalculateFee(minmutes);

            if (FeeOf24Hour > 0 && fee > FeeOf24Hour)
            {
                fee = FeeOf24Hour;
            }

            if (FeeOfMax > 0 && fee > FeeOfMax)
            {
                fee = FeeOfMax;                                //有封顶费用
            }
            return(fee);
        }
Пример #3
0
 /// <summary>
 /// 在连续时间段内计算各时段交替收费的总费用
 /// </summary>
 /// <param name="beginning"></param>
 /// <param name="ending"></param>
 /// <returns></returns>
 private decimal CalculateFeeAlteration(DateTime beginning, DateTime ending)
 {
     double minDay = 0;
     double minNight = 0;
     decimal fee = 0;
     //交替计算,直到所有时段都计算完
     do
     {
         minDay = DayTimezone.SliceDuration(beginning, ending, SwitchWhenTimeZoneOverTime);
         if (minDay > 0)
         {
             fee += DayTimezone.CalculateFee(minDay);
             beginning = beginning.AddMinutes(minDay);
         }
         minNight = NightTimezone.SliceDuration(beginning, ending, SwitchWhenTimeZoneOverTime);
         if (minNight > 0)
         {
             fee += NightTimezone.CalculateFee(minNight);
             beginning = beginning.AddMinutes(minNight);
         }
     }
     while (minDay > 0 || minNight > 0);
     return fee;
 }
Пример #4
0
 /// <summary>
 /// 计算两个时段内的收费费用,不考虑时段的最高收费
 /// </summary>
 /// <param name="beginning"></param>
 /// <param name="ending"></param>
 /// <returns></returns>
 private TariffTwoZoneCharge CalculateTwoZoneChargeFee(DateTime beginning, DateTime ending)
 {
     TariffTwoZoneCharge chargeFee = new TariffTwoZoneCharge(beginning, ending);
     double minDay = 0;
     double minNight = 0;
     //交替计算,直到所有时段都计算完
     do
     {
         minDay = DayTimezone.SliceDuration(beginning, ending, SwitchWhenTimeZoneOverTime);
         if (minDay > 0)
         {
             chargeFee.FirstCharge += DayTimezone.CalculateFeeWithOutLimiteFee(minDay);
             beginning = beginning.AddMinutes(minDay);
         }
         minNight = NightTimezone.SliceDuration(beginning, ending, SwitchWhenTimeZoneOverTime);
         if (minNight > 0)
         {
             chargeFee.SecondCharge += NightTimezone.CalculateFeeWithOutLimiteFee(minNight);
             beginning = beginning.AddMinutes(minNight);
         }
     }
     while (minDay > 0 || minNight > 0);
     return chargeFee;
 }