/// <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) { if (jobID <= 0) { throw (new ArgumentOutOfRangeException("JobID", jobID, "Job ID must be a positive value")); } string strNotifType = ""; string strSubscribers = ""; if (!StepUtilities.GetArgument(ref argv, m_expectedArgs[0], true, out strNotifType)) { throw new ArgumentNullException(m_expectedArgs[0], string.Format("\nMissing the {0} parameter!", m_expectedArgs[0])); } bool bSubscribers = StepUtilities.GetArgument(ref argv, m_expectedArgs[1], true, out strSubscribers); IJTXJob ipJob = m_ipDatabase.JobManager.GetJob(jobID); if (bSubscribers) { UpdateSubscriberList(strNotifType, strSubscribers, "add"); } JTXUtilities.SendNotification(strNotifType, m_ipDatabase, ipJob, null); if (bSubscribers) { UpdateSubscriberList(strNotifType, strSubscribers, "remove"); } return(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); }
//////////////////////////////////////////////////////////////////////// // METHOD: CreateChildVersion private bool CreateChildVersion(ref IJTXJob pJob) { IVersion pNewVersion = null; try { string strVersionName = pJob.VersionName; int index = strVersionName.IndexOf(".", 0); if (index >= 0) { strVersionName = strVersionName.Substring(index + 1); } pJob.VersionName = strVersionName; pNewVersion = pJob.CreateVersion(esriVersionAccess.esriVersionAccessPublic); if (pNewVersion == null) { m_ipDatabase.LogMessage(3, 1000, "Unable to create version for child job ID: " + pJob.ID); } else { IPropertySet pOverrides = new PropertySetClass(); pOverrides.SetProperty("[VERSION]", pNewVersion.VersionName); JobUtilities.LogJobAction(m_ipDatabase, pJob, Constants.ACTTYPE_CREATE_VERSION, "", pOverrides); JTXUtilities.SendNotification(Constants.NOTIF_VERSION_CREATED, m_ipDatabase, pJob, pOverrides); } } catch (Exception ex) { m_ipDatabase.LogMessage(3, 1000, "Unable to create version for child job ID: " + pJob.ID + ". ERROR: " + ex.Message); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(pNewVersion); } return(true); }
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"); } }
/// <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) { if (jobID <= 0) { throw (new ArgumentOutOfRangeException("JobID", jobID, "Job ID must be a positive value")); } System.Diagnostics.Debug.Assert(m_ipDatabase != null); IJTXJobManager pJobMan = m_ipDatabase.JobManager; IJTXJob2 pJob = pJobMan.GetJob(jobID) as IJTXJob2; // Make sure all the information exists to create this verion if (pJob.ActiveDatabase == null) { System.Windows.Forms.MessageBox.Show("Job does not have a data workspace"); return(-1); } if (pJob.ParentVersion == "") { System.Windows.Forms.MessageBox.Show("Job does not have a parent version"); return(-1); } string strVersionNameOverride; bool bVNOverride = StepUtilities.GetArgument(ref argv, m_expectedArgs[1], true, out strVersionNameOverride); if (pJob.VersionName == "" & !bVNOverride) { System.Windows.Forms.MessageBox.Show("The job does not have a version name"); return(-1); } IVersion pNewVersion; string strVersionName; if (bVNOverride) { strVersionName = strVersionNameOverride; } else { strVersionName = pJob.VersionName; } int index = strVersionName.IndexOf(".", 0); if (index >= 0) { strVersionName = strVersionName.Substring(index + 1); } esriVersionAccess verAccess = esriVersionAccess.esriVersionAccessPrivate; string strVerScope = ""; if (StepUtilities.GetArgument(ref argv, m_expectedArgs[0], true, out strVerScope)) { strVerScope = strVerScope.ToLower().Trim(); if (strVerScope == "public") { verAccess = esriVersionAccess.esriVersionAccessPublic; } else if (strVerScope == "protected") { verAccess = esriVersionAccess.esriVersionAccessProtected; } } pJob.VersionName = strVersionName; pNewVersion = pJob.CreateVersion(verAccess); if (pNewVersion == null) { throw (new System.SystemException("Unable to create version")); } IPropertySet pOverrides = new PropertySetClass(); pOverrides.SetProperty("[VERSION]", pNewVersion.VersionName); IJTXActivityType pActType = m_ipDatabase.ConfigurationManager.GetActivityType(Constants.ACTTYPE_CREATE_VERSION); if (pActType != null) { pJob.LogJobAction(pActType, pOverrides, ""); } JTXUtilities.SendNotification(Constants.NOTIF_VERSION_CREATED, m_ipDatabase, pJob, pOverrides); System.Runtime.InteropServices.Marshal.ReleaseComObject(pNewVersion); return(0); }
static void Main(string[] args) { JTXReportNotification prog = new JTXReportNotification(); if (prog.CheckoutLicense()) { // Arguments list // /ReportID:<Report ID to execute> // /NotifType:<Notification type to send> // example: JTXReportNotification.exe /NotifType:ReportNotification /ReportID:401 object[] pArgObjects = args as object[]; // Get some variables ready int iReportID = 0; string sReportID = ""; string sNotificationTypeName = ""; StepUtilities.GetArgument(ref pArgObjects, "ReportID", true, out sReportID); if (!int.TryParse(sReportID, out iReportID)) { Console.WriteLine("Invalid Report ID entered"); return; } StepUtilities.GetArgument(ref pArgObjects, "NotifType", true, out sNotificationTypeName); if (sNotificationTypeName == "") { Console.WriteLine("A notification type must be entered."); } IJTXDatabaseManager jtxDBMan = new JTXDatabaseManagerClass(); IJTXDatabase pJTXDB = jtxDBMan.GetActiveDatabase(false); IJTXConfiguration2 jtxConfig = pJTXDB.ConfigurationManager as IJTXConfiguration2; string sReportOutput = prog.RunReport(jtxConfig, iReportID); // if there's output, send the notification if (sReportOutput != "") { IJTXNotificationConfiguration pNotificationConfig = (IJTXNotificationConfiguration)jtxConfig; IJTXNotificationType pNotificationType = pNotificationConfig.GetNotificationType(sNotificationTypeName); if (pNotificationType == null) { Console.WriteLine("Please enter a valid notification type."); return; } // Update the message string sMessageBefore = pNotificationType.MessageTemplate; pNotificationType.MessageTemplate = sReportOutput; pNotificationType.Store(); // Send it! JTXUtilities.SendNotification(sNotificationTypeName, pJTXDB, null, null); // Set the message back. pNotificationType.MessageTemplate = ""; pNotificationType.Store(); } else { Console.WriteLine("Please enter a valid report ID."); } prog.CheckinLicense(); } }
static void Main(string[] args) { JTXOverdueNotification prog = new JTXOverdueNotification(); if (prog.CheckoutLicense()) { try { // Arguments list // /NotifType:<Notification type to send> // example: JTXOverdueNotification.exe /NotifType:OverdueJob object[] pArgObjects = args as object[]; // Get some variables ready string sNotificationTypeName = ""; StepUtilities.GetArgument(ref pArgObjects, "NotifType", true, out sNotificationTypeName); if (sNotificationTypeName == "") { Console.WriteLine("A notification type must be entered."); return; } IJTXDatabaseManager jtxDBMan = new JTXDatabaseManagerClass(); IJTXDatabase pJTXDB = jtxDBMan.GetActiveDatabase(false); IJTXConfiguration pJTXConfig = pJTXDB.ConfigurationManager; // Create a simple query to find jobs that were due before today IQueryFilter pQF = new QueryFilterClass(); // NOTE #1: Verify the date format matches your selected RDBMS // NOTE #2: Verify the status id for 'Closed' with the JTX Administrator pQF.WhereClause = "DUE_DATE < '" + DateTime.Today.ToString() + "'" + " AND STATUS <> 9"; Console.WriteLine(pQF.WhereClause); // Get the notification type for the notification that will be sent IJTXNotificationConfiguration pNotificationConfig = pJTXConfig as IJTXNotificationConfiguration; IJTXNotificationType pNotificationType = pNotificationConfig.GetNotificationType(sNotificationTypeName); if (pNotificationType == null) { Console.WriteLine("Please enter a valid notification type."); return; } // Get the job manager to execute the query and find the jobs in question IJTXJobManager pJobManager = pJTXDB.JobManager; IJTXJobSet pJobs = pJobManager.GetJobsByQuery(pQF); pJobs.Reset(); for (int a = 0; a < pJobs.Count; a++) { IJTXJob pJob = pJobs.Next(); Console.WriteLine(pJob.Name); // Send it! JTXUtilities.SendNotification(sNotificationTypeName, pJTXDB, pJob, null); } } catch (Exception except) { Console.WriteLine("An error occurred: " + except.Message); } prog.CheckinLicense(); Console.WriteLine("Completed."); } }
/// <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) { if (JobID <= 0) { throw new ArgumentOutOfRangeException("JobID", JobID, "Job ID must be a positive value"); } try { string strTemp = ""; bool bAttach = false; if (StepUtilities.GetArgument(ref argv, m_expectedArgs[1], false, out strTemp)) { bAttach = true; } string strResolution; if (!StepUtilities.GetArgument(ref argv, m_expectedArgs[2], false, out strResolution)) { strResolution = "1200"; } int iResolution = 1200; if (!Int32.TryParse(strResolution, out iResolution)) { iResolution = 1200; } string outputPath = ""; if (!bAttach) { SaveFileDialog pSaveFileDialog = new SaveFileDialog(); pSaveFileDialog.Filter = "PDF files (*.pdf)|*.pdf"; pSaveFileDialog.Title = "Choose output location..."; string strInitDir = ""; if (StepUtilities.GetArgument(ref argv, m_expectedArgs[0], true, out strInitDir)) { if (System.IO.Directory.Exists(strInitDir)) { pSaveFileDialog.InitialDirectory = strInitDir; } } if (pSaveFileDialog.ShowDialog() != DialogResult.OK) { return(-1); } outputPath = pSaveFileDialog.FileName; } string inputPath = JTXUtilities.SaveJobMXD(JobID); if (bAttach) { outputPath = SystemUtilities.GetTemporaryFileLocation(inputPath, "pdf"); } // delete output file if it already exists System.IO.FileInfo fi = new System.IO.FileInfo(outputPath); if (fi.Exists) { fi.Delete(); } MapDocumentClass map = new MapDocumentClass(); if (!map.get_IsMapDocument(inputPath)) { throw new ApplicationException("Invalid map or specified map not found."); } map.Open(inputPath, null); IActiveView pActiveView = (IActiveView)map.PageLayout; IExport pExport = new ExportPDFClass(); pExport.ExportFileName = outputPath; tagRECT deviceFrameRect; deviceFrameRect.left = 0; deviceFrameRect.right = 800; deviceFrameRect.top = 0; deviceFrameRect.bottom = 600; pActiveView.ScreenDisplay.DisplayTransformation.set_DeviceFrame(ref deviceFrameRect); int iOutputResolution = iResolution; int iScreenResolution = 96; pExport.Resolution = iOutputResolution; IOutputRasterSettings pOutputRasterSettings = (IOutputRasterSettings)pExport; pOutputRasterSettings.ResampleRatio = 1; tagRECT exportRect; exportRect.left = pActiveView.ExportFrame.left * (iOutputResolution / iScreenResolution); exportRect.top = pActiveView.ExportFrame.top * (iOutputResolution / iScreenResolution); exportRect.right = pActiveView.ExportFrame.right * (iOutputResolution / iScreenResolution); exportRect.bottom = pActiveView.ExportFrame.bottom * (iOutputResolution / iScreenResolution); IEnvelope pPixelBoundsEnv = new EnvelopeClass(); pPixelBoundsEnv.PutCoords(exportRect.left, exportRect.top, exportRect.right, exportRect.bottom); pExport.PixelBounds = pPixelBoundsEnv; int hdc = pExport.StartExporting(); pActiveView.Output(hdc, iOutputResolution, ref exportRect, null, null); pExport.FinishExporting(); pExport.Cleanup(); if (bAttach) { JTXUtilities.AddAttachmentToJob(JobID, outputPath, jtxFileStorageType.jtxStoreInDB); } return(0); } catch (Exception ex) { throw ex; } }
//////////////////////////////////////////////////////////////////////// // METHOD: GetInputParams private bool GetInputParams(object [] argv) { string sTemp = ""; // Job Type StepUtilities.GetArgument(ref argv, m_ExpectedArgs[0], true, out m_paramJobTypeName); // Job Assignment StepUtilities.GetArgument(ref argv, m_ExpectedArgs[1], true, out m_paramAssignToGroup); StepUtilities.GetArgument(ref argv, m_ExpectedArgs[2], true, out m_paramAssignToUser); // Job Dependencies m_paramDependThisStep = StepUtilities.GetArgument(ref argv, m_ExpectedArgs[3], true, out sTemp); m_paramDependNextStep = StepUtilities.GetArgument(ref argv, m_ExpectedArgs[4], true, out sTemp); m_paramHasStatusType = StepUtilities.GetArgument(ref argv, m_ExpectedArgs[5], true, out m_paramStatusType); // Number of Jobs and AOI Definition m_paramUseParentAOI = StepUtilities.GetArgument(ref argv, m_ExpectedArgs[6], true, out sTemp); StepUtilities.GetArgument(ref argv, m_ExpectedArgs[7], true, out m_AOIOverlapFeatureClassName); if (StepUtilities.GetArgument(ref argv, m_ExpectedArgs[8], true, out sTemp)) { m_paramNumberChildJobs = Convert.ToInt16(sTemp); } // Versioning StepUtilities.GetArgument(ref argv, m_ExpectedArgs[9], true, out sTemp); if (string.IsNullOrEmpty(sTemp)) { m_paramCreateVersionType = CreateVersionType.None; } else if (sTemp.Equals("The parent job's version")) { m_paramCreateVersionType = CreateVersionType.UseParentJobsVersion; } else if (sTemp.Equals("The parent job's parent version")) { m_paramCreateVersionType = CreateVersionType.UseParentJobsParentVersion; } else if (sTemp.Equals("The parent job's DEFAULT version")) { m_paramCreateVersionType = CreateVersionType.UseParentJobsDefaultVersion; } else if (sTemp.Equals("The job type's default properties parent version")) { m_paramCreateVersionType = CreateVersionType.UseJobTypeDefaultSettings; } StepUtilities.GetArgument(ref argv, m_ExpectedArgs[10], true, out sTemp); if (string.IsNullOrEmpty(sTemp)) { m_paramAssignVersionType = AssignVersionType.None; } else if (sTemp.Equals("The parent job's version")) { m_paramAssignVersionType = AssignVersionType.UseParentJobsVersion; } // Extended Properties StepUtilities.GetArgument(ref argv, m_ExpectedArgs[11], true, out m_paramExtendedProperties); StepUtilities.GetArgument(ref argv, m_ExpectedArgs[12], true, out sTemp); if (!String.IsNullOrEmpty(sTemp)) { m_dueDate = JTXUtilities.GenerateDateString(m_ipDatabase.JTXWorkspace, sTemp, false); } StepUtilities.GetArgument(ref argv, m_ExpectedArgs[13], true, out sTemp); if (!String.IsNullOrEmpty(sTemp)) { int.TryParse(sTemp, out m_duration); } 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) { System.Diagnostics.Debug.Assert(m_ipDatabase != null); string strValue = ""; int jobTypeID = 0; if (!StepUtilities.GetArgument(ref argv, m_expectedArgs[0], true, out strValue)) { throw new ArgumentNullException(m_expectedArgs[0], string.Format("\nMissing the {0} parameter!", m_expectedArgs[0])); } if (!Int32.TryParse(strValue, out jobTypeID)) { throw new ArgumentNullException(m_expectedArgs[0], "Argument must be an integrer!"); } IJTXJobType pJobType = m_ipDatabase.ConfigurationManager.GetJobTypeByID(jobTypeID); IJTXJobManager pJobMan = m_ipDatabase.JobManager; IJTXJob pNewJob = pJobMan.CreateJob(pJobType, 0, true); IJTXActivityType pActType = m_ipDatabase.ConfigurationManager.GetActivityType(Constants.ACTTYPE_CREATE_JOB); if (pActType != null) { pNewJob.LogJobAction(pActType, null, ""); } JTXUtilities.SendNotification(Constants.NOTIF_JOB_CREATED, m_ipDatabase, pNewJob, null); // Assign a status to the job if the Auto Assign Job Status setting is enabled IJTXConfigurationProperties pConfigProps = (IJTXConfigurationProperties)m_ipDatabase.ConfigurationManager; if (pConfigProps.PropertyExists(Constants.JTX_PROPERTY_AUTO_STATUS_ASSIGN)) { string strAutoAssign = pConfigProps.GetProperty(Constants.JTX_PROPERTY_AUTO_STATUS_ASSIGN); if (strAutoAssign == "TRUE") { pNewJob.Status = m_ipDatabase.ConfigurationManager.GetStatus("Created"); } } // Associate the current job with the new job with a parent-child relationship pNewJob.ParentJob = JobID; // Assign the job as specified in the arguments string strAssignTo = ""; if (StepUtilities.GetArgument(ref argv, m_expectedArgs[1], true, out strAssignTo)) { pNewJob.AssignedType = jtxAssignmentType.jtxAssignmentTypeGroup; pNewJob.AssignedTo = strAssignTo; } else if (StepUtilities.GetArgument(ref argv, m_expectedArgs[2], true, out strAssignTo)) { pNewJob.AssignedType = jtxAssignmentType.jtxAssignmentTypeUser; pNewJob.AssignedTo = strAssignTo; } pNewJob.Store(); // Copy the workflow to the new job WorkflowUtilities.CopyWorkflowXML(m_ipDatabase, pNewJob); // Create 1-1 extended property entries IJTXAuxProperties pAuxProps = (IJTXAuxProperties)pNewJob; System.Array contNames = pAuxProps.ContainerNames; IEnumerator contNamesEnum = contNames.GetEnumerator(); contNamesEnum.Reset(); while (contNamesEnum.MoveNext()) { string strContainerName = (string)contNamesEnum.Current; IJTXAuxRecordContainer pAuxContainer = pAuxProps.GetRecordContainer(strContainerName); if (pAuxContainer.RelationshipType == esriRelCardinality.esriRelCardinalityOneToOne) { pAuxContainer.CreateRecord(); } } m_ipDatabase.LogMessage(5, 1000, System.Diagnostics.Process.GetCurrentProcess().MainWindowTitle); // Update Application message about the new job if (System.Diagnostics.Process.GetCurrentProcess().MainWindowTitle.Length > 0) //if its not running in server { MessageBox.Show("Created " + pJobType.Name + " Job " + pNewJob.ID, "Job Created", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(0); }
public DialogResult ShowDialog(object[] argsIn, out object[] argsOut) { // Populate the combo boxes with the appropriate information IJTXConfiguration2 ipJTXConfig = m_ipDatabase.ConfigurationManager as IJTXConfiguration2; PopulateJobTypes(ipJTXConfig); PopulateUsers(ipJTXConfig); PopulateGroups(ipJTXConfig); PopulateStatusTypes(ipJTXConfig); // Populate the dialog with the existing argument information string strTemp = ""; if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[0], true, out strTemp)) { // Then the job type has been entered IJTXJobType ipJobType = ipJTXConfig.GetJobType(strTemp); if (ipJobType != null) { cmbJobTypes.SelectedItem = ipJobType.Name; } } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[1], true, out strTemp)) { // Then a user group has been selected for the new job assignment chkGroup.Checked = true; chkUser.Checked = false; cmbUsers.Enabled = false; int idx = cmbGroups.Items.IndexOf(strTemp); cmbGroups.SelectedIndex = idx; if (idx < 0) { cmbGroups.Text = strTemp; } } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[2], true, out strTemp)) { // Then a user has been selected for the new job assignment chkGroup.Checked = false; chkUser.Checked = true; cmbGroups.Enabled = false; int idx = cmbUsers.Items.IndexOf(strTemp); cmbUsers.SelectedIndex = idx; if (idx < 0) { cmbUsers.Text = strTemp; } } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[3], true, out strTemp)) { // Then a dependency is being created ... chkDependThisStep.Checked = true; lblStatus.Enabled = true; cboDependentStatus.Enabled = true; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[4], true, out strTemp)) { // Then a dependency is being created ... chkDependNextStep.Checked = true; lblStatus.Enabled = true; cboDependentStatus.Enabled = true; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[5], true, out strTemp)) { // Then a user has been selected for the new job assignment lblStatus.Enabled = true; lblStatus.Enabled = true; cboDependentStatus.SelectedItem = strTemp; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[6], true, out strTemp)) { // Then the parent job's AOI will be used by the child chkAssignParentAOIToChild.Checked = true; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[7], true, out strTemp)) { // Then the number of child jobs and their AOIs will be determined by a // spatial overlap with an input feature class chkAssignParentAOIToChild.Enabled = false; radioButton_generateNumberJobs.Checked = true; txtAOIFeatureClassName.Enabled = true; txtAOIFeatureClassName.Text = strTemp; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[8], true, out strTemp)) { // Then the user will specify the number of child jobs txtAOIFeatureClassName.Enabled = false; radioButton_DefineNumberOfJobs.Checked = true; lstNumberOfJobs.Value = Convert.ToDecimal(strTemp); chkAssignParentAOIToChild.Enabled = true; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[9], true, out strTemp)) { // Then a version will be created for the child job(s) from the Default version chkCreateVersion.Checked = true; cboCreateVersionSetting.Enabled = true; int idx = cboCreateVersionSetting.Items.IndexOf(strTemp); cboCreateVersionSetting.SelectedIndex = idx; if (idx < 0) { cboCreateVersionSetting.Text = strTemp; } } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[10], true, out strTemp)) { // Then a version will be created for the child job(s) from the Default version chkAssignVersion.Checked = true; cboAssignVersionSetting.Enabled = true; int idx = cboAssignVersionSetting.Items.IndexOf(strTemp); cboAssignVersionSetting.SelectedIndex = idx; if (idx < 0) { cboAssignVersionSetting.Text = strTemp; } } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[11], true, out strTemp)) { // Then the user will not be able to modify any parameters that were pre-configured chkSetExtProps.Checked = true; txtSetExtProps.Text = strTemp; } if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[12], true, out strTemp)) { chkDueDate.Checked = true; dtpDueDate.Value = JTXUtilities.GenerateDateString(m_ipDatabase.JTXWorkspace, strTemp, false); } else if (StepUtilities.GetArgument(ref argsIn, m_expectedArgs[13], true, out strTemp)) { txtDuration.Text = strTemp; } // Show the dialog this.ShowDialog(); argsOut = m_Arguments.ToArray(); return(DialogResult); }
private void btnOK_Click(object sender, EventArgs e) { if (cmbJobTypes.SelectedItem.ToString() != "") { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[0], cmbJobTypes.SelectedItem.ToString())); } if (chkGroup.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[1], cmbGroups.Text)); } else if (chkUser.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[2], cmbUsers.Text)); } if (chkDependThisStep.Checked) { m_Arguments.Add(StepUtilities.CreateFlagArgument(m_expectedArgs[3])); } if (chkDependNextStep.Checked) { m_Arguments.Add(StepUtilities.CreateFlagArgument(m_expectedArgs[4])); } if (chkDependThisStep.Checked || chkDependNextStep.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[5], cboDependentStatus.SelectedItem.ToString())); } if (radioButton_DefineNumberOfJobs.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[8], lstNumberOfJobs.Value.ToString())); if (chkAssignParentAOIToChild.Checked) { m_Arguments.Add(StepUtilities.CreateFlagArgument(m_expectedArgs[6])); } } if (radioButton_generateNumberJobs.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[7], txtAOIFeatureClassName.Text)); } if (chkCreateVersion.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[9], cboCreateVersionSetting.Text)); } if (chkAssignVersion.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[10], cboAssignVersionSetting.Text)); } if (chkSetExtProps.Checked) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[11], txtSetExtProps.Text)); } // Deal with the date options if (chkDueDate.Checked) { string strDate = JTXUtilities.GenerateDBMSDate(m_ipDatabase.JTXWorkspace, dtpDueDate.Value); m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[12], strDate)); } else if (!String.IsNullOrEmpty(txtDuration.Text)) { int duration = -1; // Make sure the duration is a positive number int.TryParse(txtDuration.Text, out duration); if (duration > 0) { m_Arguments.Add(StepUtilities.CreateSingleArgument(m_expectedArgs[13], txtDuration.Text)); } } DialogResult = DialogResult.OK; this.Hide(); }