/// Constructor To Create RideRepository instance.
 /// </summary>
 /// <summary>
 public InvoiceGenerator(RideType rideType)
 {
     this.rideType       = rideType;
     this.rideRepository = new RideRepository();
     try
     {
         //If Ride type is Premium Then Rates Set For Premium else For Normal.
         if (rideType.Equals(RideType.PREMIUM))
         {
             this.MINIMUM_COST_PER_KM = 15;
             this.COST_PER_TIME       = 2;
             this.MINIMUM_FARE        = 20;
         }
         else if (rideType.Equals(RideType.NORMAL))
         {
             this.MINIMUM_COST_PER_KM = 10;
             this.COST_PER_TIME       = 1;
             this.MINIMUM_FARE        = 5;
         }
     }
     catch (CabInvoiceException)
     {
         throw new CabInvoiceException(CabInvoiceException.ExceptionType.INVALID_RIDE_TYPE, "Invalid Ride Type");
     }
 }
Exemple #2
0
 //Constructor to create Repositoru instance
 public InvoiceGenerator(RideType rideType)
 {
     this.rideType       = rideType;
     this.rideRepository = new RideRepository();
     try
     {
         //If Ride type is premium then rates set for premium else for normal
         if (rideType.Equals(RideType.Premium))
         {
             this.Min_Cost_Per_km = 15;
             this.Cost_Per_km     = 2;
             this.Min_Fare        = 20;
         }
         else if (rideType.Equals(RideType.Normal))
         {
             this.Min_Cost_Per_km = 10;
             this.Cost_Per_km     = 1;
             this.Min_Fare        = 5;
         }
         else
         {
             throw new CabInvoiceException(CabInvoiceException.ExceptionType.Invalid_Ride_Type, "Invalid Ride Type");
         }
     }
     catch (CabInvoiceException)
     {
         throw new CabInvoiceException(CabInvoiceException.ExceptionType.Invalid_Ride_Type, "Invalid Ride Type");
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="InvoiceGenerator"/> class.
 /// </summary>
 /// <param name="rideType">Type of the ride.</param>
 public InvoiceGenerator(RideType rideType)
 {
     rideRepository = new RideRepository();
     if (rideType == RideType.NORMAL)
     {
         MINIMUM_COST_PER_KM = RideRate.NORMAL_MINIMUM_COST_PER_KM;
         COST_PER_TIME       = COST_PER_TIME = RideRate.NORMAL_COST_PER_TIME;
         MINIMUM_FARE        = MINIMUM_FARE = RideRate.NORMAL_MINIMUM_FARE;
     }
     else
     {
         MINIMUM_COST_PER_KM = RideRate.PREMIUM_MINIMUM_COST_PER_KM;
         COST_PER_TIME       = COST_PER_TIME = RideRate.PREMIUM_COST_PER_TIME;
         MINIMUM_FARE        = MINIMUM_FARE = RideRate.PREMIUM_MINIMUM_FARE;
     }
 }
Exemple #4
0
        public void MapRidesToUser(string userID, Rides[] rides) => RideRepository.AddRides(userID, rides);            //create MapRidesToUser method

        public InvoiceSummary GetInvoiceSummary(string userID) => this.CalculateFare(RideRepository.GetRides(userID)); //create method GetInvoiceSummary
Exemple #5
0
 public void MapRidesToUser(string userID, Rides[] rides) => RideRepository.AddRides(userID, rides);            //create MapRidesToUser method