Пример #1
0
        public XElement GetAllLocations()
        {
            ServiceReference1.NamingServiceClient client = new ServiceReference1.NamingServiceClient();
            XElement iexe = client.GetAllLocations();

            return(iexe);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public XElement GetLocation(String epc)
        {
            ServiceReference1.NamingServiceClient client = new ServiceReference1.NamingServiceClient();

            XElement e = new XElement("root", null);

            e = client.GetLocation(epc);

            return(e);
        }
Пример #4
0
        private XElement VehicleFromService(string urn)
        {
            XElement reply = new XElement("root", null);

            reply = null;

            if (Vehicles.Elements().Any())
            {
                reply = (
                    from x in Vehicles.Elements("Fordon")
                    where x.Element("EPC").Value.Equals(urn)
                    select new XElement(x)
                    ).FirstOrDefault();
            }

            if (reply == null)
            {
                ServiceReference1.NamingServiceClient client = new ServiceReference1.NamingServiceClient();

                reply = client.GetVehicle(urn);

                client.Close();

                XElement reply2;

                if (reply.Elements("Fordonsindivider").Any())
                {
                    reply2 = new XElement
                             (
                        "Fordon",
                        new XElement("EPC", urn),

                        (reply.Element("Fordonsindivider").Element("FordonsIndivid").Elements("Fordonsnummer").Any()) ?
                        new XElement("EVN", reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Fordonsnummer").Value) : null,

                        (reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Fordonsinnehavare").Elements("Foretag").Any()) ?
                        new XElement("Fordonsinnehavare", reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Fordonsinnehavare").Element("Foretag").Value) : null,

                        (reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("UnderhallsansvarigtForetag").Elements("Foretag").Any()) ?
                        new XElement("UnderhallsansvarigtForetag", reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("UnderhallsansvarigtForetag").Element("Foretag").Value) : null,

                        (reply.Element("FordonsTyp").Elements("FordonskategoriKodFullVardeSE").Any()) ?
                        new XElement("FordonsTyp", reply.Element("FordonsTyp").Element("FordonskategoriKodFullVardeSE").Value) : null,

                        (reply.Element("FordonsTyp").Elements("FordonsunderkategoriKodFullVardeSE").Any()) ?
                        new XElement("FordonsunderkategoriKodFullVardeSE", reply.Element("FordonsTyp").Element("FordonsunderkategoriKodFullVardeSE").Value) : null,

                        (reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Godkannande").Elements("FordonsgodkannandeFullVardeSE").Any()) ?
                        new XElement("FordonsgodkannandeFullVardeSE", reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Godkannande").Element("FordonsgodkannandeFullVardeSE").Value): null,

                        (reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Godkannande").Elements("GiltigtTom").Any()) ?
                        new XElement("GiltigtTom", reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Godkannande").Element("GiltigtTom").Value): null,

                        (reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Godkannande").Elements("GiltigtFrom").Any()) ?
                        new XElement("GiltigtFrom", reply.Element("Fordonsindivider").Element("FordonsIndivid").Element("Godkannande").Element("GiltigtFrom").Value): null
                             );
                }
                else
                {
                    reply2 = new XElement
                             (
                        "Fordon",
                        new XElement("EPC", urn)
                             );
                }

                Vehicles.Add(reply2);

                return(reply2);
            }
            return(reply);
        }