コード例 #1
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);
        }
コード例 #2
0
ファイル: RoadshowGateway.cs プロジェクト: jpheary/Argix10
        public static Depots GetDepots()
        {
            //Get depots list
            Depots depots = null;

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

                    DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(1));
                    cache.Set("depots", depots, policy);
                }
            }
            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);
        }
コード例 #3
0
ファイル: TerminalGateway.cs プロジェクト: jpheary/Argix10
        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);
        }