public static Customers2 GetCustomers2(string clientNumber) { //Get customers list Customers2 customers = new Customers2(); try { Customers2 _customers = GetCustomers2(); if (clientNumber != null && clientNumber.Length > 0) { for (int i = 0; i < _customers.Count; i++) { Customer2 c = _customers[i]; if (c.AccountID.Trim().Length > 0 && c.AccountID.Substring(0, 3) == clientNumber) { customers.Add(c); } } } else { customers = _customers; } } catch (ApplicationException aex) { throw aex; } catch (Exception ce) { throw new ApplicationException(ce.Message, ce); } return(customers); }
public Customers2 GetCustomers2() { // Customers2 customers = new Customers2(); try { DataSet ds = new RoadshowGateway().GetDispatchCustomers2(); if (ds != null) { RoadshowDataset _customers = new RoadshowDataset(); _customers.Merge(ds); for (int i = 0; i < _customers.CustomerTable.Rows.Count; i++) { customers.Add(new Customer2(_customers.CustomerTable[i])); } } } catch (ApplicationException aex) { throw new FaultException <RoadshowFault>(new RoadshowFault(aex.Message), "Gateway Error"); } catch (Exception ex) { throw new FaultException <RoadshowFault>(new RoadshowFault(ex.Message), "Unexpected Error"); } return(customers); }