private void loadRegions() { //Load a list of region sslections try { LocationDS locationDS = new LocationDS(); LocationDS _ds = CustomerProxy.GetRegions(this.cboCompany.SelectedValue.ToString().PadLeft(6, '0').Substring(3, 3)); System.Collections.Hashtable table = new System.Collections.Hashtable(); for (int i = 0; i < _ds.LocationTable.Rows.Count; i++) { string region = _ds.LocationTable[i].Location.ToString().Trim(); if (region.Length == 0) { _ds.LocationTable[i].Delete(); } else { if (table.ContainsKey(region)) { _ds.LocationTable[i].Delete(); } else { table.Add(region, _ds.LocationTable[i].LocationName.ToString().Trim()); _ds.LocationTable[i].Location = region; _ds.LocationTable[i].LocationName = _ds.LocationTable[i].LocationName.ToString().Trim(); } } } locationDS.Merge(_ds, true); this.cboLocation.DisplayMember = "LocationTable.LocationName"; this.cboLocation.ValueMember = "LocationTable.Location"; this.cboLocation.DataSource = locationDS; } catch (Exception ex) { throw new ControlException("Unexpected error while loading company regions.", ex); } }
public LocationDS GetRegions(string clientNumber) { //Get a list of client divisions LocationDS regions = null; try { regions = new LocationDS(); regions.LocationTable.AddLocationTableRow("All", "All"); if (clientNumber.Length > 3) { clientNumber = clientNumber.Substring(clientNumber.Length - 3, 3); } if (clientNumber == "000") { clientNumber = null; } DataSet ds = fillDataset(USP_REGIONS_DISTRICTS, TBL_REGIONS, new object[] { clientNumber }); if (ds.Tables[TBL_REGIONS].Rows.Count > 0) { regions.Merge(ds); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected exception creating company regions list.", ex); } return(regions); }
public static LocationDS GetRegions(string clientNumber) { //Get a list of client divisions LocationDS regions = null; try { _Client = new IssueMgtServiceClient(); regions = _Client.GetRegions(clientNumber); _Client.Close(); } catch (FaultException fe) { throw new ApplicationException("GetRegions() service error.", fe); } catch (TimeoutException te) { _Client.Abort(); throw new ApplicationException("GetRegions() timeout error.", te); } catch (CommunicationException ce) { _Client.Abort(); throw new ApplicationException("GetRegions() communication error.", ce); } return(regions); }
private void loadDistricts() { //Load a list of district selections try { LocationDS locationDS = new LocationDS(); LocationDS _ds = CustomerProxy.GetDistricts(this.cboCompany.SelectedValue.ToString().PadLeft(6, '0').Substring(3, 3)); for (int i = 0; i < _ds.LocationTable.Rows.Count; i++) { _ds.LocationTable[i].Location = _ds.LocationTable[i].Location.ToString().Trim(); _ds.LocationTable[i].LocationName = _ds.LocationTable[i].LocationName.ToString().Trim(); } locationDS.Merge(_ds, true); this.cboLocation.DisplayMember = "LocationTable.LocationName"; this.cboLocation.ValueMember = "LocationTable.Location"; this.cboLocation.DataSource = locationDS; } catch (Exception ex) { throw new ControlException("Unexpected error while loading company districts.", ex); } }