/// <summary> /// Updates the EDMPROP element with the Extended Data associated with the specified WFM node. /// </summary> /// <param name="element">The element.</param> /// <param name="node">A WFM node object representing a Work Request, Design, Work Location, or Compatible Unit.</param> private void UpdateEdm(IXMLDOMElement element, IMMWMSNode node) { IMMWMSWorkRequest workRequest = node as IMMWMSWorkRequest; if (workRequest != null) { this.SetProperty(element, _EdmRepository.WorkRequest, string.Format(CultureInfo.InvariantCulture, "{0} = {1}", Fields.WorkRequestID, workRequest.ID)); } else { IMMWMSDesign design = node as IMMWMSDesign; if (design != null) { this.SetProperty(element, _EdmRepository.Design, string.Format(CultureInfo.InvariantCulture, "{0} = {1}", Fields.DesignID, design.ID)); } else { IMMWMSWorklocation workLocation = node as IMMWMSWorklocation; if (workLocation != null) { this.SetProperty(element, _EdmRepository.WorkLocation, string.Format(CultureInfo.InvariantCulture, "{0} = {1}", Fields.WorkLocationID, workLocation.ID)); } else { IMMWMSCompatibleUnit compatibleUnit = node as IMMWMSCompatibleUnit; if (compatibleUnit != null) { this.SetProperty(element, _EdmRepository.CompatibleUnit, string.Format(CultureInfo.InvariantCulture, "{0} = {1}", Fields.CompatibleUnitID, compatibleUnit.ID)); } } } } }
/// <summary> /// This will save the given node and edm struct data into the correct configured edm tables. /// </summary> /// <param name="node">IMMWMSNode which can be the WorkRequest, Design, WorkLocation, or CU.</param> /// <param name="edm">EDM struct containing the data.</param> private void Save(IMMWMSNode node, EDM edm) { string sql = null; EdmTable table = null; IMMWMSWorkRequest workRequest = node as IMMWMSWorkRequest; if (workRequest != null) // WorkRequest { table = _EdmRepository.WorkRequest; sql = string.Format(CultureInfo.InvariantCulture, "INSERT INTO {0} ({1},{2},{3},{4},{5}) VALUES ({6}, {7},'{8}','{9}','{10}')", "{0}", Fields.WorkRequestID, Fields.DesignID, EDM.Fields.Name, EDM.Fields.Value, EDM.Fields.Type, workRequest.ID, _ID, edm.Name, edm.Value, edm.Type); } else { IMMWMSDesign design = node as IMMWMSDesign; if (design != null) // Design { table = _EdmRepository.Design; sql = string.Format(CultureInfo.InvariantCulture, "INSERT INTO {0} ({1},{2},{3},{4}) VALUES ({5}, {6},'{7}','{8}', '{9}')", "{0}", Fields.DesignID, EDM.Fields.Name, EDM.Fields.Value, EDM.Fields.Type, design.ID, _ID, edm.Name, edm.Value, edm.Type); } else { IMMWMSWorklocation workLocation = node as IMMWMSWorklocation; if (workLocation != null) // WorkLocation { table = _EdmRepository.WorkLocation; sql = string.Format(CultureInfo.InvariantCulture, "INSERT INTO {0} ({1},{2},{3},{4},{5}) VALUES ({6}, {7},'{8}','{9}','{10}')", "{0}", Fields.WorkLocationID, Fields.DesignID, EDM.Fields.Name, EDM.Fields.Value, EDM.Fields.Type, workLocation.ID, _ID, edm.Name, edm.Value, edm.Type); } else { IMMWMSCompatibleUnit compatibleUnit = node as IMMWMSCompatibleUnit; if (compatibleUnit != null) // CompatibleUnit { table = _EdmRepository.CompatibleUnit; sql = string.Format(CultureInfo.InvariantCulture, "INSERT INTO {0} ({1},{2},{3},{4},{5}) VALUES ({6}, {7},'{8}','{9}','{10}')", "{0}", Fields.CompatibleUnitID, Fields.DesignID, EDM.Fields.Name, EDM.Fields.Value, EDM.Fields.Type, compatibleUnit.ID, _ID, edm.Name, edm.Value, edm.Type); } } } } // Insert the EDM when the table is valid. if (table != null && table.Valid) { // Check to see that the field is not being excluded. if (table.Fields.Count(o => o.Name.Equals(edm.Name, StringComparison.OrdinalIgnoreCase)) == 0) { // Add the EDM record into the table. _PxApp.ExecuteNonQuery(string.Format(CultureInfo.InvariantCulture, sql, _PxApp.GetQualifiedTableName(table.TableName))); } } }
/// <summary> /// Initializes the process framework node wrapper using the specified <paramref name="user" /> for the node. /// </summary> /// <param name="extension">The extension.</param> /// <param name="user"></param> /// <returns> /// Returns <see cref="bool" /> representing <c>true</c> if the node was successfully initialized; otherwise /// <c>false</c>. /// </returns> protected override bool Initialize(IMMWorkflowManager extension, IMMPxUser user) { string nodeTypeName = NodeTypeName; _Worklocation = (IMMWMSWorklocation)extension.CreateWMSNode(ref nodeTypeName); return(_Worklocation != null); }
/// <summary> /// Initializes the process framework node wrapper using the specified <paramref name="nodeId" /> for the node. /// </summary> /// <param name="extension">The extension.</param> /// <param name="nodeId">The node identifier.</param> /// <returns> /// Returns <see cref="bool" /> representing <c>true</c> if the node was successfully initialized; otherwise /// <c>false</c>. /// </returns> protected override bool Initialize(IMMWorkflowManager extension, int nodeId) { if (_Worklocation != null && _Worklocation.ID == nodeId) { return(true); } bool ro = false; bool sm = true; string nodeTypeName = NodeTypeName; _Worklocation = (IMMWMSWorklocation)extension.GetWMSNode(ref nodeTypeName, ref nodeId, ref ro, ref sm); return(_Worklocation != null); }