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); }
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); }
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); }
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); } }
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); }
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); }
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); }