public ShipperDataset GetShippers(FreightType freightType, string clientNumber, string clientTerminal) { //Get a list of shippers ShipperDataset shippers = null; try { shippers = new ShipperDataset(); if (freightType == FreightType.Regular) { VendorDataset vendors = GetVendors(clientNumber, clientTerminal); shippers = new ShipperDataset(); 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) { AgentDataset agents = GetAgents(false); ShipperDataset _shippers = new ShipperDataset(); 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); }
public AgentDataset GetAgents(bool mainZoneOnly) { //Get a list of agents AgentDataset agents = null; try { agents = new AgentDataset(); DataSet ds = FillDataset(USP_AGENTS, TBL_AGENTS, new object[] { }); if (ds.Tables[TBL_AGENTS].Rows.Count != 0) { AgentDataset _ds = new AgentDataset(); if (mainZoneOnly) { AgentDataset __ds = new AgentDataset(); __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 AgentDataset GetAgentLocations(string agent) { //Get a list of agents System.Diagnostics.Debug.WriteLine("GetAgentLocations"); AgentDataset subagents = null; try { subagents = new AgentDataset(); AgentDataset 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); }