public static bool CanLoadScanAudit(DateTime routeDate, string routeClass) { bool ret = false; if (DateTime.Compare(routeDate, DateTime.Today) < 0) { ScanAuditDS scans = GetScanAudit(routeDate, routeClass); ret = scans.ScanAuditTable.Rows.Count == 0; } return(ret); }
public static ScanAuditDS GetScanAudit(DateTime routeDate, string routeClass) { // ScanAuditDS scans = null; try { scans = new ScanAuditDS(); DataSet ds = App.Mediator.FillDataset(USP_SCANAUDIT, TBL_SCANAUDIT, new object[] { routeDate, routeClass }); if (ds != null) { scans.Merge(ds); } } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading scan audit.", ex); } return(scans); }
public static bool UpdateScanAudit(ScanAuditDS scans) { // bool ret = false; if (scans.HasChanges()) { ScanAuditDS _scans = (ScanAuditDS)scans.GetChanges(DataRowState.Modified); for (int i = 0; i < _scans.ScanAuditTable.Rows.Count; i++) { ScanAuditDS.ScanAuditTableRow scan = _scans.ScanAuditTable[i]; bool changed = UpdateScanAudit(scan); } scans.AcceptChanges(); } ret = true; return(ret); }
public static ScanAuditDS GetScanAudit(DateTime routeDate, string routeClass, string driverName) { // ScanAuditDS scans = null; try { scans = new ScanAuditDS(); ScanAuditDS _scans = GetScanAudit(routeDate, routeClass); if (driverName != "All") { scans.Merge(_scans.ScanAuditTable.Select("Driver ='" + driverName + "'")); } else { scans.Merge(_scans); } } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading scan audit.", ex); } return(scans); }
public static DriverDS GetScanAuditDrivers(DateTime routeDate, string routeClass) { // DriverDS drivers = null; try { drivers = new DriverDS(); ScanAuditDS _scans = GetScanAudit(routeDate, routeClass); for (int i = 0; i < _scans.ScanAuditTable.Rows.Count; i++) { string driver = _scans.ScanAuditTable[i].Driver; if (drivers.DriverTable.Select("NAME='" + driver + "'").Length == 0) { drivers.DriverTable.AddDriverTableRow(driver, "", 0); } } drivers.AcceptChanges(); } catch (Exception ex) { throw new ApplicationException("Unexpected error while reading drivers.", ex); } return(drivers); }