public void GetNavigationHierarchyTwoLocations() { configuration = new SimpleAmplaConfiguration(); configuration.EnableModule(module); configuration.AddLocation(module, "Plant.Area.Production"); configuration.AddLocation(module, "Plant.Area.Equipment.Production"); SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient( database, configuration, new SimpleSecurityWebServiceClient("User")); GetNavigationHierarchyResponse response = webServiceClient.GetNavigationHierarchy( new GetNavigationHierarchyRequest { Module = AmplaModules.Production, Credentials = CreateCredentials() }); Assert.That(response, Is.Not.Null); Assert.That(response.Hierarchy, Is.Not.Null); CheckViewPoints(response.Hierarchy.ViewPoints, "", "Plant"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints, "Plant", "Area"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ViewPoints, "Plant.Area", "Equipment"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ReportingPoints, "Plant.Area", "Production"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ViewPoints[0].ReportingPoints, "Plant.Area.Equipment", "Production"); }
public void GetNavigationHierarchy() { SimpleDataWebServiceClient webServiceClient = Create(); GetNavigationHierarchyResponse response = webServiceClient.GetNavigationHierarchy( new GetNavigationHierarchyRequest { Module = AmplaModules.Production, Credentials = CreateCredentials() }); Assert.That(response, Is.Not.Null); Assert.That(response.Hierarchy, Is.Not.Null); CheckViewPoints(response.Hierarchy.ViewPoints, "", "Enterprise"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints, "Enterprise", "Site"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ViewPoints, "Enterprise.Site", "Area"); CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ViewPoints[0].ReportingPoints, "Enterprise.Site.Area", "Production"); }
/// <summary> /// Gets the allowed values. /// </summary> /// <param name="property">The property.</param> /// <returns></returns> public List <string> GetAllowedValues(string property) { if (property == "Location") { GetNavigationHierarchyRequest request = new GetNavigationHierarchyRequest { Credentials = CreateCredentials(), Module = ModelProperties.Module, Context = NavigationContext.Plant, Mode = NavigationMode.Location }; GetNavigationHierarchyResponse response = WebServiceClient.GetNavigationHierarchy(request); List <string> values = new List <string>(); IAmplaBinding binding = new AmplaNavigationBinding(response, values); if (binding.Validate() && binding.Bind()) { return(values); } } return(null); }
public AmplaNavigationBinding(GetNavigationHierarchyResponse response, List <string> values) { this.response = response; this.values = values; }