public override decimal CalculateChargeGbp(ParkingChargeInstruction instruction) { return(base.CalculateChargeGbp(new ParkingChargeInstruction { ChargeType = instruction.ChargeType, ChargeStart = instruction.ChargeStart.Date, ChargeEnd = instruction.ChargeEnd.Date.AddDays(1).AddMilliseconds(-1) })); }
public virtual decimal CalculateChargeGbp(ParkingChargeInstruction instruction) { var totalPrice = 0m; var currentDateTime = instruction.ChargeStart; do { if (IsUnitOfTimeChargeable(currentDateTime, ChargeTimeUnit)) { totalPrice += CostPerUnitChargeTimeGbp; } currentDateTime = currentDateTime.AddSeconds(ChargeTimeUnit); } while (currentDateTime < instruction.ChargeEnd); return(Math.Round(totalPrice, 2, MidpointRounding.AwayFromZero)); }