Esempio n. 1
0
        private void OnStatusPropChange(CswNbtNodeProp NodeProp, bool Creating)
        {
            switch (Status.Value)
            {
            case CswEnumNbtInspectionStatus.Completed:
            case CswEnumNbtInspectionStatus.CompletedLate:
                if (_InspectionState.Deficient)
                {
                    Status.Value = CswEnumNbtInspectionStatus.ActionRequired;
                }
                else
                {
                    _toggleButtonVisibility(Finish, IsVisible: false, SaveToDb: true);
                    _toggleButtonVisibility(SetPreferred, IsVisible: false, SaveToDb: true);
                    _toggleButtonVisibility(Cancel, IsVisible: false, SaveToDb: true);
                    Node.setReadOnly(value: true, SaveToDb: true);
                }
                break;

            case CswEnumNbtInspectionStatus.Cancelled:
            case CswEnumNbtInspectionStatus.Missed:
                //InspectionDate.DateTimeValue = DateTime.Now;
                _toggleButtonVisibility(Finish, IsVisible: false, SaveToDb: true);
                _toggleButtonVisibility(SetPreferred, IsVisible: false, SaveToDb: true);
                _toggleButtonVisibility(Cancel, IsVisible: false, SaveToDb: true);
                Node.setReadOnly(value: true, SaveToDb: true);
                break;

            case CswEnumNbtInspectionStatus.ActionRequired:
                _toggleButtonVisibility(Finish, IsVisible: true, SaveToDb: true);
                _toggleButtonVisibility(SetPreferred, IsVisible: false, SaveToDb: true);
                _toggleButtonVisibility(Cancel, IsVisible: true, SaveToDb: true);
                Node.setReadOnly(value: false, SaveToDb: true);
                break;

            case CswEnumNbtInspectionStatus.Overdue:
            case CswEnumNbtInspectionStatus.Pending:
                _toggleButtonVisibility(Finish, IsVisible: true, SaveToDb: true);
                _toggleButtonVisibility(SetPreferred, IsVisible: true, SaveToDb: true);
                _toggleButtonVisibility(Cancel, IsVisible: true, SaveToDb: true);
                Node.setReadOnly(value: false, SaveToDb: true);
                break;
            } // switch( Status.Value )

            CswNbtNode ParentNode = _CswNbtResources.Nodes.GetNode(this.Parent.RelatedNodeId);

            if (ParentNode != null && false == IsTemp)
            {
                ICswNbtPropertySetInspectionParent ParentAsParent = CswNbtPropSetCaster.AsPropertySetInspectionParent(ParentNode);
                bool IsDeficient = areMoreActionsRequired();  //case 25041

                String OKStatus = (ParentAsParent.Status.Value == CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Not_Inspected) &&
                                   Status.Value == CswEnumNbtInspectionStatus.Pending || Status.Value == CswEnumNbtInspectionStatus.Overdue) ?
                                  CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Not_Inspected) : CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.OK);
                ParentAsParent.Status.Value = IsDeficient ? CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Deficient) : OKStatus;
                //Parent.LastInspectionDate.DateTimeValue = DateTime.Now;
                ParentNode.postChanges(false);
            } // if( ParentNode != null )
        }     // OnStatusPropChange()
Esempio n. 2
0
        } //afterWriteNode()

        public override void beforePropertySetDeleteNode()
        {
            //case 26113: check parent for bad inspections
            CswNbtNode ParentNode = _CswNbtResources.Nodes.GetNode(this.Parent.RelatedNodeId);

            if (null != ParentNode)
            {
                ICswNbtPropertySetInspectionParent ParentAsParent = CswNbtPropSetCaster.AsPropertySetInspectionParent(ParentNode);
                //CswNbtObjClassInspectionTarget pnodeAsTarget = (CswNbtObjClassInspectionTarget) ParentNode;
                bool _alreadyDeficient = (ParentAsParent.Status.Value == CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Deficient));
                bool _Deficient        = areMoreActionsRequired();
                if (_Deficient != _alreadyDeficient)
                {
                    ParentAsParent.Status.Value = _Deficient ? CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.Deficient) : CswEnumNbtInspectionTargetStatus.TargetStatusAsString(CswEnumNbtInspectionTargetStatus.TargetStatus.OK);
                    ParentNode.postChanges(false);
                }
            }
        } //beforeDeleteNode()