/// <summary> /// Executes the requested Report /// </summary> /// <param name="pJTXConfig"></param> /// <param name="iReportID"></param> /// <returns></returns> public string RunReport(IJTXConfiguration2 pJTXConfig, int iReportID) { string sReportOutput = ""; IJTXReportManager pReportManager = pJTXConfig.ReportManager; IJTXReportSet pReports = pReportManager.GetReports(); if (pReports.Count == 0) { Console.WriteLine("No reports configured in the JTX system"); return(""); } pReports.Reset(); for (int a = 0; a < pReports.Count; a++) { IJTXReport pReport = pReports.Next(); if (pReport.ID == iReportID) { sReportOutput = pReport.GenerateFormattedReport(); return(sReportOutput); } } return(""); }
private void PopulateUsers(IJTXConfiguration2 ipJTXConfig) { IJTXUserSet ipUsers = ipJTXConfig.Users; for (int i = 0; i < ipUsers.Count; i++) { cmbUsers.Items.Add(ipUsers.get_Item(i).UserName); } cmbUsers.SelectedIndex = 0; }
private void PopulateJobTypes(IJTXConfiguration2 ipJTXConfig) { IJTXJobTypeSet ipJobTypes = ipJTXConfig.JobTypes; for (int i = 0; i < ipJobTypes.Count; i++) { cmbJobTypes.Items.Add(ipJobTypes.get_Item(i).Name); } cmbJobTypes.SelectedIndex = 0; }
private void PopulateGroups(IJTXConfiguration2 ipJTXConfig) { IJTXUserGroupSet ipGroups = ipJTXConfig.UserGroups; for (int i = 0; i < ipGroups.Count; i++) { cmbGroups.Items.Add(ipGroups.get_Item(i).Name); } cmbGroups.SelectedIndex = 0; }
private void PopulateStatusTypes(IJTXConfiguration2 ipJTXConfig) { IJTXStatusSet ipStatuses = ipJTXConfig.Statuses; for (int i = 0; i < ipStatuses.Count; i++) { cboDependentStatus.Items.Add(ipStatuses.get_Item(i).Name); } cboDependentStatus.SelectedIndex = 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); // 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 int iJobTypeID = Convert.ToInt32(strTemp); IJTXJobType ipJobType = ipJTXConfig.GetJobTypeByID(iJobTypeID); 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; cmbGroups.SelectedItem = 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; cmbUsers.SelectedItem = strTemp; } // Show the dialog this.ShowDialog(); argsOut = m_Arguments.ToArray(); return(DialogResult); }
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(); } }
/// <summary> /// Executes the requested Report /// </summary> /// <param name="pJTXConfig"></param> /// <param name="iReportID"></param> /// <returns></returns> public string RunReport(IJTXConfiguration2 pJTXConfig, int iReportID) { string sReportOutput = ""; IJTXReportManager pReportManager = pJTXConfig.ReportManager; IJTXReportSet pReports = pReportManager.GetReports(); if (pReports.Count == 0) { Console.WriteLine("No reports configured in the JTX system"); return ""; } pReports.Reset(); for (int a = 0; a < pReports.Count; a++) { IJTXReport pReport = pReports.Next(); if (pReport.ID == iReportID) { sReportOutput = pReport.GenerateFormattedReport(); return sReportOutput; } } return ""; }
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); }