Ejemplo n.º 1
0
        public RouteRates GetRates(int equipmentTypeID, string route, decimal miles)
        {
            //Determine rates for a single driver route
            RouteRates rates = new RouteRates();

            try {
                DriverCompDataset.RateMileageRouteTableRow ratesMR = getRouteMileRates(route, miles);
                if (ratesMR != null)
                {
                    rates.RateTypeID   = RouteRates.RATETYPE_ROUTE;
                    rates.MileBaseRate = ratesMR.BaseRate;
                    rates.MileRate     = ratesMR.Rate;
                }
                DriverCompDataset.RateUnitRouteTableRow ratesUR = getRouteUnitRates(route);
                if (ratesUR != null)
                {
                    rates.RateTypeID          = RouteRates.RATETYPE_ROUTE;
                    rates.DayRate             = ratesUR.DayRate;
                    rates.TripRate            = ratesUR.MultiTripRate;
                    rates.StopRate            = ratesUR.StopRate;
                    rates.CartonRate          = ratesUR.CartonRate;
                    rates.PalletRate          = ratesUR.PalletRate;
                    rates.PickupCartonRate    = ratesUR.PickupCartonRate;
                    rates.MinimumAmount       = ratesUR.MinimumAmount;
                    rates.MaximumAmount       = ratesUR.MaximumAmount;
                    rates.MaximumTriggerField = ratesUR.MaximumTriggerField;
                    rates.MaximumTriggerValue = ratesUR.MaximumTriggerValue;
                    rates.FSBase = ratesUR.FSBase;
                }
                if (rates.RateTypeID == RouteRates.RATETYPE_NONE)
                {
                    rates.RateTypeID = RouteRates.RATETYPE_VEHICLE;
                    DriverCompDataset.RateMileageTableRow ratesMV = getVehicleMileRates(equipmentTypeID, miles);
                    if (ratesMV != null)
                    {
                        rates.MileBaseRate = ratesMV.BaseRate;
                        rates.MileRate     = ratesMV.Rate;
                    }
                    DriverCompDataset.RateUnitTableRow ratesUV = getVehicleUnitRates(equipmentTypeID);
                    if (ratesUV != null)
                    {
                        rates.DayRate             = ratesUV.DayRate;
                        rates.TripRate            = ratesUV.MultiTripRate;
                        rates.StopRate            = ratesUV.StopRate;
                        rates.CartonRate          = ratesUV.CartonRate;
                        rates.PalletRate          = ratesUV.PalletRate;
                        rates.PickupCartonRate    = ratesUV.PickupCartonRate;
                        rates.MinimumAmount       = ratesUV.MinimumAmount;
                        rates.MaximumAmount       = ratesUV.MaximumAmount;
                        rates.MaximumTriggerField = ratesUV.MaximumTriggerField;
                        rates.MaximumTriggerValue = ratesUV.MaximumTriggerValue;
                        rates.FSBase = ratesUV.FSBase;
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(rates);
        }
Ejemplo n.º 2
0
 private DriverCompDataset.RateUnitTableRow getVehicleUnitRates(int equipmentTypeID)
 {
     //Get all unit rates
     DriverCompDataset.RateUnitTableRow rate = null;
     try {
         string filter = "AgentNumber=" + this.mAgentNumber + " AND EquipmentTypeID=" + equipmentTypeID.ToString();
         DriverCompDataset.RateUnitTableRow[] rates = (DriverCompDataset.RateUnitTableRow[]) this.mRates.RateUnitTable.Select(filter);
         if (rates.Length > 0)
         {
             //Should be a single set
             if (rates.Length > 1)
             {
                 throw new RateRouteException("More than one rates exists for " + filter);
             }
             rate = rates[0];
         }
     }
     catch (ApplicationException ex) { throw ex; }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
     return(rate);
 }
Ejemplo n.º 3
0
        public RouteRatings GetRouteRatings(string agentNumber, int equipmentTypeID, string route, decimal miles)
        {
            //Determine route ratings
            RouteRatings rates = new RouteRatings();

            try {
                DriverCompDataset.RateMileageRouteTableRow ratesMR = getMileRouteRates(agentNumber, route, miles);
                if (ratesMR != null)
                {
                    rates.RateTypeID          = RouteRatings.RATETYPE_ROUTE;
                    rates.MileBaseRate        = ratesMR.BaseRate;
                    rates.MileRate            = ratesMR.Rate;
                    rates.DayRate             = 0.0M;
                    rates.TripRate            = 0.0M;
                    rates.StopRate            = 0.0M;
                    rates.CartonRate          = 0.0M;
                    rates.PalletRate          = 0.0M;
                    rates.PickupCartonRate    = 0.0M;
                    rates.MinimumAmount       = 0.0M;
                    rates.MaximumAmount       = 0.0M;
                    rates.MaximumTriggerField = "";
                    rates.MaximumTriggerValue = 0;
                    rates.FSBase = 0.0M;
                }
                DriverCompDataset.RateUnitRouteTableRow ratesUR = getUnitRouteRates(agentNumber, route);
                if (ratesUR != null)
                {
                    rates.RateTypeID          = RouteRatings.RATETYPE_ROUTE;
                    rates.DayRate             = ratesUR.DayRate;
                    rates.TripRate            = ratesUR.MultiTripRate;
                    rates.StopRate            = ratesUR.StopRate;
                    rates.CartonRate          = ratesUR.CartonRate;
                    rates.PalletRate          = ratesUR.PalletRate;
                    rates.PickupCartonRate    = ratesUR.PickupCartonRate;
                    rates.MinimumAmount       = ratesUR.MinimumAmount;
                    rates.MaximumAmount       = ratesUR.MaximumAmount;
                    rates.MaximumTriggerField = ratesUR.MaximumTriggerField;
                    rates.MaximumTriggerValue = ratesUR.MaximumTriggerValue;
                    rates.FSBase = ratesUR.FSBase;
                }
                if (rates.RateTypeID == RouteRatings.RATETYPE_NONE)
                {
                    rates.RateTypeID = RouteRatings.RATETYPE_VEHICLE;
                    DriverCompDataset.RateMileageTableRow ratesMV = getMileRates(agentNumber, equipmentTypeID, miles);
                    if (ratesMV != null)
                    {
                        rates.MileBaseRate        = ratesMV.BaseRate;
                        rates.MileRate            = ratesMV.Rate;
                        rates.DayRate             = 0.0M;
                        rates.TripRate            = 0.0M;
                        rates.StopRate            = 0.0M;
                        rates.CartonRate          = 0.0M;
                        rates.PalletRate          = 0.0M;
                        rates.PickupCartonRate    = 0.0M;
                        rates.MinimumAmount       = 0.0M;
                        rates.MaximumAmount       = 0.0M;
                        rates.MaximumTriggerField = "";
                        rates.MaximumTriggerValue = 0;
                        rates.FSBase = 0.0M;
                    }
                    DriverCompDataset.RateUnitTableRow ratesUV = getUnitRates(agentNumber, equipmentTypeID);
                    if (ratesUV != null)
                    {
                        rates.DayRate             = ratesUV.DayRate;
                        rates.TripRate            = ratesUV.MultiTripRate;
                        rates.StopRate            = ratesUV.StopRate;
                        rates.CartonRate          = ratesUV.CartonRate;
                        rates.PalletRate          = ratesUV.PalletRate;
                        rates.PickupCartonRate    = ratesUV.PickupCartonRate;
                        rates.MinimumAmount       = ratesUV.MinimumAmount;
                        rates.MaximumAmount       = ratesUV.MaximumAmount;
                        rates.MaximumTriggerField = ratesUV.MaximumTriggerField;
                        rates.MaximumTriggerValue = ratesUV.MaximumTriggerValue;
                        rates.FSBase = ratesUV.FSBase;
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error creating new DriverRates instance.", ex); }
            return(rates);
        }