Beispiel #1
0
        /// <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)
        {
            System.Diagnostics.Debug.Assert(m_ipDatabase != null);

            IJTXJob pJob = m_ipDatabase.JobManager.GetJob(JobID);

            //Automatic status assignment
            IJTXConfiguration           pConfig      = m_ipDatabase.ConfigurationManager;
            IJTXConfigurationProperties pConfigProps = (IJTXConfigurationProperties)pConfig;

            IJTXWorkflowConfiguration pWFConfig = (IJTXWorkflowConfiguration)pJob;
            IJTXWorkflowExecution     pWFExec   = (IJTXWorkflowExecution)pJob;

            int[] iSteps = pWFExec.GetCurrentSteps();
            if (iSteps.Length == 1)
            {
                if (pWFExec.IsLastStep(iSteps[0]))
                {
                    pWFExec.MoveNext(iSteps[0], (int)nullReturnType.null_return);
                }
            }

            pJob.Close();
            pJob.EndDate = System.DateTime.Now;

            if (pConfigProps.PropertyExists(Constants.JTX_PROPERTY_AUTO_STATUS_ASSIGN))
            {
                string strAutoAssign = pConfigProps.GetProperty(Constants.JTX_PROPERTY_AUTO_STATUS_ASSIGN);
                if (strAutoAssign == "TRUE")
                {
                    pJob.Status = m_ipDatabase.ConfigurationManager.GetStatus("Closed");
                }
            }

            pJob.Store();

            IJTXActivityType pActType = pConfig.GetActivityType("CloseJob");

            if (pActType != null)
            {
                pJob.LogJobAction(pActType, null, "");
            }

            JTXUtilities.SendNotification(Constants.NOTIF_JOB_CLOSED, m_ipDatabase, pJob, null);

            return(0);
        }
        public void OnClick()
        {
            // Confirm the user wants to do this
            DialogResult result = MessageBox.Show("Are you sure you want to clear the AOI from the selected jobs?", "Clear AOI", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                // Get the job set from the list of jobs
                IJTXJobViewPanel pJobViewPanel = ((IJTXJobViewPanel)m_pApplication.CurrentView.ViewPanel);
                List <IJTXJob>   pSelectedJobs = pJobViewPanel.SelectedJobs;
                foreach (IJTXJob pJob in pSelectedJobs)
                {
                    pJob.AOIExtent = null;
                    pJob.Store();

                    // Update the activity log and send notifications
                    IJTXConfiguration pConfig  = m_pApplication.CurrentDatabase.ConfigurationManager;
                    IJTXActivityType  pActType = pConfig.GetActivityType(Constants.ACTTYPE_UPDATE_AOI);
                    if (pActType != null)
                    {
                        pJob.LogJobAction(pActType, null, "");
                    }
                    JTXUtilities.SendNotification(Constants.NOTIF_AOI_UPDATED, m_pApplication.CurrentDatabase, pJob, null);
                }

                // If only 1 job is selected, refresh the panels
                if (pSelectedJobs.Count == 1)
                {
                    foreach (IJTXJobPanel ipJobPanel in pJobViewPanel.JobPanels)
                    {
                        ipJobPanel.RefreshJob();
                    }
                }

                MessageBox.Show("Cleared the AOI from selected jobs");
            }
        }