Esempio n. 1
0
        public bool CreateDriverRoute(DriverRoute route)
        {
            bool result = false;

            try {
                //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work
                using (TransactionScope scope = new TransactionScope()) {
                    //
                    result = new DriverCompGateway().CreateDriverRoute(route);

                    //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <DriverCompensationFault>(new DriverCompensationFault(ex.Message), "Service Error"); }
            return(result);
        }
Esempio n. 2
0
        public bool UpdateDriverRoute(DriverRoute route)
        {
            //Update a driver route
            bool result = false;

            try {
                //Update the specified route
                result = new DataService().ExecuteNonQuery(SQL_CONNID, USP_ROUTEUPDATE, new object[] {
                    route.RouteDate, route.RouteName, route.AgentNumber, route.Operator,
                    route.AdjustmentAmount1, route.AdjustmentAmount1TypeID, route.AdjustmentAmount2, route.AdjustmentAmount2TypeID, 0.0, 0,
                    route.AdminCharge, route.TotalAmount,
                    (route.Exported != DateTime.MinValue ? route.Exported : null as object),
                    route.LastUpdated, route.UserID
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(result);
        }
Esempio n. 3
0
        public bool CreateDriverRoute(DriverRoute route)
        {
            bool result = false;

            try {
                //Save driver route
                DateTime imported = DateTime.Now;
                result = new DataService().ExecuteNonQuery(SQL_CONNID, USP_ROUTECREATE, new object[] {
                    route.RouteDate, route.RouteIndex, route.RouteName, route.AgentNumber,
                    route.Operator, route.Payee, route.FinanceVendorID, route.EquipmentTypeID,
                    route.Miles, route.Trip, route.Stops, route.Cartons, route.Pallets, route.PickupCartons, route.RateTypeID,
                    route.DayRate, route.DayAmount, route.MilesRate, route.MilesBaseRate, route.MilesAmount,
                    route.TripRate, route.TripAmount, route.StopsRate, route.StopsAmount, route.CartonsRate, route.CartonsAmount,
                    route.PalletsRate, route.PalletsAmount, route.PickupCartonsRate, route.PickupCartonsAmount,
                    route.FSCMiles, route.FuelCost, route.FSCGal, route.FSCBaseRate, route.FSC,
                    route.MinimunAmount, route.AdjustmentAmount1, route.AdjustmentAmount1TypeID, route.AdjustmentAmount2, route.AdjustmentAmount2TypeID, 0.0M, 0,
                    route.AdminCharge, route.TotalAmount, imported, null,
                    route.LastUpdated, route.UserID, route.ArgixRtType
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(result);
        }
Esempio n. 4
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);
        }