Ejemplo n.º 1
0
        public void Update(Vehicle vehicle, DateTime now, decimal pricePerMinute)
        {
            TotalVehicles  += 1;
            TotalMembers   += 1;
            TotalWheels    += vehicle.NumberOfWheels;
            TotalCost      += (decimal)Math.Round((now - vehicle.CheckinTime).TotalMinutes) * pricePerMinute;
            TotalUnitsUsed += vehicle.Units;

            if (!ColorNames.ContainsKey(vehicle.VehicleColorId))
            {
                ColorNames[vehicle.VehicleColorId] = vehicle.Color.Name;
            }
            if (!TypeNames.ContainsKey(vehicle.VehicleTypeId))
            {
                TypeNames[vehicle.VehicleTypeId] = vehicle.Type.Type;
            }

            // Vehicle Color statistics
            if (!ColorStatistics.ContainsKey(vehicle.VehicleColorId))
            {
                ColorStatistics[vehicle.VehicleColorId] = 1;
            }
            else
            {
                ColorStatistics[vehicle.VehicleColorId] += 1;
            }

            // Vehicle Type statistics
            if (!TypeStatistics.ContainsKey(vehicle.VehicleTypeId))
            {
                TypeStatistics[vehicle.VehicleTypeId] = 1;
            }
            else
            {
                TypeStatistics[vehicle.VehicleTypeId] += 1;
            }

            // Vehicle Type & Color statistics
            if (!TypeColorStatistics.ContainsKey(vehicle.VehicleTypeId))
            {
                TypeColorStatistics[vehicle.VehicleTypeId] = new Dictionary <int, int>();
            }
            var tcs = TypeColorStatistics[vehicle.VehicleTypeId];

            if (!tcs.ContainsKey(vehicle.VehicleColorId))
            {
                tcs[vehicle.VehicleColorId] = 1;
            }
            else
            {
                tcs[vehicle.VehicleColorId] += 1;
            }
        }
Ejemplo n.º 2
0
        public void Update(Vehicle vehicle, DateTime now, decimal pricePerMinute)
        {
            TotalVehicles  += 1;
            TotalWheels    += vehicle.NumberOfWheels;
            TotalCost      += (decimal)Math.Round((now - vehicle.Timestamp).TotalMinutes) * pricePerMinute;
            TotalUnitsUsed += vehicle.Units;

            // Vehicle Color statistics
            if (!ColorStatistics.ContainsKey(vehicle.Color))
            {
                ColorStatistics[vehicle.Color] = 1;
            }
            else
            {
                ColorStatistics[vehicle.Color] += 1;
            }

            // Vehicle Type statistics
            if (!TypeStatistics.ContainsKey(vehicle.Type))
            {
                TypeStatistics[vehicle.Type] = 1;
            }
            else
            {
                TypeStatistics[vehicle.Type] += 1;
            }

            // Vehicle Type & Color statistics
            if (!TypeColorStatistics.ContainsKey(vehicle.Type))
            {
                TypeColorStatistics[vehicle.Type] = new Dictionary <Vehicle.VehicleColor, int>();
            }
            var tcs = TypeColorStatistics[vehicle.Type];

            if (!tcs.ContainsKey(vehicle.Color))
            {
                tcs[vehicle.Color] = 1;
            }
            else
            {
                tcs[vehicle.Color] += 1;
            }
        }