Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }