Beispiel #1
0
        public static bool UpdateDriverRoute(DriverCompDataset.DriverRouteTableRow route)
        {
            //
            bool updated = false;
            DriverCompServiceClient client = null;

            try {
                DriverRoute dr = new DriverRoute();
                dr.ID                      = route.ID;
                dr.IsNew                   = !route.IsIsNewNull() ? route.IsNew : false;
                dr.IsCombo                 = !route.IsIsComboNull() ? route.IsCombo : false;
                dr.IsAdjust                = !route.IsIsAdjustNull() ? route.IsAdjust : false;
                dr.AgentNumber             = !route.IsAgentNumberNull() ? route.AgentNumber : "";
                dr.FinanceVendorID         = !route.IsFinanceVendorIDNull() ? route.FinanceVendorID : "";
                dr.RouteDate               = !route.IsRouteDateNull() ? route.RouteDate : DateTime.MinValue;
                dr.RouteName               = !route.IsRouteNameNull() ? route.RouteName : "";
                dr.Operator                = !route.IsOperatorNull() ? route.Operator : "";
                dr.Payee                   = !route.IsPayeeNull() ? route.Payee : "";
                dr.EquipmentTypeID         = !route.IsEquipmentTypeIDNull() ? route.EquipmentTypeID : 0;
                dr.RateTypeID              = !route.IsRateTypeIDNull() ? route.RateTypeID : 0;
                dr.DayRate                 = !route.IsDayRateNull() ? route.DayRate : 0.0M;
                dr.DayAmount               = !route.IsDayAmountNull() ? route.DayAmount : 0.0M;
                dr.Miles                   = !route.IsMilesNull() ? route.Miles : 0.0M;
                dr.MilesBaseRate           = !route.IsMilesBaseRateNull() ? route.MilesBaseRate : 0.0M;
                dr.MilesRate               = !route.IsMilesRateNull() ? route.MilesRate : 0.0M;
                dr.MilesAmount             = !route.IsMilesAmountNull() ? route.MilesAmount : 0.0M;
                dr.Trip                    = !route.IsTripNull() ? route.Trip : 0;
                dr.TripRate                = !route.IsTripRateNull() ? route.TripRate : 0.0M;
                dr.TripAmount              = !route.IsTripAmountNull() ? route.TripAmount : 0.0M;
                dr.Stops                   = !route.IsStopsNull() ? route.Stops : 0;
                dr.StopsRate               = !route.IsStopsRateNull() ? route.StopsRate : 0.0M;
                dr.StopsAmount             = !route.IsStopsAmountNull() ? route.StopsAmount : 0.0M;
                dr.Cartons                 = !route.IsCartonsNull() ? route.Cartons : 0;
                dr.CartonsRate             = !route.IsCartonsRateNull() ? route.CartonsRate : 0.0M;
                dr.CartonsAmount           = !route.IsCartonsAmountNull() ? route.CartonsAmount : 0.0M;
                dr.Pallets                 = !route.IsPalletsNull() ? route.Pallets : 0;
                dr.PalletsRate             = !route.IsPalletsRateNull() ? route.PalletsRate : 0.0M;
                dr.PalletsAmount           = !route.IsPalletsAmountNull() ? route.PalletsAmount : 0.0M;
                dr.PickupCartons           = !route.IsPickupCartonsNull() ? route.PickupCartons : 0;
                dr.PickupCartonsRate       = !route.IsPickupCartonsRateNull() ? route.PickupCartonsRate : 0.0M;
                dr.PickupCartonsAmount     = !route.IsPickupCartonsAmountNull() ? route.PickupCartonsAmount : 0.0M;
                dr.MinimunAmount           = !route.IsMinimunAmountNull() ? route.MinimunAmount : 0.0M;
                dr.FSCMiles                = !route.IsFSCMilesNull() ? route.FSCMiles : 0.0M;
                dr.FuelCost                = !route.IsFuelCostNull() ? route.FuelCost : 0.0M;
                dr.FSCGal                  = !route.IsFSCGalNull() ? route.FSCGal : 0.0M;
                dr.FSCBaseRate             = !route.IsFSCBaseRateNull() ? route.FSCBaseRate : 0.0M;
                dr.FSC                     = !route.IsFSCNull() ? route.FSC : 0.0M;
                dr.AdjustmentAmount1       = !route.IsAdjustmentAmount1Null() ? route.AdjustmentAmount1 : 0.0M;
                dr.AdjustmentAmount1TypeID = !route.IsAdjustmentAmount1TypeIDNull() ? route.AdjustmentAmount1TypeID : "";
                dr.AdjustmentAmount2       = !route.IsAdjustmentAmount2Null() ? route.AdjustmentAmount2 : 0.0M;
                dr.AdjustmentAmount2TypeID = !route.IsAdjustmentAmount2TypeIDNull() ? route.AdjustmentAmount2TypeID : "";
                dr.AdminCharge             = !route.IsAdminChargeNull() ? route.AdminCharge : 0.0M;
                dr.TotalAmount             = !route.IsTotalAmountNull() ? route.TotalAmount : 0.0M;
                dr.Imported                = !route.IsImportedNull() ? route.Imported : DateTime.MinValue;
                dr.Exported                = !route.IsExportedNull() ? route.Exported : DateTime.MinValue;
                dr.ArgixRtType             = !route.IsArgixRtTypeNull() ? route.ArgixRtType : "";
                dr.LastUpdated             = DateTime.Now;
                dr.UserID                  = Environment.UserName;

                client  = new DriverCompServiceClient();
                updated = client.UpdateDriverRoute(dr);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <DriverCompensationFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }