private decimal GetMoney(double startTime, double endTime)
        {
            Func <SubsectionTotalLength, bool> predicate = null;
            double  dtTemp = startTime;
            decimal num    = 0M;

            while (dtTemp < endTime)
            {
                if (predicate == null)
                {
                    predicate = x => (x.beginTime <= dtTemp) && (x.endTime >= dtTemp);
                }
                SubsectionTotalLength length = this.Subsections.Where <SubsectionTotalLength>(predicate).FirstOrDefault <SubsectionTotalLength>();
                if (null == length)
                {
                    return(num);
                }
                num   += length.payMoney;
                dtTemp = length.endTime + 1;
            }
            return(num);
        }
Ejemplo n.º 2
0
        private decimal GetMoney(double totalMinutes)
        {
            double  dtTemp               = totalMinutes;
            decimal payMoney             = 0M;
            SubsectionTotalLength length = (from x in this.Subsections
                                            where (x.beginTime <= dtTemp) && (x.endTime >= dtTemp)
                                            select x).FirstOrDefault <SubsectionTotalLength>();

            if (null != length)
            {
                payMoney = length.payMoney;
            }
            else
            {
                payMoney = this.dailyCapMoney;
            }
            if (payMoney > this.dailyCapMoney)
            {
                payMoney = this.dailyCapMoney;
            }
            return(payMoney);
        }