Example #1
0
        protected override void OnEnable()
        {
            //Show the following Container properties...
            //   Requests
            //   Submitted Requests
            CswNbtMetaDataObjectClass ContainerOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);

            foreach (int NodeTypeId in ContainerOC.getNodeTypeIds().Keys)
            {
                _CswNbtResources.Modules.ShowProp(NodeTypeId, CswNbtObjClassContainer.PropertyName.Request);
                _CswNbtResources.Modules.ShowProp(NodeTypeId, CswNbtObjClassContainer.PropertyName.SubmittedRequests);
            }

            //Show the following Inventory Group properties...
            //   Limit Request Delivery Location
            CswNbtMetaDataObjectClass InventoryGroupOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.InventoryGroupClass);

            foreach (int NodeTypeId in InventoryGroupOC.getNodeTypeIds().Keys)
            {
                _CswNbtResources.Modules.ShowProp(NodeTypeId, CswNbtObjClassInventoryGroup.PropertyName.LimitRequestDeliveryLocation);
            }

            //Show the following Location properties...
            //   Request Delivery Location
            CswNbtMetaDataObjectClass LocationOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);

            foreach (int NodeTypeId in LocationOC.getNodeTypeIds().Keys)
            {
                _CswNbtResources.Modules.ShowProp(NodeTypeId, CswNbtObjClassLocation.PropertyName.RequestDeliveryLocation);
            }

            //Show the following Material properties...
            //   Request Button
            CswNbtMetaDataPropertySet MaterialSet = _CswNbtResources.MetaData.getPropertySet(CswEnumNbtPropertySetName.MaterialSet);

            foreach (CswNbtMetaDataObjectClass MaterialOC in MaterialSet.getObjectClasses())
            {
                foreach (int NodeTypeId in MaterialOC.getNodeTypeIds().Keys)
                {
                    _CswNbtResources.Modules.ShowProp(NodeTypeId, CswNbtObjClassChemical.PropertyName.Request);
                }
            }

            //Show all views in the Requests category
            _CswNbtResources.Modules.ToggleViewsInCategory(false, "Requests", CswEnumNbtViewVisibility.Global);

            //Show the request fulfiller Role/User
            _CswNbtResources.Modules.ToggleRoleNodes(false, "request_fulfiller");
            _CswNbtResources.Modules.ToggleUserNodes(false, "request_fulfiller");
            //TODO - Case 31274 - Add CISPro_Guardian Role/User to this list

            // Case 28930 - Enable Scheduled Rules
            _CswNbtResources.Modules.ToggleScheduledRule(CswEnumNbtScheduleRuleNames.GenRequest, Disabled: false);

            //Case 31546 - If we're enabling Requesting AFTER MLM, we need to show the MLM props
            if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.MLM))
            {
                CswNbtObjClassRequestItem.ToggleMLMProps(_CswNbtResources, false);
            }
        }
        } // OnEnable()

        protected override void OnDisable()
        {
            //Turn on off views in the MLM (demo) category
            _CswNbtResources.Modules.ToggleViewsInCategory(true, "MLM (demo)", CswEnumNbtViewVisibility.Global);

            //Case 27866 on disable hide Container props...
            //   Lot Controlled
            //   Requisitionable
            //   Reserved For
            CswNbtMetaDataObjectClass containerOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);

            foreach (CswNbtMetaDataNodeType containerNT in containerOC.getNodeTypes())
            {
                _CswNbtResources.Modules.HideProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.LotControlled);
                _CswNbtResources.Modules.HideProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.Requisitionable);
                _CswNbtResources.Modules.HideProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.ReservedFor);
                //if( null != cmgTab )
                //{
                //    cmgTab.DesignNode.Node.delete( false, true );
                //}
            }

            //Case 31546 - If requesting is disabled, we don't need to hide anything on the Request Item OC because it is not available
            if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Requesting))
            {
                CswNbtObjClassRequestItem.ToggleMLMProps(_CswNbtResources, true);
            }

            //Case 28339
            //   Hide Vendor.VendorType and CorporateEntity
            //   Remove filter on Material.Supplier
            CswNbtMetaDataObjectClass vendorOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.VendorClass);

            foreach (CswNbtMetaDataNodeType vendorNT in vendorOC.getNodeTypes())
            {
                _CswNbtResources.Modules.HideProp(vendorNT.NodeTypeId, CswNbtObjClassVendor.PropertyName.VendorTypeName);
                _CswNbtResources.Modules.HideProp(vendorNT.NodeTypeId, CswNbtObjClassVendor.PropertyName.CorporateEntityName);
            }

            CswNbtView newSupplierPropView = new CswNbtView(_CswNbtResources);

            newSupplierPropView.saveNew("Supplier", CswEnumNbtViewVisibility.Property);
            newSupplierPropView.AddViewRelationship(vendorOC, true);
            newSupplierPropView.save();

            _toggleMaterialSupplierView(true);
            _toggleReceiptLotManufacturerView(true);

            //Case CIS-52280 on disable hide Material props...
            //   Manufacturing Sites Grid
            //   Requires Cleaning Event
            CswNbtMetaDataPropertySet materialPS = _CswNbtResources.MetaData.getPropertySet(CswEnumNbtPropertySetName.MaterialSet);

            foreach (CswNbtMetaDataObjectClass materialOC in materialPS.getObjectClasses())
            {
                foreach (CswNbtMetaDataNodeType materialNT in materialOC.getNodeTypes())
                {
                    _CswNbtResources.Modules.HideProp(materialNT.NodeTypeId, CswNbtPropertySetMaterial.PropertyName.ManufacturingSites);
                    _CswNbtResources.Modules.HideProp(materialNT.NodeTypeId, CswNbtPropertySetMaterial.PropertyName.RequiresCleaningEvent);
                }
            }

            setReceiptLotPermissions(_CswNbtResources, false);
        } // OnDisable()
        protected override void OnEnable()
        {
            //Turn on all views in the MLM (demo) category
            _CswNbtResources.Modules.ToggleViewsInCategory(false, "MLM (demo)", CswEnumNbtViewVisibility.Global);

            //Case 27866/28156 on enable show Container props...
            //   Lot Controlled
            //   Requisitionable
            //   Reserved For
            //   Receipt Lot
            CswNbtMetaDataObjectClass containerOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);

            foreach (CswNbtMetaDataNodeType containerNT in containerOC.getNodeTypes())
            {
                _CswNbtResources.Modules.ShowProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.LotControlled);
                _CswNbtResources.Modules.ShowProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.Requisitionable);
                _CswNbtResources.Modules.ShowProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.ReservedFor);
                //Case 30723 - Receipt Lot is only "semi-disabled" when MLM is off, so just add it back to the layout when it's enabled
                CswNbtMetaDataNodeTypeProp ReceiptLotNTP = _CswNbtResources.MetaData.getNodeTypeProp(containerNT.NodeTypeId, CswNbtObjClassContainer.PropertyName.ReceiptLot);
                if (null != ReceiptLotNTP)
                {
                    CswNbtMetaDataNodeTypeProp StatusNTP = containerNT.getNodeTypePropByObjectClassProp(CswNbtObjClassContainer.PropertyName.Status);
                    ReceiptLotNTP.updateLayout(CswEnumNbtLayoutType.Edit, StatusNTP, true);
                }
            }

            //Case 31546 - If requesting is disabled, we don't need to show anything on the Request Item OC because it is not available
            if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Requesting))
            {
                CswNbtObjClassRequestItem.ToggleMLMProps(_CswNbtResources, false);
            }

            //Case 28339
            //   Show Vendor.VendorType and CorporateEntity
            //   Add a filter to Material.Supplier where VendorType = 'Coporate'
            CswNbtMetaDataObjectClass vendorOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.VendorClass);

            foreach (CswNbtMetaDataNodeType vendorNT in vendorOC.getNodeTypes())
            {
                _CswNbtResources.Modules.ShowProp(vendorNT.NodeTypeId, CswNbtObjClassVendor.PropertyName.VendorTypeName);
                _CswNbtResources.Modules.ShowProp(vendorNT.NodeTypeId, CswNbtObjClassVendor.PropertyName.CorporateEntityName);
            }

            _toggleMaterialSupplierView(false);
            _toggleReceiptLotManufacturerView(false);

            setReceiptLotPermissions(_CswNbtResources, true);

            //Case CIS-52280 on enable show Material props...
            //   Manufacturing Sites Grid
            //   Requires Cleaning Event
            CswNbtMetaDataPropertySet materialPS = _CswNbtResources.MetaData.getPropertySet(CswEnumNbtPropertySetName.MaterialSet);

            foreach (CswNbtMetaDataObjectClass materialOC in materialPS.getObjectClasses())
            {
                foreach (CswNbtMetaDataNodeType materialNT in materialOC.getNodeTypes())
                {
                    _CswNbtResources.Modules.ShowProp(materialNT.NodeTypeId, CswNbtPropertySetMaterial.PropertyName.ManufacturingSites);
                    _CswNbtResources.Modules.ShowProp(materialNT.NodeTypeId, CswNbtPropertySetMaterial.PropertyName.RequiresCleaningEvent);
                }
            }
        } // OnEnable()