Create the Material status service - Intergraph Smart Construction - 8 - Customization & Programming - Hexagon PPM

Intergraph Smart Construction API and Programming Reference

Language
English
Product
Intergraph Smart Construction
Search by Category
Customization & Programming
Smart Construction Version
8

Complete the following steps to implement the IMaterialStatusService service contract.

  1. Open Microsoft Visual Studio.

  2. Click File > New > Project to open the New Project dialog box.

  3. In the Templates pane of the New Project dialog box, select Class Library.

  4. Type a name in the Name box and a location in the Location box on the New Project dialog box. Click OK to open your project.

  5. Right-click the References node in your Solution Explorer and select Add Reference.

  6. On the Add Reference dialog box, click the Browse tab and navigate to your SmartPlant Foundation bin directory.

  7. Select the SPC.External.Services.dll and SPC.SharedResources.dll. Click OK.

  8. Verify that the selected files were added to the References node in the Solution Explorer.

  9. Select SPC.External.Services. In the Properties window, select False for the Copy Local setting. Select False for the Specific Version setting.

  10. Select SPC.SharedResources. In the Properties window, select False for the Copy Local setting. Select False for the Specific Version setting.

  11. Select SPC.Server.Common. In the Properties window, select False for the Copy Local setting. Select False for the Specific Version setting.

  12. In the Solution Explorer, right-click the Project node and select Add > New Item.

  13. In the Templates pane of the Add New Item dialog box, select Class. Type a name in the Name box. Click OK to open the new class.

  14. Add the line implements SPC.External.Services.Contracts.IMaterialsService below the class declaration line. Press Enter.

  15. Add the desired properties to the service using the following format:

    • To make the property available for configuration: <MaterialServiceAttribute(IsMaterialProperty:=True)>

    • To treat the added property as an alert: <MaterialServiceAttribute(IsMaterialProperty:=True, IsAlertProperty:=True)>

  16. Implement the logic for the different methods of IMaterialStatusService.

  17. Once you have completed your implementation, click Build > Rebuild Solution to build your custom implementation of the Material Status Service. Copy it into the build path specified in your project settings inside of Visual Studio. The default location is the bin\debug directory located under your project.

  18. Copy the MaterialStatusSample.dll (or your specific name) from the directory and paste the file into SmartPlant Foundation Server bin folder.

  19. Open the SmartPlant Foundation Server folder.

  20. Open the web.config file and locate the XML node Unity.

  21. Comment out the Material Status Service type node.

  22. Replace the Material Status Service type node with your implementation of the Material status service.

  23. Recycle the Internet Information Services (IIS) application pools for the site of your project. For more information on resetting IIS application pools, see IIS documentation.

    Smart Construction now uses your implementation of the Material Service rather than the default implementation.