private SimpleWeight(SimpleWeight copy)
     : base(copy)
 {
     Value   = copy.Value;
     When    = copy.When;
     Display = copy.Display;
 }
Exemplo n.º 2
0
        private static void TestGetThings(string token, string personId, string recordId, ref Guid[] typeIds)
        {
            try
            {
                HVDataAccess.HVDataAccessClient client  = new HVDataAccess.HVDataAccessClient();
                HVDataAccess.GetThingsRequest   request = new HVDataAccess.GetThingsRequest();

                request.Token     = token;
                request.PersonId  = new Guid(personId);
                request.RecordId  = new Guid(recordId);
                request.TypeIds   = typeIds;
                request.SinceDate = DateTime.Parse("1/1/2008");

                HVDataAccess.GetThingsResponse response = client.GetThings(request);
                if (response.Success)
                {
                    Console.WriteLine("\nGetThings Response:\n");
                    foreach (string item in response.Things)
                    {
                        // Example : use LINQ to parse the xml record
                        XElement thing = XElement.Parse(item);
                        Console.WriteLine(thing);

                        // Example : use SimpleThings classes to parse the xml into specific object types, Weight in this example.
                        Guid typeId = new Guid(thing.Element("type-id").Value);
                        if (typeId.Equals(typeIds[0]))                                // Weight type-id is expected at myTypeIds[0] in this test-app
                        {
                            SimpleWeight sw = new SimpleWeight();
                            sw.Initialize(item);
                            Console.WriteLine("SimpleWeight : {0}", sw.Display);
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Error = {0}\n", response.Message);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception : TestGetThings : {0}", ex.Message);
                return;
            }
        }