Esempio n. 1
0
        private void _genFutureNodes()
        {
            if (CswEnumTristate.True != this.IsFuture.Checked &&
                CswTools.IsPrimaryKey(this.Generator.RelatedNodeId) &&
                false == _genFutureNodesHasRun &&
                _CswNbtResources.ConfigVbls.getConfigVariableValue(CswEnumNbtConfigurationVariables.miss_outdated_inspections.ToString()) == "1")
            {
                String NodeStatus = String.Empty;
                CswNbtMetaDataNodeType ThisInspectionNT = this.Node.getNodeTypeLatestVersion();
                if (null != ThisInspectionNT)
                {
                    _genFutureNodesHasRun = true;
                    //Limit collection to Inspections on the same Generator
                    IEnumerable <CswNbtNode> AllNodesOfThisNT = ThisInspectionNT.getNodes(true, true)
                                                                .Where(InspectionNode => this.Generator.RelatedNodeId == InspectionNode.Properties[PropertyName.Generator].AsRelationship.RelatedNodeId);
                    foreach (CswNbtNode InspectionNode in AllNodesOfThisNT)
                    {
                        CswNbtObjClassInspectionDesign PriorInspection = (CswNbtObjClassInspectionDesign)InspectionNode;
                        NodeStatus = PriorInspection.Status.Value;

                        if ( //Inspection status is Pending, Overdue or not set
                            (CswEnumNbtInspectionStatus.Overdue == NodeStatus ||
                             CswEnumNbtInspectionStatus.Pending == NodeStatus ||
                             String.Empty == NodeStatus) &&
                            //Inspections have the same target, and we're comparing different Inspection nodes
                            (this.Target.RelatedNodeId == InspectionNode.Properties[PropertyName.Target].AsRelationship.RelatedNodeId &&
                             this.Node != InspectionNode) &&
                            // Other inspection isn't future (case 28317)
                            CswEnumTristate.True != PriorInspection.IsFuture.Checked
                            // Inspection is older than this one (case 30926)
                            && this.CreatedDate.DateTimeValue > PriorInspection.CreatedDate.DateTimeValue)
                        {
                            PriorInspection.Status.Value = CswEnumNbtInspectionStatus.Missed.ToString();
                            // Case 20755
                            PriorInspection.postChanges(true);
                        }
                    }
                }
            }
        }