private XElement LocationFromService(string urn) { XElement reply = new XElement("root", null); reply = null; if (Locations.Elements().Any()) { reply = ( from x in Locations.Elements("Location") where x.Element("Epc").Value.ToString().Equals(urn) select new XElement(x) ).FirstOrDefault(); } if (reply == null) { ServiceReference1.NamingServiceClient client = new ServiceReference1.NamingServiceClient(); reply = client.GetLocation(urn); client.Close(); reply = (XElement)reply.Element("Location"); Locations.Add(reply); } return(reply); }
public XElement GetLocation(String epc) { ServiceReference1.NamingServiceClient client = new ServiceReference1.NamingServiceClient(); XElement e = new XElement("root", null); e = client.GetLocation(epc); return(e); }