Exemple #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);
        }
Exemple #2
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);
        }
Exemple #3
0
        private string getRoutingClass(string terminalNumber)
        {
            //Change terminalNumber to routing class
            string _class = " ";
            Depots depots = TerminalGateway.GetDepots();

            foreach (Depot depot in depots)
            {
                if (depot.Number == int.Parse(terminalNumber))
                {
                    _class = depot.Class; break;
                }
            }
            return(_class);
        }
Exemple #4
0
        public Depots GetDepots()
        {
            //
            Depots depots = new Depots();

            try {
                DataSet ds = new RoadshowGateway().GetDispatchDepots();
                if (ds != null)
                {
                    RoadshowDataset _depots = new RoadshowDataset();
                    _depots.Merge(ds);
                    for (int i = 0; i < _depots.DepotTable.Rows.Count; i++)
                    {
                        depots.Add(new Depot(_depots.DepotTable[i]));
                    }
                }
            }
            catch (ApplicationException aex) { throw new FaultException <RoadshowFault>(new RoadshowFault(aex.Message), "Gateway Error"); }
            catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(ex.Message), "Unexpected Error"); }
            return(depots);
        }
Exemple #5
0
        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);
        }
Exemple #6
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);
        }