Exemplo n.º 1
0
        //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);
        }
Exemplo n.º 2
0
        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()