Beispiel #1
0
 static bool ValidateInput(string[] rawInput, out ParkingChargeType chargeType, out DateTime periodStart, out DateTime periodEnd)
 {
     chargeType  = ParkingChargeType.ShortStay;
     periodStart = periodEnd = DateTime.MinValue;
     return(rawInput != null && rawInput.Length == 3 && Enum.TryParse(rawInput[0], out chargeType) &&
            DateTime.TryParse(rawInput[1], out periodStart) && DateTime.TryParse(rawInput[2], out periodEnd));
 }
        public IParkingChargeCalculator GetCalculator(ParkingChargeType chargeType)
        {
            switch (chargeType)
            {
            case ParkingChargeType.ShortStay:
                return(new ShortStayParkingChargeCalculator(HOUR_RATE));

            case ParkingChargeType.LongStay:
                return(new LongStayParkingChargeCalculator(DAY_RATE));

            default:
                return(null);
            }
        }