Exemple #1
0
        public TerminalDataset GetTerminals(int terminalID)
        {
            //Returns a list of terminals
            TerminalDataset        terminals = new TerminalDataset();
            TLViewerService2Client client    = new TLViewerService2Client();

            try {
                DataSet ds = client.GetTerminals2();
                if (ds != null)
                {
                    TerminalDataset ts = new TerminalDataset();
                    ts.Merge(ds);
                    for (int i = 0; i < ts.TerminalTable.Rows.Count; i++)
                    {
                        TerminalDataset.TerminalTableRow t = ts.TerminalTable[i];
                        if (terminalID == 0 || t.TerminalID == terminalID)
                        {
                            terminals.TerminalTable.LoadDataRow(t.ItemArray, true);
                        }
                    }
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TLViewerFault> tle) { client.Abort(); throw new ApplicationException(tle.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(terminals);
        }
Exemple #2
0
        public static FreightDataset GetTerminals()
        {
            //Returns a list of terminals
            FreightDataset         terminals = new FreightDataset();
            TLViewerService2Client client    = new TLViewerService2Client();

            try {
                DataSet ds = client.GetTerminals2();
                if (ds != null && ds.Tables["TerminalTable"] != null && ds.Tables["TerminalTable"].Rows.Count > 0)
                {
                    if (Program.TerminalCode.Length > 0)
                    {
                        terminals.Merge(ds.Tables["TerminalTable"].Select("TerminalID=" + Program.TerminalCode));
                    }
                    else
                    {
                        terminals.Merge(ds);
                    }
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message, te); }
            catch (FaultException <TLViewerFault> tle) { client.Abort(); throw new ApplicationException(tle.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message, fe); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message, ce); }
            return(terminals);
        }
Exemple #3
0
        //Interface
        public FreightGateway()
        {
            TLViewerService2Client client = new TLViewerService2Client();

            _state   = true;
            _address = client.Endpoint.Address.Uri.AbsoluteUri;
        }
Exemple #4
0
        public DataView GetAgentSummary(int terminalID, string sortBy)
        {
            //Get an agent summary view for the specified terminal
            TLDataset tls  = new TLDataset();
            DataView  view = tls.TLTable.DefaultView;
            TLViewerService2Client client = new TLViewerService2Client();

            try {
                DataSet ds = client.GetAgentSummary2(terminalID);
                if (ds != null)
                {
                    tls.Merge(ds);
                    if (sortBy.Trim().Length == 0)
                    {
                        sortBy = "AgentNumber";
                    }
                    view.Sort = sortBy;
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TLViewerFault> tle) { client.Abort(); throw new ApplicationException(tle.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(view);
        }
Exemple #5
0
        public DataView GetTLView(int terminalID, string sortBy)
        {
            //Get a view of TLs for the specified terminal
            TLDataset tls  = new TLDataset();
            DataView  view = tls.TLTable.DefaultView;
            TLViewerService2Client client = new TLViewerService2Client();

            try {
                if (terminalID > 0)
                {
                    DataSet ds = client.GetTLView2(terminalID);
                    if (ds != null)
                    {
                        tls.Merge(ds);
                        for (int i = 0; i < tls.TLTable.Rows.Count; i++)
                        {
                            tls.TLTable[i].TerminalID = terminalID;
                        }
                        if (sortBy.Trim().Length == 0)
                        {
                            sortBy = "TLNumber";
                        }
                        view.Sort = sortBy;
                    }
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <TLViewerFault> tle) { client.Abort(); throw new ApplicationException(tle.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(view);
        }
Exemple #6
0
        public static FreightDataset GetAgentSummary(int terminalID)
        {
            //Get an agent summary view for the specified terminal
            FreightDataset         tls    = new FreightDataset();
            TLViewerService2Client client = new TLViewerService2Client();

            try {
                DataSet ds = client.GetAgentSummary2(terminalID);
                if (ds != null && ds.Tables["TLTable"] != null && ds.Tables["TLTable"].Rows.Count > 0)
                {
                    tls.Merge(ds);
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message, te); }
            catch (FaultException <TLViewerFault> tle) { client.Abort(); throw new ApplicationException(tle.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message, fe); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message, ce); }
            return(tls);
        }
Exemple #7
0
        public static FreightDataset GetTLView(int terminalID)
        {
            //Get a view of TLs for the opertaing terminal
            FreightDataset         tls    = new FreightDataset();
            TLViewerService2Client client = new TLViewerService2Client();

            try {
                DataSet ds = client.GetTLView2(terminalID);
                if (ds != null && ds.Tables["TLTable"] != null && ds.Tables["TLTable"].Rows.Count > 0)
                {
                    tls.Merge(ds);
                    for (int i = 0; i < tls.TLTable.Rows.Count; i++)
                    {
                        tls.TLTable[i].TerminalID = terminalID;
                    }
                }
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message, te); }
            catch (FaultException <TLViewerFault> tle) { client.Abort(); throw new ApplicationException(tle.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message, fe); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message, ce); }
            return(tls);
        }