/// <summary> /// Constructor. /// </summary> /// <param name="proxy">XML proxy.</param> /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception> internal ProductionRequest(XsdNs.ProductionRequestType proxy) { SegmentRequirements = new List <SegmentRequirement>(); try { // Read identifier if (proxy.ID != null) { Identifier = new IdentifierType(proxy.ID); } // Read hierarchy scope if (proxy.HierarchyScope != null) { HierarchyScopeObj = new HierarchyScope(proxy.HierarchyScope); // throws InvalidMessageException } // Read segment requirements if (proxy.SegmentRequirement != null) { foreach (var segReq in proxy.SegmentRequirement) { SegmentRequirements.Add(new SegmentRequirement(segReq)); // throws InvalidMessageException } } // Read scheduling parameters if (proxy.SchedulingParameters != null) { try { // Expecting a data record in an XML node array SchedulingParameters = (SXml.XmlNode[])proxy.SchedulingParameters; } catch (InvalidCastException e) { throw new XNeut.InvalidMessageException("Unexpected type of scheduling parameters", e); } } } catch (NullReferenceException e) { var msg = string.Format("Failed to read ProductionRequest {0} - something required is missing", TryGetIdString()); throw new XNeut.InvalidMessageException(msg, e); } catch (XNeut.InvalidMessageException e) { var msg = string.Format("Failed to read ProductionRequest {0}: {1}", TryGetIdString(), e.Message); throw new XNeut.InvalidMessageException(msg, e); } }
private void AddHierarchyScopeIfNotNull(ItemsControl parent, MsgBiz.HierarchyScope hierScope) { if (hierScope == null) { return; } var hierScopeNode = AddNodeToTreeview(parent, "HierarchyScope"); // Equipment ID specified? if (hierScope.EquipmentIdentifier != null) { AddIdentifierIfNotNull(hierScopeNode, "EquipmentID", hierScope.EquipmentIdentifier); } AddNodeToTreeview(hierScopeNode, "EquipmentElementLevel", hierScope.EquipmentElementLevel.ToString()); }