Navigation:  USING THE API > 3.5 WORKING WITH FACILITIES >

3.5.1 Example: Retrieving a List of Facilities

Previous page Next page
  rev. 2007-12-04        

The following example shows how to retrieve the list of facilities which are contained in the “Springfield” Portfolio (which has ID 01) within the Data Source “ManagingEnergy_Template”.

// Get the "Springfield" Portfolio (ID "01")  from the Data Source "ManagingEnergy Template"

ManagingEnergy.Portfolio portfolio = api.PortfolioManager.GetPortfolio("ManagingEnergy_Template", "01");

 

// Get the list of Facilities contained in the portfolio

ManagingEnergy.Facility[] facilities = portfolio.GetFacilities(api);

 

// display the facilities

foreach (ManagingEnergy.Facility facility in facilities)

  Console.WriteLine(facility);              

 

// OUTPUT

0016 - Springfield Municipal Offices

1001 - Springfield General Hospital

2001 - Springfield Science Museum

7014 - Springfield Arena

7023 - Springfield Recreational Centre

8001 - Springfield Police Detachment

8024 - Springfield Correctional Centre

9001 - Springfield Residential Co-op



3.5.1_Example_Retrieving_a_Lis         ©2017 Managing Energy Inc.