示例#1
0
        public static DriverCompDataset ReadDriverRoutes(string agentNumber, DateTime startDate, DateTime endDate)
        {
            //
            DriverCompDataset       routes = new DriverCompDataset();
            DriverCompServiceClient client = null;

            try {
                client = new DriverCompServiceClient();
                DataSet ds = client.ReadDriverRoutes(agentNumber, startDate, endDate);
                if (ds.Tables["DriverRouteTable"] != null && ds.Tables["DriverRouteTable"].Rows.Count > 0)
                {
                    routes.Merge(ds);
                    for (int i = 0; i < routes.DriverRouteTable.Rows.Count; i++)
                    {
                        //Set local fields (i.e. not persisted)
                        DriverCompDataset.DriverRouteTableRow route = (DriverCompDataset.DriverRouteTableRow)routes.DriverRouteTable.Rows[i];
                        route.IsNew    = false;
                        route.IsCombo  = (routes.DriverRouteTable.Select("Operator='" + route.Operator + "' AND RouteDate='" + route.RouteDate + "'").Length > 1);
                        route.IsAdjust = route.RouteName.Contains("ADJUST");
                    }
                    routes.AcceptChanges();
                }
                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(routes);
        }
示例#2
0
        public static DriverCompDataset GetRateTypes()
        {
            //
            DriverCompDataset       types  = null;
            DriverCompServiceClient client = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                types = cache["rateTypes"] as DriverCompDataset;
                if (types == null)
                {
                    types  = new DriverCompDataset();
                    client = new DriverCompServiceClient();
                    DataSet ds = client.GetRateTypes();
                    client.Close();
                    if (ds.Tables["RateTypeTable"] != null && ds.Tables["RateTypeTable"].Rows.Count > 0)
                    {
                        types.Merge(ds);
                    }

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(_cacheTimeout));
                    cache.Set("rateTypes", types, policy);
                }
            }
            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(types);
        }
示例#3
0
        public static bool CreateDriverEquipment(string financeVendorID, string operatorName, int equipmentID)
        {
            //
            bool created = false;
            DriverCompServiceClient client = null;

            try {
                //Validate
                DriverCompDataset equipment = ReadDriverEquipment();
                DataRow[]         rows      = equipment.DriverEquipmentTable.Select("FinanceVendorID='" + financeVendorID + "' AND OperatorName='" + operatorName + "'");
                if (rows.Length > 0)
                {
                    throw new ApplicationException("Equipment already specified for " + operatorName + ".");
                }

                //Save driver equipment
                client  = new DriverCompServiceClient();
                created = client.CreateDriverEquipment(financeVendorID, operatorName, equipmentID);
                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(created);
        }
示例#4
0
        //Interface
        static FinanceGateway()
        {
            //
            DriverCompServiceClient client = new DriverCompServiceClient();

            _state        = true;
            _address      = client.Endpoint.Address.Uri.AbsoluteUri;
            _cacheTimeout = global::Argix.Properties.Settings.Default.CacheTimeout;
        }
示例#5
0
        public static void WriteLogEntry(TraceMessage m)
        {
            //Get the operating enterprise terminal
            DriverCompServiceClient client = null;

            try {
                client = new DriverCompServiceClient();
                client.WriteLogEntry(m);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> 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); }
        }
示例#6
0
        public static bool CreateVehicleMileageRate(string agentNumber, int equipmentID, DateTime effectiveDate, double mile, decimal baseRate, decimal rate)
        {
            //
            bool created = false;
            DriverCompServiceClient client = null;

            try {
                client  = new DriverCompServiceClient();
                created = client.CreateVehicleMileageRate(agentNumber, equipmentID, effectiveDate, mile, baseRate, rate);
                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(created);
        }
示例#7
0
        public static ServiceInfo GetServiceInfo()
        {
            //Get the operating enterprise terminal
            ServiceInfo             terminal = null;
            DriverCompServiceClient client   = null;

            try {
                client   = new DriverCompServiceClient();
                terminal = client.GetServiceInfo();
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> 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(terminal);
        }
示例#8
0
        public static bool UpdateDriverEquipment(string financeVendorID, string operatorName, int equipmentID)
        {
            //
            bool updated = false;
            DriverCompServiceClient client = null;

            try {
                client  = new DriverCompServiceClient();
                updated = client.UpdateDriverEquipment(financeVendorID, operatorName, equipmentID);
                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);
        }
示例#9
0
        public static TerminalConfiguration GetTerminalConfiguration(string agentNumber)
        {
            //Return a single terminal configuration
            TerminalConfiguration   configuration = null;
            DriverCompServiceClient client        = null;

            try {
                client        = new DriverCompServiceClient();
                configuration = client.GetTerminalConfiguration(agentNumber);
                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(configuration);
        }
示例#10
0
        public static bool DeleteDriverRoute(long routeID)
        {
            //
            bool deleted = false;
            DriverCompServiceClient client = null;

            try {
                client  = new DriverCompServiceClient();
                deleted = client.DeleteDriverRoute(routeID);
                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(deleted);
        }
示例#11
0
        public static bool UpdateRouteMileageRate(int id, string route, double mile, decimal baseRate, decimal rate, int status)
        {
            //
            bool updated = false;
            DriverCompServiceClient client = null;

            try {
                client  = new DriverCompServiceClient();
                updated = client.UpdateRouteMileageRate(id, route, mile, baseRate, rate, status);
                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);
        }
示例#12
0
        public static bool CreateVehicleUnitRate(string agentNumber, int equipmentID, DateTime effectiveDate, decimal dayRate, decimal tripRate, decimal stopRate, decimal cartonRate, decimal palletRate, decimal returnRate, decimal minAmount, decimal maxAmt, string maxTrigFld, int maxTrigVal, decimal fsBase)
        {
            //
            bool created = false;
            DriverCompServiceClient client = null;

            try {
                client  = new DriverCompServiceClient();
                created = client.CreateVehicleUnitRate(agentNumber, equipmentID, effectiveDate, dayRate, tripRate, stopRate, cartonRate, palletRate, returnRate, minAmount, maxAmt, maxTrigFld, maxTrigVal, fsBase);
                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(created);
        }
示例#13
0
        public static PayPeriod GetPayPeriod(DateTime effectiveDate)
        {
            //
            PayPeriod payPeriod            = new PayPeriod();
            DriverCompServiceClient client = null;

            try {
                client    = new DriverCompServiceClient();
                payPeriod = client.GetPayPeriod(effectiveDate);
                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(payPeriod);
        }
示例#14
0
        public static decimal GetFuelCost(DateTime effectiveDate, string agentNumber)
        {
            //
            decimal cost = 0.0M;
            DriverCompServiceClient client = null;

            try {
                client = new DriverCompServiceClient();
                cost   = client.GetFuelCost(effectiveDate, agentNumber);
                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(cost);
        }
示例#15
0
        public static bool UpdateRouteUnitRate(int id, string route, decimal dayRate, decimal tripRate, decimal stopRate, decimal cartonRate, decimal palletRate, decimal returnRate, decimal minAmount, decimal maxAmt, string maxTrigFld, int maxTrigVal, decimal fsBase, int status)
        {
            //
            bool updated = false;
            DriverCompServiceClient client = null;

            try {
                client  = new DriverCompServiceClient();
                updated = client.UpdateRouteUnitRate(id, route, dayRate, tripRate, stopRate, cartonRate, palletRate, returnRate, minAmount, maxAmt, maxTrigFld, maxTrigVal, fsBase, status);
                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);
        }
示例#16
0
        public static UserConfiguration GetUserConfiguration(string application, string[] usernames)
        {
            //Get the operating enterprise terminal
            UserConfiguration       config = null;
            DriverCompServiceClient client = null;

            try {
                client = new DriverCompServiceClient();
                config = client.GetUserConfiguration(application, usernames);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <ConfigurationFault> 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(config);
        }
示例#17
0
        public static DriverCompDataset ImportRoutes(string agentNumber, DateTime startDate, DateTime endDate)
        {
            //
            DriverCompDataset       routes = new DriverCompDataset();
            DriverCompServiceClient client = null;

            try {
                client = new DriverCompServiceClient();
                DataSet ds = client.ReadRoadshowRoutes(agentNumber, startDate, endDate);
                if (ds.Tables["RoadshowRouteTable"] != null && ds.Tables["RoadshowRouteTable"].Rows.Count > 0)
                {
                    routes.Merge(ds);
                }
                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(routes);
        }
示例#18
0
        public static DriverCompDataset ReadDriverEquipment()
        {
            //
            DriverCompDataset       equipment = new DriverCompDataset();
            DriverCompServiceClient client    = null;

            try {
                client = new DriverCompServiceClient();
                DataSet ds = client.ReadDriverEquipment(null, null);
                client.Close();
                if (ds.Tables["DriverEquipmentTable"] != null && ds.Tables["DriverEquipmentTable"].Rows.Count > 0)
                {
                    equipment.Merge(ds);
                }
            }
            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(equipment);
        }
示例#19
0
        public static DataSet ReadRouteUnitRates(DateTime effectiveDate, string terminalAgent, string route)
        {
            //
            DriverCompDataset       rates  = new DriverCompDataset();
            DriverCompServiceClient client = null;

            try {
                client = new DriverCompServiceClient();
                DataSet ds = client.ReadRouteUnitRates(effectiveDate, terminalAgent, route);
                client.Close();
                if (ds.Tables["RateUnitRouteTable"] != null && ds.Tables["RateUnitRouteTable"].Rows.Count > 0)
                {
                    rates.Merge(ds);
                }
            }
            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(rates);
        }
示例#20
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);
        }