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 ScanAudits GetScanAudits(DateTime routeDate, string routeClass, string driverName)
        {
            //
            ScanAudits scans = null;

            try {
                scans = new ScanAudits();
                ScanAudits _scans = GetScanAudits(routeDate, routeClass);
                if (driverName != "All")
                {
                    for (int i = 0; i < _scans.Count; i++)
                    {
                        if (_scans[i].Driver == driverName)
                        {
                            scans.Add(_scans[i]);
                        }
                    }
                }
                else
                {
                    scans = _scans;
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error while reading scan audits.", ex))); }
            return(scans);
        }
Exemple #3
0
 public void UpdateScanAudits(ScanAudits audits)
 {
     //
     for (int i = 0; i < audits.Count; i++)
     {
         UpdateScanAudit(audits[i]);
     }
 }
Exemple #4
0
        public static bool UpdateScanAudits(ScanAudits scans)
        {
            //
            bool ret = false;

            try {
                _Client = new RoadshowServiceClient();
                ret     = _Client.UpdateScanAudits(scans);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("UpdateScanAudits() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("UpdateScanAudits() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("UpdateScanAudits() communication error.", ce); }
            return(ret);
        }
Exemple #5
0
        public static ScanAudits GetScanAudits(DateTime routeDate, string routeClass, string driverName)
        {
            //
            ScanAudits scans = null;

            try {
                _Client = new RoadshowServiceClient();
                scans   = _Client.GetScanAuditsForDriver(routeDate, routeClass, driverName);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetScanAudits() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetScanAudits() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetScanAudits() communication error.", ce); }
            return(scans);
        }
Exemple #6
0
        public bool UpdateScanAudits(ScanAudits scans)
        {
            //
            bool ret = false;

            try {
                for (int i = 0; i < scans.Count; i++)
                {
                    UpdateScanAudit(scans[i]);
                }
                ret = true;
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error while updating scan audits.", ex))); }
            return(ret);
        }
Exemple #7
0
        public bool CanLoadScanAudit(DateTime routeDate, string routeClass)
        {
            //
            bool ret = false;

            try {
                if (DateTime.Compare(routeDate, DateTime.Today) < 0)
                {
                    ScanAudits scans = GetScanAudits(routeDate, routeClass);
                    ret = scans.Count == 0;
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error when validating scan audit data loading.", ex))); }
            return(ret);
        }
Exemple #8
0
        public ScanAudits GetScanAudits(DateTime routeDate, string routeClass)
        {
            //
            ScanAudits scans = null;

            try {
                scans = new ScanAudits();
                DataSet ds = fillDataset(USP_SCANAUDIT, TBL_SCANAUDIT, new object[] { routeDate, routeClass });
                if (ds != null)
                {
                    RoadshowDS _scans = new RoadshowDS();
                    _scans.ScanAuditTable.Merge(ds.Tables[TBL_SCANAUDIT]);
                    for (int i = 0; i < _scans.ScanAuditTable.Rows.Count; i++)
                    {
                        scans.Add(new ScanAudit(_scans.ScanAuditTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error while reading scan audits.", ex))); }
            return(scans);
        }