예제 #1
0
        public void Run()
        {
            try {
                Console.WriteLine("\n\nGetSpaceTypes...");

                IEnumerable <MetasysObjectType> spaceTypes = client.GetSpaceTypes();
                foreach (var type in spaceTypes)
                {
                    Console.WriteLine($"\nType {type.Id}: {type.Description}, ");
                }
                // Select a space type
                Console.WriteLine("\nPlease enter the Space Type ID to retrieve all related spaces:");
                string spaceType = Console.ReadLine();
                IEnumerable <MetasysObject> spaces = client.GetSpaces((SpaceTypeEnum)Enum.Parse(typeof(SpaceTypeEnum), spaceType));
                Console.WriteLine($"Spaces found: {spaces.Count()}");
                foreach (var space in spaces)
                {
                    Console.WriteLine($"\n{space.Id}: {space.Name}, {space.ItemReference}");
                }
                // Select a space
                Console.WriteLine("\nPlease enter the Space ID to retrieve all related equipment:");
                string spaceID = Console.ReadLine();
                IEnumerable <MetasysObject> spaceEquipment = client.GetSpaceEquipment(new Guid(spaceID));
                Console.WriteLine($"Equipment found: {spaceEquipment.Count()}");
                foreach (var o in spaceEquipment)
                {
                    Console.WriteLine($"\n{o.Id}: {o.Name}, {o.ItemReference}");
                }
            }
            catch (Exception exception) {
                log.Logger.Error(string.Format("An error occured while getting space information - {0}", exception.Message));
                Console.WriteLine("\n \nAn Error occurred. Press Enter to return to Main Menu");
            }
            Console.ReadLine();
        }
예제 #2
0
 private void GetSpaceEquipment_GetSpaceChildren(MetasysObject building)
 {
     /* SNIPPET 4: START */
     IEnumerable <MetasysObject> spaceEquipment = client.GetSpaceEquipment(building.Id);
     IEnumerable <MetasysObject> spaceChildren  = client.GetSpaceChildren(building.Id);
     MetasysObject sampleSpaceEquipment         = spaceEquipment.FirstOrDefault();
     /* SNIPPET 4: END */
 }