Example #1
0
        public static Customers GetCustomers()
        {
            //Get carriers list
            Customers customers = null;

            try {
                ObjectCache cache = MemoryCache.Default;
                customers = cache["customers"] as Customers;
                if (customers == null)
                {
                    _Client   = new RoadshowServiceClient();
                    customers = _Client.GetCustomers();
                    _Client.Close();

                    //CacheItemPolicy policy = new CacheItemPolicy();
                    //policy.ChangeMonitors.Add(new SqlChangeMonitor(new SqlDependency()));
                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(30));
                    cache.Set("customers", customers, policy);
                }
            }
            catch (FaultException fe) { throw new ApplicationException("GetCustomers() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetCustomers() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetCustomers() communication error.", ce); }
            return(customers);
        }
Example #2
0
        public static Customers GetCustomers()
        {
            //Get customers list
            Customers             customers = null;
            RoadshowServiceClient client    = new RoadshowServiceClient();

            try {
                ObjectCache cache = MemoryCache.Default;
                customers = cache["customers"] as Customers;
                if (customers == null)
                {
                    customers = client.GetCustomers();
                    client.Close();

                    //CacheItemPolicy policy = new CacheItemPolicy();
                    //policy.ChangeMonitors.Add(new SqlChangeMonitor(new SqlDependency()));
                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(_cacheTimeout));
                    cache.Set("customers", customers, policy);
                }
            }
            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(customers);
        }
Example #3
0
 public static void LoadScanAudit(DateTime routeDate, string routeClass)
 {
     //Load scan audit data
     try {
         _Client = new RoadshowServiceClient();
         _Client.LoadScanAudit(routeDate, routeClass);
         _Client.Close();
     }
     catch (FaultException fe) { throw new ApplicationException("LoadScanAudit() service error.", fe); }
     catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("LoadScanAudit() timeout error.", te); }
     catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("LoadScanAudit() communication error.", ce); }
 }
Example #4
0
 public static void WriteLogEntry(TraceMessage m)
 {
     //Get the operating enterprise terminal
     try {
         _Client = new RoadshowServiceClient();
         _Client.WriteLogEntry(m);
         _Client.Close();
     }
     catch (FaultException fe) { throw new ApplicationException("WriteLogEntry() service error.", fe); }
     catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("WriteLogEntry() timeout error.", te); }
     catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("WriteLogEntry() communication error.", ce); }
 }
Example #5
0
        public static bool CanLoadScanAudit(DateTime routeDate, string routeClass)
        {
            bool ret = false;

            try {
                _Client = new RoadshowServiceClient();
                ret     = _Client.CanLoadScanAudit(routeDate, routeClass);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("CanLoadScanAudit() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("CanLoadScanAudit() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("CanLoadScanAudit() communication error.", ce); }
            return(ret);
        }
Example #6
0
        public static bool AddPickup(Pickup pickup)
        {
            //
            bool ret = false;

            try {
                _Client = new RoadshowServiceClient();
                ret     = _Client.AddPickup(pickup);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("AddPickup() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("AddPickup() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("AddPickup() communication error.", ce); }
            return(ret);
        }
Example #7
0
        public static Pickups GetPickups(DateTime pickupDate, string routeClass)
        {
            //
            Pickups pickups = null;

            try {
                _Client = new RoadshowServiceClient();
                pickups = _Client.GetPickups(pickupDate, routeClass);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetPickups() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetPickups() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetPickups() communication error.", ce); }
            return(pickups);
        }
Example #8
0
        public static Depots GetDepots(string terminalCode)
        {
            //
            Depots depots = null;

            try {
                _Client = new RoadshowServiceClient();
                depots  = _Client.GetDepots(terminalCode);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetDepots() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetDepots() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetDepots() communication error.", ce); }
            return(depots);
        }
Example #9
0
        public static TerminalInfo GetTerminalInfo()
        {
            //Get the operating enterprise terminal
            TerminalInfo terminal = null;

            try {
                _Client  = new RoadshowServiceClient();
                terminal = _Client.GetTerminalInfo();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetTerminalInfo() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetTerminalInfo() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetTerminalInfo() communication error.", ce); }
            return(terminal);
        }
Example #10
0
        public static Drivers GetScanAuditDrivers(DateTime routeDate, string routeClass)
        {
            //
            Drivers drivers = null;

            try {
                _Client = new RoadshowServiceClient();
                drivers = _Client.GetScanAuditDrivers(routeDate, routeClass);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetScanAuditDrivers() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetScanAuditDrivers() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetScanAuditDrivers() communication error.", ce); }
            return(drivers);
        }
Example #11
0
        public static OnTimeIssues GetOnTimeIssues()
        {
            //
            OnTimeIssues issues = null;

            try {
                _Client = new RoadshowServiceClient();
                issues  = _Client.GetOnTimeIssues();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetOnTimeIssues() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetOnTimeIssues() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetOnTimeIssues() communication error.", ce); }
            return(issues);
        }
Example #12
0
        public static UpdateUsers GetUpdateUsers(string routeClass)
        {
            //
            UpdateUsers users = null;

            try {
                _Client = new RoadshowServiceClient();
                users   = _Client.GetUpdateUsers(routeClass);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetUpdateUsers() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetUpdateUsers() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetUpdateUsers() communication error.", ce); }
            return(users);
        }
Example #13
0
        public static Customers GetCustomers()
        {
            //
            Customers customers = null;

            try {
                _Client   = new RoadshowServiceClient();
                customers = _Client.GetCustomers();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetCustomers() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetCustomers() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetCustomers() communication error.", ce); }
            return(customers);
        }
Example #14
0
        public static bool UpdateScanAudit(ScanAudit scan)
        {
            //
            bool ret = false;

            try {
                _Client = new RoadshowServiceClient();
                ret     = _Client.UpdateScanAudit(scan);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("UpdateScanAudit() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("UpdateScanAudit() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("UpdateScanAudit() communication error.", ce); }
            return(ret);
        }
Example #15
0
        public static UserConfiguration GetUserConfiguration(string application, string[] usernames)
        {
            //Get the operating enterprise terminal
            UserConfiguration config = null;

            try {
                _Client = new RoadshowServiceClient();
                System.ComponentModel.BindingList <string> names = new System.ComponentModel.BindingList <string>(usernames);
                config = _Client.GetUserConfiguration(application, names);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetUserConfiguration() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetUserConfiguration() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetUserConfiguration() communication error.", ce); }
            return(config);
        }
Example #16
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);
        }
Example #17
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);
        }
Example #18
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);
        }
Example #19
0
        public static Depots GetDepots()
        {
            //Get depots list
            Depots depots = null;
            RoadshowServiceClient client = new RoadshowServiceClient();

            try {
                ObjectCache cache = MemoryCache.Default;
                depots = cache["depots"] as Depots;
                if (depots == null)
                {
                    depots = client.GetDepots();
                    client.Close();

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(_cacheTimeout));
                    cache.Set("depots", depots, policy);
                }
            }
            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(depots);
        }