//Determine the number of inspections to update and return that value public Int32 getLoadCount(ICswResources CswResources) { _CswScheduleLogicNodes = new CswScheduleLogicNodes(( CswNbtResources )CswResources); Collection <CswNbtObjClassInspectionDesign> InspectionDesigns = _CswScheduleLogicNodes.getInspectonDesigns(); return(InspectionDesigns.Count); }
private void _setLoad(ICswResources CswResources) { _StatusMessage = string.Empty; _TotalGeneratorsProcessed = 0; _CswScheduleLogicNodes = new CswScheduleLogicNodes((CswNbtResources)CswResources); foreach (CswNbtObjClassGenerator Generator in _CswScheduleLogicNodes.getGenerators()) { if (_doesGeneratorRunNow(Generator)) { _GeneratorPks.Add(Generator.NodeId); } } }
public void threadCallBack(ICswResources CswResources) { _LogicRunStatus = CswEnumScheduleLogicRunStatus.Running; CswNbtResources CswNbtResources = (CswNbtResources)CswResources; _CswScheduleLogicNodes = new CswScheduleLogicNodes(CswNbtResources); CswNbtResources.AuditContext = "Scheduler Task: " + RuleName; if (CswEnumScheduleLogicRunStatus.Stopping != _LogicRunStatus) { try { Int32 TotalProcessed = 0; string Names = string.Empty; Collection <CswNbtObjClassInspectionDesign> InspectionDesigns = _CswScheduleLogicNodes.getInspectonDesigns(); for (Int32 idx = 0; (idx < InspectionDesigns.Count) && (CswEnumScheduleLogicRunStatus.Stopping != _LogicRunStatus); idx++) { CswNbtObjClassInspectionDesign CurrentInspectionDesign = InspectionDesigns[idx]; CurrentInspectionDesign.Status.Value = _Overdue; CurrentInspectionDesign.postChanges(ForceUpdate: true); TotalProcessed++; Names += CurrentInspectionDesign.Name + "; "; } _CswScheduleLogicDetail.StatusMessage = TotalProcessed.ToString() + " inspections processed: " + Names; _LogicRunStatus = CswEnumScheduleLogicRunStatus.Succeeded; //last line }//try catch (Exception Exception) { _CswScheduleLogicDetail.StatusMessage = "CswScheduleLogicNbtUpdtInspection::threadCallBack() exception: " + Exception.Message + "; " + Exception.StackTrace; CswNbtResources.logError(new CswDniException(_CswScheduleLogicDetail.StatusMessage)); _LogicRunStatus = CswEnumScheduleLogicRunStatus.Failed; } //catch } //if we're not shutting down _CswScheduleLogicDetail.StatusMessage = "Completed without error"; }//threadCallBack()
public void threadCallBack(ICswResources CswResources) { _LogicRunStatus = CswEnumScheduleLogicRunStatus.Running; CswNbtResources CswNbtResources = (CswNbtResources)CswResources; CswNbtResources.AuditContext = "Scheduler Task: " + RuleName; _CswScheduleLogicNodes = new CswScheduleLogicNodes(CswNbtResources); try { Int32 GeneratorLimit = CswConvert.ToInt32(CswNbtResources.ConfigVbls.getConfigVariableValue(CswEnumNbtConfigurationVariables.generatorlimit.ToString())); if (Int32.MinValue == GeneratorLimit) { GeneratorLimit = 1; } Int32 GeneratorsProcessed = 0; while (GeneratorsProcessed < GeneratorLimit && _GeneratorPks.Count > 0 && (CswEnumScheduleLogicRunStatus.Stopping != _LogicRunStatus)) { _processGenerator(CswNbtResources, CswNbtResources.Nodes[_GeneratorPks[0]]); GeneratorsProcessed++; _GeneratorPks.RemoveAt(0); } _TotalGeneratorsProcessed += GeneratorsProcessed; _CswScheduleLogicDetail.StatusMessage = _TotalGeneratorsProcessed.ToString() + " generators processed: " + _StatusMessage; _LogicRunStatus = CswEnumScheduleLogicRunStatus.Succeeded; //last line } catch (Exception Exception) { _CswScheduleLogicDetail.StatusMessage = "CswScheduleLogicNbtGenNode::GetUpdatedItems() exception: " + Exception.Message + "; " + Exception.StackTrace; CswNbtResources.logError(new CswDniException(_CswScheduleLogicDetail.StatusMessage)); _LogicRunStatus = CswEnumScheduleLogicRunStatus.Failed; } }//threadCallBack()
private Collection <CswPrimaryKey> _getMailReportsToRun(CswNbtResources _CswNbtResources) { _CswScheduleLogicNodes = new CswScheduleLogicNodes(_CswNbtResources); Collection <CswNbtObjClassMailReport> MailReports = _CswScheduleLogicNodes.getMailReports(); Collection <CswPrimaryKey> MailReportIdsToRun = new Collection <CswPrimaryKey>(); for (Int32 idx = 0; (idx < MailReports.Count); idx++) { CswNbtObjClassMailReport CurrentMailReport = MailReports[idx]; if (null != CurrentMailReport) { try { if (CurrentMailReport.Recipients.SelectedUserIds.Count > 0) { // for notifications, make sure at least one node has changed if (CurrentMailReport.Type.Value != CswNbtObjClassMailReport.TypeOptionView || CurrentMailReport.Event.Value != CswEnumNbtMailReportEventOption.Edit.ToString() || false == String.IsNullOrEmpty(CurrentMailReport.NodesToReport.Text)) { if (false == CurrentMailReport.Type.Empty) { if (_doesMailReportRunNow(CurrentMailReport)) { // Process this mail report and increment (Case 29684) MailReportIdsToRun.Add(CurrentMailReport.NodeId); // Cycle the next due date so we don't make another batch op while this one is running CurrentMailReport.updateNextDueDate(ForceUpdate: true, DeleteFutureNodes: false); CurrentMailReport.postChanges(false); } } // if( false == CurrentMailReport.Type.Empty ) else { CurrentMailReport.RunStatus.AddComment("Report type is not specified"); CurrentMailReport.Enabled.Checked = CswEnumTristate.False; CurrentMailReport.postChanges(true); } } // if there's something to report else { CurrentMailReport.RunStatus.AddComment("No reportable changes made"); CurrentMailReport.updateNextDueDate(ForceUpdate: true, DeleteFutureNodes: false); CurrentMailReport.postChanges(false); } } // if( CurrentMailReport.Recipients.SelectedUserIds.Count > 0 ) else { CurrentMailReport.RunStatus.AddComment("No recipients selected"); CurrentMailReport.Enabled.Checked = CswEnumTristate.False; CurrentMailReport.postChanges(false); } } //try catch (Exception Exception) { _InnerErrorMessage += "An exception occurred: " + Exception.Message + "; "; CurrentMailReport.Enabled.Checked = CswEnumTristate.False; CurrentMailReport.RunStatus.AddComment(_InnerErrorMessage); CurrentMailReport.postChanges(true); } } // if( null != CurrentMailReport ) } // for( Int32 idx = 0; ( idx < MailReports.Count ) && ( LogicRunStatus.Stopping != _LogicRunStatus ); idx++ ) return(MailReportIdsToRun); }