コード例 #1
0
ファイル: FreightService.cs プロジェクト: jpheary/Argix08
        public Terminals GetTerminals()
        {
            //Get Argix terminals
            Terminals terminals = null;

            try {
                terminals = new Terminals();
                DataSet ds = new DataService().FillDataset(SQL_CONNID, USP_TERMINALS, TBL_TERMINALS, new object[] { });
                if (ds != null && ds.Tables[TBL_TERMINALS].Rows.Count > 0)
                {
                    EnterpriseDS _ds = new EnterpriseDS();
                    _ds.Merge(ds);
                    for (int i = 0; i < _ds.TerminalTable.Rows.Count; i++)
                    {
                        Terminal t = new Terminal();
                        t.TerminalID  = Convert.ToInt32(ds.Tables[TBL_TERMINALS].Rows[i]["TerminalID"]);
                        t.Number      = ds.Tables[TBL_TERMINALS].Rows[i]["Number"].ToString().Trim();
                        t.Description = ds.Tables[TBL_TERMINALS].Rows[i]["Description"].ToString().Trim();
                        t.AgentID     = ds.Tables[TBL_TERMINALS].Rows[i]["AgentID"].ToString().Trim();
                        terminals.Add(t);
                    }
                }
            }
            catch (Exception ex) { throw new FaultException <EnterpriseFault>(new EnterpriseFault(new ApplicationException("Unexpected error while reading Argix terminals.", ex))); }
            return(terminals);
        }
コード例 #2
0
ファイル: FreightProxy.cs プロジェクト: jpheary/Argix08
        public Terminals GetTerminals(int terminalID)
        {
            //Returns a list of terminals
            Terminals             terminals = null;
            TLViewerServiceClient _Client   = null;

            try {
                terminals = new Terminals();
                _Client   = new TLViewerServiceClient();
                Terminals ts = _Client.GetTerminals();
                for (int i = 0; i < ts.Count; i++)
                {
                    Terminal t = ts[i];
                    if (terminalID == 0 || t.TerminalID == terminalID)
                    {
                        terminals.Add(t);
                    }
                }
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetTerminals() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetTerminals() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetTerminals() communication error.", ce); }
            return(terminals);
        }
コード例 #3
0
        public Terminals GetTerminals()
        {
            //Get a list of Argix terminals
            Terminals            terminals = null;
            FreightServiceClient _Client   = null;

            try {
                _Client   = new FreightServiceClient();
                terminals = _Client.GetTerminals();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetTerminals() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetTerminals() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetTerminals() communication error.", ce); }
            return(terminals);
        }