Beispiel #1
0
        public Depots GetDepots(string terminalCode)
        {
            //Return a list of all Roadshow depots (terminalCode='') or just the depot for terminalCode
            Depots depots = null;

            try {
                depots = new Depots();
                DataSet ds = fillDataset(USP_DEPOTS, TBL_DEPOTS, new object[] { });
                if (ds != null)
                {
                    RoadshowDS _depots = new RoadshowDS();
                    _depots.DepotTable.Merge(ds.Tables[TBL_DEPOTS]);
                    for (int i = 0; i < _depots.DepotTable.Rows.Count; i++)
                    {
                        string orderClass = _depots.DepotTable[i].RS_OrderClass;
                        if (terminalCode.Length == 0 || orderClass == terminalCode)
                        {
                            depots.Add(new Depot(_depots.DepotTable[i]));
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading depots.", ex); }
            return(depots);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public OnTimeIssues GetOnTimeIssues()
        {
            //
            OnTimeIssues issues = null;

            try {
                issues = new OnTimeIssues();
                DataSet ds = fillDataset(USP_ONTIMEISSUES, TBL_ONTIMEISSUES, new object[] { });
                if (ds != null)
                {
                    RoadshowDS _issues = new RoadshowDS();
                    _issues.OnTimeIssueTable.Merge(ds.Tables[TBL_ONTIMEISSUES]);
                    for (int i = 0; i < _issues.OnTimeIssueTable.Rows.Count; i++)
                    {
                        issues.Add(new OnTimeIssue(_issues.OnTimeIssueTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading on time issues.", ex); }
            return(issues);
        }
Beispiel #4
0
        public UpdateUsers GetUpdateUsers(string routeClass)
        {
            //
            UpdateUsers users = null;

            try {
                users = new UpdateUsers();
                DataSet ds = fillDataset(USP_UPDATEDBY, TBL_UPDATEDBY, new object[] { routeClass });
                if (ds != null)
                {
                    RoadshowDS _users = new RoadshowDS();
                    _users.UpdatedByTable.Merge(ds.Tables[TBL_UPDATEDBY]);
                    for (int i = 0; i < _users.UpdatedByTable.Rows.Count; i++)
                    {
                        users.Add(new UpdateUser(_users.UpdatedByTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading update users.", ex); }
            return(users);
        }
Beispiel #5
0
        public CommodityClasses GetCommodityClasses()
        {
            //
            CommodityClasses classes = null;

            try {
                classes = new CommodityClasses();
                DataSet ds = fillDataset(USP_COMMODITYCLASSES, TBL_COMMODITYCLASSES, new object[] { });
                if (ds != null)
                {
                    RoadshowDS _classes = new RoadshowDS();
                    _classes.CommodityClassTable.Merge(ds.Tables[TBL_COMMODITYCLASSES]);
                    for (int i = 0; i < _classes.CommodityClassTable.Rows.Count; i++)
                    {
                        classes.Add(new CommodityClass(_classes.CommodityClassTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading commodity classes.", ex); }
            return(classes);
        }
Beispiel #6
0
        public OrderTypes GetOrderTypes()
        {
            //
            OrderTypes types = null;

            try {
                types = new OrderTypes();
                DataSet ds = fillDataset(USP_ORDERTYPES, TBL_ORDERTYPES, new object[] { });
                if (ds != null)
                {
                    RoadshowDS _types = new RoadshowDS();
                    _types.OrderTypeTable.Merge(ds.Tables[TBL_ORDERTYPES]);
                    for (int i = 0; i < _types.OrderTypeTable.Rows.Count; i++)
                    {
                        types.Add(new OrderType(_types.OrderTypeTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading order types.", ex); }
            return(types);
        }
Beispiel #7
0
        public Customers GetCustomers()
        {
            //
            Customers customers = null;

            try {
                customers = new Customers();
                DataSet ds = fillDataset(USP_CUSTOMERS, TBL_CUSTOMERS, new object[] { });
                if (ds != null)
                {
                    RoadshowDS _customers = new RoadshowDS();
                    _customers.CustomerTable.Merge(ds.Tables[TBL_CUSTOMERS]);
                    for (int i = 0; i < _customers.CustomerTable.Rows.Count; i++)
                    {
                        customers.Add(new Customer(_customers.CustomerTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while reading customers.", ex); }
            return(customers);
        }
Beispiel #8
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);
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public Pickups GetPickups(DateTime pickupDate, string routeClass)
        {
            //
            Pickups pickups = null;

            try {
                pickups = new Pickups();
                DataSet ds = fillDataset(USP_PICKUPS, TBL_PICKUPS, new object[] { pickupDate, routeClass });
                if (ds != null)
                {
                    RoadshowDS _pickups = new RoadshowDS();
                    _pickups.PickupTable.Merge(ds.Tables[TBL_PICKUPS]);
                    for (int i = 0; i < _pickups.PickupTable.Rows.Count; i++)
                    {
                        pickups.Add(new Pickup(_pickups.PickupTable[i]));
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(new ApplicationException("Unexpected error while reading pickups.", ex))); }
            return(pickups);
        }
Beispiel #11
0
        public static RoadshowDS GetCustomers()
        {
            //Get roadshow customers
            RoadshowDS customers = null;

            try {
                customers = new RoadshowDS();

                _Client = new RoadshowServiceClient();
                DataSet ds = _Client.GetCustomers();
                _Client.Close();

                if (ds != null)
                {
                    customers.Merge(ds);
                }
            }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException fe) { _Client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException(ce.Message); }
            return(customers);
        }