public static void RefreshZones(bool assignableOnly) { //Update a collection (dataset) of all open TLs for the terminal on the local LAN database ZoneClosingServiceClient client = new ZoneClosingServiceClient(); try { _Zones.Clear(); if (assignableOnly) { _Zones.Merge(client.GetUnassignedTLs(int.Parse(Program.TerminalCode))); } else { _Zones.Merge(client.GetTLs(int.Parse(Program.TerminalCode))); } client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } finally { if (ZonesChanged != null) { ZonesChanged(null, EventArgs.Empty); } } }
public ZoneDataset GetZones(int terminalID) { //Get a list of open TLs ZoneDataset zones = new ZoneDataset(); ZoneClosingServiceClient client = new ZoneClosingServiceClient(); try { DataSet ds = client.GetTLs(terminalID); if (ds != null) { zones.Merge(ds); } client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(zones); }
public ZoneDataset GetZone(int terminalID, string zoneCode) { //Get a single open TL ZoneDataset zone = new ZoneDataset(); ZoneClosingServiceClient client = new ZoneClosingServiceClient(); try { DataSet ds = client.GetTLs(terminalID); if (ds != null) { ZoneDataset _zones = new ZoneDataset(); _zones.Merge(ds); zone.Merge(_zones.ZoneTable.Select("Zone='" + zoneCode + "'")); } client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(zone); }