示例#1
0
        private void applyFSC(DriverCompDataset.DriverRouteTableRow driverRoute, RouteRates rates)
        {
            //Calculate FSC if required
            try {
                //1. FSC applies only if miles rates are present in the rating
                if (rates.MileBaseRate > 0 || rates.MileRate > 0)
                {
                    driverRoute.FSCMiles = driverRoute.Miles;
                }

                //2. Copy rates (for reference)
                driverRoute.FuelCost = this.mFuelCost;
                driverRoute.FSCGal   = FinanceGateway.GetDriverEquipmentMPG(driverRoute.EquipmentTypeID);
                if (driverRoute.FSCGal <= 0.0M)
                {
                    throw new ApplicationException("FSCGal (" + driverRoute.FSCGal.ToString() + "MPG) is invalid.");
                }
                driverRoute.FSCBaseRate = this.mTerminalConfig.FSBase;

                //3. Calculate FSC
                driverRoute.FSC = driverRoute.FSCMiles / driverRoute.FSCGal * (driverRoute.FuelCost - driverRoute.FSCBaseRate);
                if (driverRoute.FSC < 0)
                {
                    driverRoute.FSC = 0.0M;
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
        }