/// <summary> /// Method to validate the configured arguments for the step type. The /// logic of this method depends on the implementation of the custom step /// but typically checks for proper argument names and syntax. /// </summary> /// <param name="argv">Array of arguments configured for the step type</param> /// <returns>Returns 'true' if arguments are valid, 'false' if otherwise</returns> public bool ValidateArguments(ref object[] argv) { IJTXDatabase pJTXDB = m_ipDatabase; // Get the arguments string sHoldTypeName = ""; string sHoldRemarks = ""; bool bHoldType = StepUtilities.GetArgument(ref argv, "HoldType", true, out sHoldTypeName); if (!bHoldType) { MessageBox.Show("Invalid arguments entered. No hold type entered."); return(false); } bool bHoldRemarks = StepUtilities.GetArgument(ref argv, "HoldRemarks", true, out sHoldRemarks); // Get the hold type IJTXConfiguration pJTXConfig = pJTXDB.ConfigurationManager; IJTXHoldType pHoldType = pJTXConfig.GetHoldType(sHoldTypeName); if (pHoldType == null) { MessageBox.Show("Invalid hold type name entered: " + sHoldTypeName); return(false); } return(true); }
/// <summary> /// Called when a step of this type is executed in the workflow. /// </summary> /// <param name="JobID">ID of the job being executed</param> /// <param name="StepID">ID of the step being executed</param> /// <param name="argv">Array of arguments passed into the step's execution</param> /// <param name="ipFeedback">Feedback object to return status messages and files</param> /// <returns>Return code of execution for workflow path traversal</returns> public int Execute(int jobID, int stepID, ref object[] argv, ref IJTXCustomStepFeedback ipFeedback) { // Get the arguments string sHoldTypeName = ""; string sHoldRemarks = ""; bool bHoldType = StepUtilities.GetArgument(ref argv, "HoldType", true, out sHoldTypeName); if (!bHoldType) { MessageBox.Show("Invalid arguments entered. No hold type entered."); return(-1); } bool bHoldRemarks = StepUtilities.GetArgument(ref argv, "HoldRemarks", true, out sHoldRemarks); // Get the hold type IJTXConfiguration pJTXConfig = m_ipDatabase.ConfigurationManager; IJTXHoldType pHoldType = pJTXConfig.GetHoldType(sHoldTypeName); if (pHoldType == null) { MessageBox.Show("Invalid hold type name entered: " + sHoldTypeName); return(-1); } // Get the job IJTXJobManager pJobManager = m_ipDatabase.JobManager; IJTXJob pJob = pJobManager.GetJob(jobID); IJTXJobHolds pJobHolds = pJob as IJTXJobHolds; // Add new job hold IJTXJobHold pNewHold = pJobHolds.CreateHold(pHoldType); if (bHoldRemarks) { pNewHold.HoldComments = sHoldRemarks; pNewHold.Store(); } return(0); }