Пример #1
0
        public ShipperDS GetShippers(FreightType freightType, string clientNumber, string clientTerminal)
        {
            //Get a list of shippers
            ShipperDS shippers = null;

            try {
                shippers = new ShipperDS();
                if (freightType == FreightType.Regular)
                {
                    VendorDS vendors = GetVendors(clientNumber, clientTerminal);
                    shippers = new ShipperDS();
                    for (int i = 0; i < vendors.VendorTable.Rows.Count; i++)
                    {
                        shippers.ShipperTable.AddShipperTableRow(vendors.VendorTable[i].VendorNumber, vendors.VendorTable[i].VendorName, vendors.VendorTable[i].VendorParentNumber, vendors.VendorTable[i].VendorSummary);
                    }
                    shippers.AcceptChanges();
                }
                else if (freightType == FreightType.Returns)
                {
                    AgentDS   agents    = GetAgents(false);
                    ShipperDS _shippers = new ShipperDS();
                    for (int i = 0; i < agents.AgentTable.Rows.Count; i++)
                    {
                        _shippers.ShipperTable.AddShipperTableRow(agents.AgentTable[i].AgentNumber, agents.AgentTable[i].AgentName, agents.AgentTable[i].AgentParentNumber, agents.AgentTable[i].AgentSummary);
                    }
                    shippers.Merge(_shippers.ShipperTable.Select("", "ShipperNumber ASC"));
                    shippers.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating shipper list.", ex); }
            return(shippers);
        }
Пример #2
0
        public AgentDS GetAgentsForClient(string clientNumber, string agentNumber)
        {
            //Get issue search data
            IssueMgtServiceClient client = null;
            AgentDS agents = null;

            try {
                agents = new AgentDS();
                client = new IssueMgtServiceClient();
                AgentDS _agents = client.GetAgentsForClient(clientNumber);
                if (agentNumber == null)
                {
                    agents.Merge(_agents);
                }
                else
                {
                    agents.Merge(_agents.AgentTable.Select("AgentNumber='" + agentNumber + "'"));
                }
                client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetAgentsForClient() service error.", fe); }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException("GetAgentsForClient() timeout error.", te); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException("GetAgentsForClient() communication error.", ce); }
            return(agents);
        }
Пример #3
0
        public AgentDS GetAgents(bool mainZoneOnly)
        {
            //Get a list of agents
            AgentDS agents = null;

            try {
                agents = new AgentDS();
                DataSet ds = FillDataset(USP_AGENTS, TBL_AGENTS, new object[] { });
                if (ds.Tables[TBL_AGENTS].Rows.Count != 0)
                {
                    AgentDS _ds = new AgentDS();
                    if (mainZoneOnly)
                    {
                        AgentDS __ds = new AgentDS();
                        __ds.Merge(ds);
                        _ds.Merge(__ds.AgentTable.Select("MainZone <> ''"));
                    }
                    else
                    {
                        _ds.Merge(ds);
                    }
                    for (int i = 0; i < _ds.AgentTable.Rows.Count; i++)
                    {
                        _ds.AgentTable.Rows[i]["AgentSummary"] = (!_ds.AgentTable.Rows[i].IsNull("MainZone") ? _ds.AgentTable.Rows[i]["MainZone"].ToString().PadLeft(2, ' ') : "  ") + " - " +
                                                                 (!_ds.AgentTable.Rows[i].IsNull("AgentNumber") ? _ds.AgentTable.Rows[i]["AgentNumber"].ToString() : "    ") + " - " +
                                                                 (!_ds.AgentTable.Rows[i].IsNull("AgentName") ? _ds.AgentTable.Rows[i]["AgentName"].ToString().Trim() : "");
                    }
                    agents.Merge(_ds.AgentTable.Select("", "MainZone ASC"));
                    agents.AgentTable.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating agent list.", ex); }
            return(agents);
        }
Пример #4
0
        public AgentDS GetAgents(string clientNumber)
        {
            //Get a list of agents for the specified client
            AgentDS agents = null;

            try {
                agents = new AgentDS();
                agents.AgentTable.AddAgentTableRow("All", "All", "", "", "All");
                if (clientNumber.Length > 3)
                {
                    clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3);
                }
                if (clientNumber == "000")
                {
                    clientNumber = null;
                }
                DataSet ds = fillDataset(USP_AGENTS_BYCLIENT, TBL_AGENTS, new object[] { clientNumber });
                if (ds.Tables[TBL_AGENTS].Rows.Count > 0)
                {
                    AgentDS _ds = new AgentDS();
                    _ds.Merge(ds);
                    for (int i = 0; i < _ds.AgentTable.Rows.Count; i++)
                    {
                        _ds.AgentTable.Rows[i]["AgentSummary"] = (!_ds.AgentTable.Rows[i].IsNull("MainZone") ? _ds.AgentTable.Rows[i]["MainZone"].ToString().PadLeft(2, ' ') : "  ") + " - " +
                                                                 (!_ds.AgentTable.Rows[i].IsNull("AgentNumber") ? _ds.AgentTable.Rows[i]["AgentNumber"].ToString() : "    ") + " - " +
                                                                 (!_ds.AgentTable.Rows[i].IsNull("AgentName") ? _ds.AgentTable.Rows[i]["AgentName"].ToString().Trim() : "");
                    }
                    agents.Merge(_ds.AgentTable.Select("", "MainZone ASC"));
                    agents.AgentTable.AcceptChanges();
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating agents list.", ex); }
            return(agents);
        }
Пример #5
0
 private void loadAgents()
 {
     //Load a list of agent selections
     try {
         AgentDS agentDS = new AgentDS();
         AgentDS ds      = CustomerProxy.GetAgents(this.cboCompany.SelectedValue.ToString().PadLeft(6, '0').Substring(3, 3));
         agentDS.Merge(ds);
         this.cboLocation.DisplayMember = "AgentTable.AgentSummary";
         this.cboLocation.ValueMember   = "AgentTable.AgentNumber";
         this.cboLocation.DataSource    = agentDS;
     }
     catch (Exception ex) { throw new ControlException("Unexpected error while loading company agents.", ex); }
 }
Пример #6
0
        public static AgentDS GetAgents(string clientNumber)
        {
            //Get a list of agents for the specified client
            AgentDS agents = null;

            try {
                _Client = new IssueMgtServiceClient();
                agents  = _Client.GetAgentsForClient(clientNumber);
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetAgents() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetAgents() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetAgents() communication error.", ce); }
            return(agents);
        }
Пример #7
0
        public static AgentDS GetAgents()
        {
            //Agents
            AgentDS agents = null;

            try {
                _Client = new IssueMgtServiceClient();
                agents  = _Client.GetAgents();
                _Client.Close();
            }
            catch (FaultException fe) { throw new ApplicationException("GetAgents() service error.", fe); }
            catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetAgents() timeout error.", te); }
            catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetAgents() communication error.", ce); }
            return(agents);
        }
Пример #8
0
        public AgentDS GetAgentLocations(string agent)
        {
            //Get a list of agents
            System.Diagnostics.Debug.WriteLine("GetAgentLocations");
            AgentDS subagents = null;

            try {
                subagents = new AgentDS();
                AgentDS ds = GetAgents(false);
                if (agent != null && ds.AgentTable.Rows.Count > 0)
                {
                    subagents.Merge(ds.AgentTable.Select("AgentParentNumber = '" + agent + "'"));
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating subagent list.", ex); }
            return(subagents);
        }
Пример #9
0
        public AgentDS GetParentAgents()
        {
            //Get a list of parent agent
            System.Diagnostics.Debug.WriteLine("GetParentAgents");
            AgentDS agents = null;

            try {
                agents = new AgentDS();
                AgentDS ds = GetAgents(false);
                if (ds.AgentTable.Rows.Count > 0)
                {
                    agents.Merge(ds.AgentTable.Select("AgentParentNumber = ''"));
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected exception creating subagent list.", ex); }
            return(agents);
        }
Пример #10
0
        public AgentDS GetAgents()
        {
            //
            AgentDS agents = new AgentDS();
            DataSet ds     = fillDataset(USP_AGENTS, TBL_AGENTS, new object[] { });

            if (ds.Tables[TBL_AGENTS].Rows.Count > 0)
            {
                AgentDS _ds = new AgentDS();
                _ds.Merge(ds);
                for (int i = 0; i < _ds.AgentTable.Rows.Count; i++)
                {
                    _ds.AgentTable.Rows[i]["AgentSummary"] = (!_ds.AgentTable.Rows[i].IsNull("MainZone") ? _ds.AgentTable.Rows[i]["MainZone"].ToString().PadLeft(2, ' ') : "  ") + " - " +
                                                             (!_ds.AgentTable.Rows[i].IsNull("AgentNumber") ? _ds.AgentTable.Rows[i]["AgentNumber"].ToString() : "    ") + " - " +
                                                             (!_ds.AgentTable.Rows[i].IsNull("AgentName") ? _ds.AgentTable.Rows[i]["AgentName"].ToString().Trim() : "");
                }
                agents.Merge(_ds.AgentTable.Select("", "MainZone ASC"));
                agents.AgentTable.AcceptChanges();
            }
            return(agents);
        }