private bool _canViewProp(int NodeTypePropId, CswPrimaryKey PermissionGroupId)
        {
            CswNbtMetaDataNodeTypeProp NTProp = _CswNbtResources.MetaData.getNodeTypeProp(NodeTypePropId);

            // Must have permission to at least one tab where this property appears
            Dictionary <Int32, CswNbtMetaDataNodeTypeLayoutMgr.NodeTypeLayout> EditLayouts = NTProp.getEditLayouts();
            bool canView = EditLayouts.Values.Aggregate(false,
                                                        (current, EditLayout) => current || _CswNbtResources.Permit.canTab(
                                                            CswEnumNbtNodeTypePermission.View,
                                                            NTProp.getNodeType(),
                                                            _CswNbtResources.MetaData.getNodeTypeTab(EditLayout.TabId)));

            #region Container Request Button Inventory Group Permission

            if (canView)
            {
                CswNbtMetaDataObjectClass ContainerClass = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);
                if (null != ContainerClass)
                {
                    CswNbtMetaDataObjectClassProp RequestProp = _CswNbtResources.MetaData.getObjectClassProp(ContainerClass.ObjectClassId, CswNbtObjClassContainer.PropertyName.Request);
                    if (NTProp.ObjectClassPropId == RequestProp.PropId)
                    {
                        if (_CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.Requesting))
                        {
                            canView = CswNbtObjClassContainer.canContainer(_CswNbtResources, _CswNbtResources.Actions[CswEnumNbtActionName.Submit_Request], PermissionGroupId);
                        }
                        else
                        {
                            canView = false; // case 31851
                        }
                    }
                }
            }

            #endregion

            #region Material Receive Button View Permission

            if (canView)
            {
                CswNbtMetaDataObjectClass MaterialClass = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ChemicalClass);
                if (null != MaterialClass)
                {
                    CswNbtMetaDataObjectClassProp RequestProp = _CswNbtResources.MetaData.getObjectClassProp(MaterialClass.ObjectClassId, CswNbtPropertySetMaterial.PropertyName.Receive);
                    if (NTProp.ObjectClassPropId == RequestProp.PropId)
                    {
                        canView = _CswNbtResources.Permit.can(CswEnumNbtActionName.Receiving);
                    }
                }
            }

            #endregion

            return(canView);
        }
예제 #2
0
 /// <summary>
 /// Checks permission and disposes a container (does not post changes!)
 /// </summary>
 public void Dispose(bool OverridePermissions = false)
 {
     if (OverridePermissions || CswNbtObjClassContainer.canContainer(_CswNbtResources, _CswNbtResources.Actions[CswEnumNbtActionName.DisposeContainer], _Container.getPermissionGroupId()))
     {
         _ContainerDispenseTransactionBuilder.create(CswEnumNbtContainerDispenseType.Dispose, -_Container.Quantity.Quantity, _Container.Quantity.UnitId, SrcContainer: _Container);
         _Container.Quantity.Quantity = 0;
         _Container.Disposed.Checked  = CswEnumTristate.True;
         _Container.CreateContainerLocationNode(CswEnumNbtContainerLocationTypeOptions.Dispose);
         _Container.Node.IconFileNameOverride = "x.png";
         _Container.Node.Searchable           = false;
     }
 }
예제 #3
0
        /// <summary>
        /// Checks permission and undisposes a container (does not post changes!)
        /// </summary>
        public void Undispose(bool OverridePermissions = false, bool CreateContainerLocation = true)
        {
            if (OverridePermissions || CswNbtObjClassContainer.canContainer(_CswNbtResources, _CswNbtResources.Actions[CswEnumNbtActionName.UndisposeContainer], _Container.getPermissionGroupId()))
            {
                CswNbtObjClassContainerDispenseTransaction ContDispTransNode = _getMostRecentDisposeTransaction(_Container.NodeId);

                if (ContDispTransNode != null)
                {
                    _Container.Quantity.Quantity = -ContDispTransNode.QuantityDispensed.Quantity;
                    _Container.Quantity.UnitId   = ContDispTransNode.QuantityDispensed.UnitId;
                    ContDispTransNode.Node.delete(OverridePermissions: true);
                }
                _Container.Disposed.Checked = CswEnumTristate.False;

                if (CreateContainerLocation)
                {
                    _Container.CreateContainerLocationNode(CswEnumNbtContainerLocationTypeOptions.Undispose);
                }
                _Container.Node.IconFileNameOverride = "";
            }
        }