Exemple #1
0
        public Drivers GetScanAuditDrivers(DateTime routeDate, string routeClass)
        {
            //
            Drivers drivers = null;

            try {
                drivers = new Drivers();
                ScanAudits _scans   = GetScanAudits(routeDate, routeClass);
                RoadshowDS _drivers = new RoadshowDS();
                for (int i = 0; i < _scans.Count; i++)
                {
                    string driver = _scans[i].Driver;
                    if (_drivers.DriverTable.Select("NAME='" + driver + "'").Length == 0)
                    {
                        _drivers.DriverTable.AddDriverTableRow(driver, "", 0);
                    }
                }
                _drivers.AcceptChanges();
                for (int j = 0; j < _drivers.DriverTable.Count; j++)
                {
                    drivers.Add(new Driver(_drivers.DriverTable[j]));
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error while reading scan audit drivers.", ex))); }
            return(drivers);
        }
Exemple #2
0
        public static Drivers GetDrivers(string routeClass)
        {
            //
            Drivers drivers = null;

            try {
                _Client = new RoadshowServiceClient();
                drivers = _Client.GetDrivers(routeClass);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetDrivers() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetDrivers() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetDrivers() communication error.", ce); }
            return(drivers);
        }
Exemple #3
0
        public static Drivers GetDrivers(int depotNumber)
        {
            //Get drivers list
            Drivers drivers = null;
            RoadshowServiceClient client = new RoadshowServiceClient();

            try {
                drivers = client.GetDrivers(depotNumber);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <RoadshowFault> rfe) { client.Abort(); throw new ApplicationException(rfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(drivers);
        }
Exemple #4
0
        public static Drivers GetDrivers(int depotNumber)
        {
            //Get drivers list
            Drivers drivers = null;

            try {
                _Client = new RoadshowServiceClient();
                drivers = _Client.GetDrivers(depotNumber);
                _Client.Close();

                Driver driver = new Driver();
                driver.Name = "All";
                drivers.Insert(0, driver);
            }
            catch (FaultException fe) { throw new ApplicationException("GetDrivers() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetDrivers() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetDrivers() communication error.", ce); }
            return(drivers);
        }
Exemple #5
0
        public Drivers GetDrivers(int depotNumber)
        {
            //
            Drivers drivers = new Drivers();

            try {
                DataSet ds = new RoadshowGateway().GetDispatchDrivers(depotNumber);
                if (ds != null)
                {
                    RoadshowDataset _drivers = new RoadshowDataset();
                    _drivers.Merge(ds);
                    for (int i = 0; i < _drivers.DriverTable.Rows.Count; i++)
                    {
                        drivers.Add(new Driver(_drivers.DriverTable[i]));
                    }
                }
            }
            catch (ApplicationException aex) { throw new FaultException <RoadshowFault>(new RoadshowFault(aex.Message), "Gateway Error"); }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(ex.Message), "Unexpected Error"); }
            return(drivers);
        }
Exemple #6
0
        public Drivers GetDrivers(string routeClass)
        {
            //
            Drivers drivers = null;

            try {
                drivers = new Drivers();
                DataSet ds = fillDataset(USP_DRIVERS, TBL_DRIVERS, new object[] { routeClass });
                if (ds != null)
                {
                    RoadshowDS _drivers = new RoadshowDS();
                    _drivers.DriverTable.Merge(ds.Tables[TBL_DRIVERS]);
                    for (int i = 0; i < _drivers.DriverTable.Rows.Count; i++)
                    {
                        drivers.Add(new Driver(_drivers.DriverTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading drivers.", ex); }
            return(drivers);
        }