//Update()

        private void _markRoleAsDemoData( string RoleName )
        {
            CswNbtObjClassRole RoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( RoleName );
            if( null != RoleNode )
            {
                RoleNode.IsDemo = true;
                RoleNode.postChanges( false );
            }
        }
        private void _createViewOnlyRole( CswNbtMetaDataNodeType RoleNodeType )
        {
            CswNbtObjClassRole ViewOnlyNode = _createRole( RoleNodeType, "CISPro_View_Only" );

            _setGenericPermissions( ViewOnlyNode, ViewPermissions );
            _setCISProPermissions( ViewOnlyNode, ViewPermissions );

            ViewOnlyNode.postChanges( false );
            _createInventoryGroupPermission( ViewOnlyNode, Tristate.False, Tristate.False );
        }
        public override void update()
        {
            CswNbtObjClassRole NodeAsRole = _CswNbtSchemaModTrnsctn.Nodes.makeRoleNodeFromRoleName( "Dispenser" );
            if( null != NodeAsRole )
            {
                NodeAsRole.Name.Text = "CISPro_Dispenser";
                NodeAsRole.postChanges( true );
            }

        }//Update()
 private CswNbtObjClassRole _createRole( CswNbtMetaDataNodeType RoleNodeType, string RoleName )
 {
     CswNbtObjClassRole RoleNode = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( RoleNodeType.NodeTypeId, CswEnumNbtMakeNodeOperation.WriteNode );
     RoleNode.Name.Text = RoleName;
     RoleNode.Timeout.Value = 30;
     CswEnumNbtNodeTypePermission[] ViewPermissions = { CswEnumNbtNodeTypePermission.View };
     foreach( CswNbtMetaDataNodeType NodeType in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes() )
     {
         bool canView = false == ( NodeType.NodeTypeName == "Role" || NodeType.NodeTypeName == "User" );
         _CswNbtSchemaModTrnsctn.Permit.set( ViewPermissions, NodeType, RoleNode, canView );
     }
     RoleNode.postChanges( false );
     return RoleNode;
 }
        private void _createGeneralRole( CswNbtMetaDataNodeType RoleNodeType )
        {
            CswNbtObjClassRole GeneralNode = _createRole( RoleNodeType, "CISPro_General" );

            _setGenericPermissions( GeneralNode, ViewPermissions );
            _setCISProPermissions( GeneralNode, ViewPermissions );
            _setNodeTypePermissions( GeneralNode, CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass, FullPermissions );

            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DispenseContainer, GeneralNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DisposeContainer, GeneralNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Submit_Request, GeneralNode, true );

            GeneralNode.postChanges( false );
            _createInventoryGroupPermission( GeneralNode, Tristate.True, Tristate.False );
        }
Exemplo n.º 6
0
        private CswNbtResources _testInit(string RoleName, string UserName, CswEnumTristate IsAdmin, CswEnumNbtNodeTypePermission Permission, bool PermissionValue)
        {
            CswNbtSdResourcesMgr ResourcesMgr = new CswNbtSdResourcesMgr(_TestData.CswNbtResources);
            CswNbtObjClassRole   Role         = _TestData.CswNbtResources.Nodes[ResourcesMgr.makeNewRole(RoleName)];
            CswNbtResources      Ret          = null;

            if (null != Role)
            {
                Role.Administrator.Checked = IsAdmin;
                _TestData.CswNbtResources.Permit.set(Permission, _SprocketNt, Role, PermissionValue);
                Role.postChanges(ForceUpdate: false);
                _TestData.CswNbtResources.finalize();

                Ret = ResourcesMgr.makeNewUserResources(UserName, Role.NodeId);
            }
            return(Ret);
        }
Exemplo n.º 7
0
 public void set(CswNbtAction Action, CswNbtObjClassRole Role, bool value)
 {
     if (Role != null)
     {
         //Role.ActionPermissions.SetValue( CswNbtAction.PermissionXValue.ToString(), CswNbtAction.ActionNameEnumToString( ActionName ), value );
         //Role.ActionPermissions.Save();
         if (value)
         {
             Role.ActionPermissions.AddValue(CswNbtObjClassRole.MakeActionPermissionValue(Action));
         }
         else
         {
             Role.ActionPermissions.RemoveValue(CswNbtObjClassRole.MakeActionPermissionValue(Action));
         }
         Role.postChanges(false);
     }
 } // set( CswNbtActionName ActionName, ICswNbtUser User, bool value )
Exemplo n.º 8
0
 public void set(CswEnumNbtNodeTypePermission Permission, CswNbtMetaDataNodeType NodeType, CswNbtObjClassRole Role, bool value)
 {
     if (Role != null)
     {
         //Role.NodeTypePermissions.SetValue( NodeTypePermission.ToString(), NodeType.FirstVersionNodeTypeId.ToString(), value );
         //Role.NodeTypePermissions.Save();
         if (value)
         {
             Role.NodeTypePermissions.AddValue(CswNbtObjClassRole.MakeNodeTypePermissionValue(NodeType.FirstVersionNodeTypeId, Permission));
         }
         else
         {
             Role.NodeTypePermissions.RemoveValue(CswNbtObjClassRole.MakeNodeTypePermissionValue(NodeType.FirstVersionNodeTypeId, Permission));
         }
         Role.postChanges(false);
     }
 } // set( NodeTypePermission NodeTypePermission, CswNbtMetaDataNodeType NodeType, ICswNbtUser Role, bool value )
        private void _createReceiverRole( CswNbtMetaDataNodeType RoleNodeType )
        {
            CswNbtObjClassRole ReceiverNode = _createRole( RoleNodeType, "CISPro_Receiver" );

            _setGenericPermissions( ReceiverNode, ViewPermissions );
            _setCISProPermissions( ReceiverNode, ViewPermissions );
            _setNodeTypePermissions( ReceiverNode, CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass, FullPermissions );
            _setNodeTypePermissions( ReceiverNode, CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass, FullPermissions );
            _setNodeTypePermissions( ReceiverNode, CswNbtMetaDataObjectClass.NbtObjectClass.SizeClass, FullPermissions );
            _setNodeTypePermissions( ReceiverNode, CswNbtMetaDataObjectClass.NbtObjectClass.VendorClass, FullPermissions );

            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DispenseContainer, ReceiverNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DisposeContainer, ReceiverNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Receiving, ReceiverNode, true );

            ReceiverNode.postChanges( false );
            _createInventoryGroupPermission( ReceiverNode, Tristate.False, Tristate.True );
        }
Exemplo n.º 10
0
        private void _createAdminRole( CswNbtMetaDataNodeType RoleNodeType )
        {
            CswNbtObjClassRole AdminNode = _createRole( RoleNodeType, "CISPro_Admin" );
            AdminNode.Administrator.Checked = Tristate.True;

            _setGenericPermissions( AdminNode, FullPermissions );
            _setCISProPermissions( AdminNode, FullPermissions );

            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Create_Material, AdminNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DispenseContainer, AdminNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DisposeContainer, AdminNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Receiving, AdminNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Submit_Request, AdminNode, true );
            //_CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Fulfill_Request, AdminNode, true );
            _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.UndisposeContainer, AdminNode, true );

            AdminNode.postChanges( false );
            _createInventoryGroupPermission( AdminNode, Tristate.True, Tristate.True );
        }
Exemplo n.º 11
0
        public override void update()
        {
            CswNbtMetaDataObjectClass RequestItemOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestItemClass );
            CswNbtMetaDataObjectClassProp TypeOcp = RequestItemOc.getObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Type );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( TypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.isrequired, true );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( TypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.servermanaged, true );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( TypeOcp, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.setvalonadd, false );
            _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( TypeOcp, TypeOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassRequestItem.Types.Request );

            CswNbtMetaDataObjectClass RequestOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestClass );
            CswNbtMetaDataObjectClassProp RequestGroupOcp = RequestOc.getObjectClassProp( CswNbtObjClassRequest.PropertyName.InventoryGroup.ToString() );
            CswNbtMetaDataObjectClassProp RequestOcp = RequestItemOc.getObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Request );
            _CswNbtSchemaModTrnsctn.createObjectClassProp( new CswNbtWcfMetaDataModel.ObjectClassProp( RequestItemOc )
                {
                    PropName = CswNbtObjClassRequestItem.PropertyName.InventoryGroup,
                    FieldType = CswNbtMetaDataFieldType.NbtFieldType.PropertyReference,
                    IsFk = true,
                    FkType = NbtViewPropIdType.ObjectClassPropId.ToString(),
                    FkValue = RequestOcp.PropId,
                    ValuePropId = RequestGroupOcp.PropId,
                    ValuePropType = NbtViewPropIdType.ObjectClassPropId.ToString()
                } );
            
            foreach( CswNbtMetaDataNodeType RequestItemNt in RequestItemOc.getLatestVersionNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp TypeNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Type );
                TypeNtp.removeFromLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Add );

                CswNbtMetaDataNodeTypeProp StatusNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Status );
                CswNbtMetaDataNodeTypeProp MaterialNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Material );
                CswNbtMetaDataNodeTypeProp NumberNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Number );
                CswNbtMetaDataNodeTypeProp OrderNoNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.ExternalOrderNumber );
                CswNbtMetaDataNodeTypeProp FulfillNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Fulfill );
                CswNbtMetaDataNodeTypeProp RequestNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Request );
                CswNbtMetaDataNodeTypeProp IGroupNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.InventoryGroup );
                CswNbtMetaDataNodeTypeProp TotalDispNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.TotalDispensed );
                
                NumberNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 1, DisplayColumn: 1 );
                MaterialNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 1, DisplayColumn: 2 );
                RequestNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 2, DisplayColumn: 1 );
                OrderNoNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 2, DisplayColumn: 2 );
                IGroupNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 3, DisplayColumn: 1 );
                StatusNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 4, DisplayColumn: 1 );
                TotalDispNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 4, DisplayColumn: 2 );
                FulfillNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Table, true, DisplayRow: 5, DisplayColumn: 1 );

                CswNbtMetaDataNodeTypeProp RequestByNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.RequestBy );
                CswNbtMetaDataNodeTypeProp SizeNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Size );
                CswNbtMetaDataNodeTypeProp CountNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Count );
                CswNbtMetaDataNodeTypeProp QuantityNtp = RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Quantity );

                RequestByNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 1, DisplayColumn: 1 );
                CountNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 2, DisplayColumn: 1 );
                SizeNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 2, DisplayColumn: 2 );
                QuantityNtp.updateLayout( CswNbtMetaDataNodeTypeLayoutMgr.LayoutType.Preview, true, DisplayRow: 3, DisplayColumn: 1 );
            }

            CswNbtMetaDataObjectClass RoleOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RoleClass );
            CswNbtMetaDataObjectClass UserOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.UserClass );
            CswNbtMetaDataNodeType RoleNt = RoleOc.getLatestVersionNodeTypes().FirstOrDefault();
            if( null != RoleNt )
            {
                CswNbtObjClassRole NodeAsRole = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( RoleNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                if( null != NodeAsRole )
                {
                    NodeAsRole.Name.Text = "CISPro_Dispenser";
                    NodeAsRole.postChanges( true );
                    
                    CswNbtMetaDataObjectClass MaterialOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass );
                    foreach( CswNbtMetaDataNodeType MaterialNt in MaterialOc.getLatestVersionNodeTypes() )
                    {
                        _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.View, MaterialNt, NodeAsRole, true );
                        _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Create, MaterialNt, NodeAsRole, true );
                    }

                    CswNbtMetaDataObjectClass ContainerOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass );
                    foreach( CswNbtMetaDataNodeType ContainerNt in ContainerOc.getLatestVersionNodeTypes() )
                    {
                        _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.View, ContainerNt, NodeAsRole, true );
                        _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Create, ContainerNt, NodeAsRole, true );
                        _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Edit, ContainerNt, NodeAsRole, true );
                        _CswNbtSchemaModTrnsctn.Permit.set( CswNbtPermit.NodeTypePermission.Delete, ContainerNt, NodeAsRole, true );
                    }

                    _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Receiving, NodeAsRole, true );
                    _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DispenseContainer, NodeAsRole, true );
                    _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.DisposeContainer, NodeAsRole, true );
                    _CswNbtSchemaModTrnsctn.Permit.set( CswNbtActionName.Submit_Request, NodeAsRole, true );

                    CswNbtMetaDataNodeType UserNt = UserOc.getLatestVersionNodeTypes().FirstOrDefault();
                    if( null != UserNt )
                    {
                        CswNbtObjClassUser NodeAsUser = _CswNbtSchemaModTrnsctn.Nodes.makeNodeFromNodeTypeId( UserNt.NodeTypeId, CswNbtNodeCollection.MakeNodeOperation.WriteNode );
                        if( null != NodeAsUser )
                        {
                            NodeAsUser.Role.RelatedNodeId = NodeAsRole.NodeId;
                            NodeAsUser.UsernameProperty.Text = "dispenser";
                            NodeAsUser.postChanges( true );
                        }
                    }
                }
            }

        }//Update()