Exemplo n.º 1
0
        public IEnumerable <XElement> GetEvents(DateTime fromInclusive, DateTime toInclusive, String readPointEPC)
        {
            ServiceReference1.EpcisEventServiceClient client = new ServiceReference1.EpcisEventServiceClient();

            IEnumerable <XElement> iexe = client.GetEvents(fromInclusive, toInclusive, readPointEPC);

            return(iexe);
        }
Exemplo n.º 2
0
        //Unique methods
        //Hämtar alla events inom angivet datumintervall
        public XElement GetEventsForLocation(string locationUrn, DateTime fromDate, DateTime toDate, bool resetMasterData)
        {
            if (resetMasterData == true)
            {
                Locations.RemoveAll();
                Vehicles.RemoveAll();
            }


            ServiceReference1.EpcisEventServiceClient client = new ServiceReference1.EpcisEventServiceClient();

            XElement[] reply = new XElement[1];

            reply = client.GetEvents(fromDate, toDate, locationUrn);

            client.Close();

            // add vehicle
            foreach (XElement x in reply.Descendants("epcList"))
            {
                x.AddAfterSelf(new XElement(VehicleFromService(x.Element("epc").Value.ToString())));
            }

            // add location
            foreach (XElement x in reply.Descendants("ObjectEvent").Descendants("readPoint"))
            {
                x.AddAfterSelf(new XElement(LocationFromService(x.Element("id").Value.ToString())));
            }

            XElement replyAsXElement = new XElement("FordonsPassager", null);

            // tvätta
            foreach (XElement x in reply.Descendants("ObjectEvent"))
            {
                x.Element("eventTime").Name = "Tid";
                x.Element("eventTimeZoneOffset").Remove();
                x.Element("epcList").Remove();
                x.Element("action").Remove();
                x.Element("bizStep").Remove();
                x.Element("readPoint").Remove();
                x.Name = "FordonPassage";

                replyAsXElement.Add(x);
            }

            return(replyAsXElement);
        }