Пример #1
0
        private CswNbtView _getBadSchedulesAndTasksView()
        {
            CswNbtView BadSchedulesView = _CswNbtSchemaModTrnsctn.makeNewView( "29684 - Bad Schedules", CswEnumNbtViewVisibility.Property );
            BadSchedulesView.ViewMode = CswEnumNbtViewRenderingMode.Tree;
            BadSchedulesView.Width = 100;

            CswNbtMetaDataNodeTypeProp AssemblyTargetTypeNTP = AssemblyScheduleNT.getNodeTypePropByObjectClassProp( CswNbtObjClassGenerator.PropertyName.TargetType );
            CswNbtMetaDataNodeTypeProp EquipmentTargetTypeNTP = EquipmentScheduleNT.getNodeTypePropByObjectClassProp( CswNbtObjClassGenerator.PropertyName.TargetType );
            CswNbtMetaDataNodeTypeProp AssemblyScheduleNTP = AssemblyTaskNT.getNodeTypePropByObjectClassProp( CswNbtObjClassTask.PropertyName.Generator );
            CswNbtMetaDataNodeTypeProp EquipmentScheduleNTP = EquipmentTaskNT.getNodeTypePropByObjectClassProp( CswNbtObjClassTask.PropertyName.Generator );

            CswNbtViewRelationship AssemblySchedRel = BadSchedulesView.AddViewRelationship( AssemblyScheduleNT, true );
            CswNbtViewRelationship EquipmentSchedRel = BadSchedulesView.AddViewRelationship( EquipmentScheduleNT, true );
            BadSchedulesView.AddViewRelationship( EquipmentSchedRel, CswEnumNbtViewPropOwnerType.Second, AssemblyScheduleNTP, true );
            BadSchedulesView.AddViewRelationship( AssemblySchedRel, CswEnumNbtViewPropOwnerType.Second, EquipmentScheduleNTP, true );            
            
            CswNbtViewProperty AssemblyTargetTypeVP = BadSchedulesView.AddViewProperty( AssemblySchedRel, AssemblyTargetTypeNTP );
            BadSchedulesView.AddViewPropertyFilter( AssemblyTargetTypeVP,
                CswEnumNbtFilterConjunction.And,
                CswEnumNbtFilterResultMode.Unknown,
                CswEnumNbtSubFieldName.NodeType,
                CswEnumNbtFilterMode.Contains,
                "Equipment" );
            
            CswNbtViewProperty EquipmentTargetTypeVP = BadSchedulesView.AddViewProperty( EquipmentSchedRel, EquipmentTargetTypeNTP );
            BadSchedulesView.AddViewPropertyFilter( EquipmentTargetTypeVP,
                CswEnumNbtFilterConjunction.And,
                CswEnumNbtFilterResultMode.Unknown,
                CswEnumNbtSubFieldName.NodeType,
                CswEnumNbtFilterMode.Contains,
                "Assembly" );          

            return BadSchedulesView;
        }
Пример #2
0
        public override void update()
        {
            CswNbtMetaDataNodeType ControlZoneNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Control Zone" );
            if( null != ControlZoneNt )
            {
                CswNbtMetaDataNodeTypeTab LocationsTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( ControlZoneNt, "Locations", 2 );

                CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass );
                CswNbtMetaDataObjectClassProp ControlZoneOCP =
                    _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( LocationOC.ObjectClassId, CswNbtObjClassLocation.PropertyName.ControlZone );

                CswNbtMetaDataNodeTypeProp LocationsNTP = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( 
                    new CswNbtWcfMetaDataModel.NodeTypeProp( ControlZoneNt, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid ), "Locations" )
                {
                    TabId = LocationsTab.TabId
                } );

                CswNbtView LocationsView = _CswNbtSchemaModTrnsctn.makeNewView( "Control_Zone_Locations", NbtViewVisibility.Property );
                LocationsNTP.ViewId = LocationsView.ViewId;
                LocationsView.Root.ChildRelationships.Clear();
                LocationsView.SetViewMode( NbtViewRenderingMode.Grid );
                LocationsView.Visibility = NbtViewVisibility.Property;

                CswNbtViewRelationship RootRel = LocationsView.AddViewRelationship( ControlZoneNt, true );
                CswNbtViewRelationship LocationRel = LocationsView.AddViewRelationship( RootRel, NbtViewPropOwnerType.Second, ControlZoneOCP, false );
                LocationsView.AddViewProperty( LocationRel, LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Barcode ) );
                LocationsView.AddViewProperty( LocationRel, LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Name ) );
                LocationsView.AddViewProperty( LocationRel, LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.Location ) );
                
                LocationsView.save();      
            }
        }
        public override void update()
        {
            // Create the view
            CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );

            CswNbtMetaDataObjectClass ManufacturerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ManufacturerClass );
            CswNbtMetaDataObjectClassProp MaterialOCP = ManufacturerOC.getObjectClassProp( CswNbtObjClassManufacturer.PropertyName.Material );
            CswNbtMetaDataObjectClassProp ManufacturingSiteOCP = ManufacturerOC.getObjectClassProp( CswNbtObjClassManufacturer.PropertyName.ManufacturingSite );
            CswNbtMetaDataObjectClassProp QualifiedOCP = ManufacturerOC.getObjectClassProp( CswNbtObjClassManufacturer.PropertyName.Qualified );

            CswNbtView ManufacturersView = _CswNbtSchemaModTrnsctn.makeSafeView( "ManufacturingSites", CswEnumNbtViewVisibility.Property );
            ManufacturersView.ViewName = "ManufacturingSites";
            ManufacturersView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            ManufacturersView.Root.ChildRelationships.Clear();

            CswNbtViewRelationship root = ManufacturersView.AddViewRelationship( MaterialPS, false );
            CswNbtViewRelationship relationship = ManufacturersView.AddViewRelationship( root, CswEnumNbtViewPropOwnerType.Second, MaterialOCP, true );

            ManufacturersView.AddViewProperty( relationship, ManufacturingSiteOCP );
            ManufacturersView.AddViewProperty( relationship, QualifiedOCP );

            ManufacturersView.save();

            foreach( CswNbtMetaDataObjectClass MaterialOC in MaterialPS.getObjectClasses() )
            {
                CswNbtMetaDataObjectClassProp GridOCP = MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.ManufacturingSites );
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( GridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ManufacturersView.ToString() );
            }

        } // update()
Пример #4
0
        public CswNbtView getAllRecurringRequestItemsView(bool AddRunTimeFilters = true)
        {
            CswNbtView Ret = new CswNbtView(_CswNbtResources)
            {
                Category   = "Request Configuration",
                Visibility = CswEnumNbtViewVisibility.Hidden,
                ViewMode   = CswEnumNbtViewRenderingMode.Grid,
                ViewName   = RecurringItemsViewName
            };
            //Unlike other Request Items, Recurring requests are not tied to a Request, so they don't have a Name.
            CswNbtViewRelationship RequestItemRel = Ret.AddViewRelationship(_RequestItemOC, IncludeDefaultFilters: false);
            CswNbtViewProperty     DescriptionVP  = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Description), 1);

            DescriptionVP.Width = 40;
            CswNbtViewProperty RecurringFrequencyVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.RecurringFrequency), 2);
            CswNbtViewProperty NextReorderDateVP    = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.NextReorderDate), 3);

            NextReorderDateVP.SortBy = true;
            if (AddRunTimeFilters)
            {
                Ret.AddViewPropertyFilter(NextReorderDateVP, ShowAtRuntime: true);
            }
            Ret.AddViewPropertyAndFilter(RequestItemRel,
                                         _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.IsRecurring),
                                         Value: CswEnumTristate.True.ToString(),
                                         ShowInGrid: false);
            return(Ret);
        }
Пример #5
0
        //takes the default request view, adds items, and filters by favorites
        public CswNbtView getFavoriteRequestsItemsView()
        {
            CswNbtView Ret = new CswNbtView(_CswNbtResources)
            {
                Category       = "Request Configuration",
                Visibility     = CswEnumNbtViewVisibility.Hidden,
                ViewMode       = CswEnumNbtViewRenderingMode.Grid,
                ViewName       = FavoriteItemsViewName,
                GridGroupByCol = CswNbtObjClassRequestItem.PropertyName.Name
            };
            CswNbtViewRelationship RequestItemRel = Ret.AddViewRelationship(_RequestItemOC, false);
            CswNbtViewProperty     NameVP         = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Name), 1);

            NameVP.SortBy = true;
            Ret.AddViewPropertyFilter(NameVP, ShowAtRuntime: true);
            CswNbtViewProperty DescriptionVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Description), 2);

            DescriptionVP.Width = 50;
            CswNbtViewProperty InventoryGroupVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.InventoryGroup), 3);

            InventoryGroupVP.Width = 30;
            CswNbtViewProperty LocationVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Location), 4);

            LocationVP.Width = 40;
            Ret.AddViewPropertyAndFilter(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Requestor), Value: "me", ShowInGrid: false);
            Ret.AddViewPropertyAndFilter(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.IsFavorite), Value: CswNbtNodePropLogical.toLogicalGestalt(CswEnumTristate.True), ShowInGrid: false);
            return(Ret);
        }
Пример #6
0
        } // setupPhraseView()

        private void _setupClassificationView(CswNbtView View, CswCommaDelimitedString SelectedClassIds)
        {
            CswNbtMetaDataObjectClass GhsClassOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSClassificationClass);
            CswNbtMetaDataNodeType    GhsClassNT = GhsClassOC.FirstNodeType;

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.Root.ChildRelationships.Clear();
            if (SelectedClassIds.Count > 0)
            {
                CswNbtViewRelationship ClassVR = View.AddViewRelationship(GhsClassOC, false);
                foreach (string ClassId in SelectedClassIds)
                {
                    CswPrimaryKey ClassPk = new CswPrimaryKey();
                    ClassPk.FromString(ClassId);
                    ClassVR.NodeIdsToFilterIn.Add(ClassPk);
                }

                View.AddViewProperty(ClassVR, GhsClassOC.getObjectClassProp(CswNbtObjClassGHSClassification.PropertyName.Category));
                if (null != GhsClassNT)
                {
                    CswNbtMetaDataNodeTypeProp LanguageProp = GhsClassNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation());
                    CswNbtViewProperty         LanguageVP   = View.AddViewProperty(ClassVR, LanguageProp);
                    LanguageVP.Width = 100;
                }
            } // if( SelectedClassIds.Count > 0 )
            View.SaveToCache(IncludeInQuickLaunch: false, UpdateCache: true, KeepInQuickLaunch: false);
        }     // _setupClassificationView()
        public override void update()
        {
            CswNbtMetaDataObjectClass PrinterOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.PrinterClass );
            foreach( CswNbtMetaDataNodeType JobNt in PrinterOc.getLatestVersionNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp GridNtp = JobNt.getNodeTypePropByFirstVersionName( "Jobs" );
                if( null != GridNtp && CswEnumNbtFieldType.Grid == GridNtp.getFieldType().FieldType )
                {
                    CswNbtView GridView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( GridNtp.ViewId );
                    if( null != GridView )
                    {
                        GridView.Root.ChildRelationships.Clear();

                        CswNbtViewRelationship RootVr = GridView.AddViewRelationship( PrinterOc, IncludeDefaultFilters : true );

                        CswNbtMetaDataObjectClass PrintJobOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.PrintJobClass );
                        CswNbtMetaDataObjectClassProp PrinterOcp = PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.Printer );
                        CswNbtViewRelationship PrinterVr = GridView.AddViewRelationship( RootVr, CswEnumNbtViewPropOwnerType.Second, PrinterOcp, IncludeDefaultFilters: true );

                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobNo ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.RequestedBy ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.CreatedDate ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.JobState ) );
                        GridView.AddViewProperty( PrinterVr, PrintJobOc.getObjectClassProp( CswNbtObjClassPrintJob.PropertyName.Label ) );

                        GridView.save();
                    }
                }
            }

        } //Update()
        public override void update()
        {
            CswNbtMetaDataNodeType ChemicalNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Chemical" );
            if( null != ChemicalNT )
            {
                CswNbtView MHCView = _CswNbtSchemaModTrnsctn.makeNewView( "Missing Hazard Classes", NbtViewVisibility.Global );
                MHCView.Category = "Materials";
                MHCView.Visibility = NbtViewVisibility.Global;
                MHCView.ViewMode = NbtViewRenderingMode.Tree;
            
                CswNbtViewRelationship RootRel = MHCView.AddViewRelationship( ChemicalNT, true );

                CswNbtMetaDataNodeTypeProp SpecialFlagsNTP = ChemicalNT.getNodeTypeProp( "Special Flags" );
                CswNbtViewProperty SpecialFlagsVP = MHCView.AddViewProperty( RootRel, SpecialFlagsNTP );
                MHCView.AddViewPropertyFilter( SpecialFlagsVP,
                                                CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                                CswNbtPropFilterSql.FilterResultMode.Hide,
                                                CswNbtSubField.SubFieldName.Value,
                                                CswNbtPropFilterSql.PropertyFilterMode.NotContains,
                                                "Not Reportable");

                CswNbtMetaDataNodeTypeProp HazardClassesNTP = ChemicalNT.getNodeTypeProp( "Hazard Classes" );
                CswNbtViewProperty HazardClassesVP = MHCView.AddViewProperty( RootRel, HazardClassesNTP );
                MHCView.AddViewPropertyFilter( HazardClassesVP,
                                                CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                                CswNbtPropFilterSql.FilterResultMode.Hide,
                                                CswNbtSubField.SubFieldName.Value,
                                                CswNbtPropFilterSql.PropertyFilterMode.Null);
                MHCView.save();
            }
        }//Update()
        private void _createGroupPermissionsGridProp(CswNbtMetaDataObjectClass PermissionGroupOC, PermissionSetAttributes PermSet)
        {
            CswNbtMetaDataObjectClassProp PermissionsGridOCP = PermissionGroupOC.getObjectClassProp("Permissions");

            if (null == PermissionsGridOCP)
            {
                PermissionsGridOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionGroupOC)
                {
                    PropName  = CswNbtObjClassReportGroup.PropertyName.Permissions,
                    FieldType = CswEnumNbtFieldType.Grid
                });

                CswNbtMetaDataObjectClass     PermissionOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(PermSet.PermissionClassName);
                CswNbtMetaDataObjectClassProp PermGroupOCP = PermissionOC.getObjectClassProp(CswNbtPropertySetPermission.PropertyName.PermissionGroup);
                CswNbtView PermissionsView = _CswNbtSchemaModTrnsctn.makeView();
                PermissionsView.ViewName = PermSet.GroupTargetPropName;
                PermissionsView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
                CswNbtViewRelationship RootRel = PermissionsView.AddViewRelationship(PermissionGroupOC, false);
                CswNbtViewRelationship PermRel = PermissionsView.AddViewRelationship(RootRel, CswEnumNbtViewPropOwnerType.Second, PermGroupOCP, true);
                PermissionsView.AddViewProperty(PermRel, PermissionOC.getObjectClassProp(CswNbtPropertySetPermission.PropertyName.PermissionGroup), 1);
                PermissionsView.AddViewProperty(PermRel, PermissionOC.getObjectClassProp(CswNbtPropertySetPermission.PropertyName.Role), 2);
                PermissionsView.AddViewProperty(PermRel, PermissionOC.getObjectClassProp(CswNbtPropertySetPermission.PropertyName.WorkUnit), 3);
                PermissionsView.AddViewProperty(PermRel, PermissionOC.getObjectClassProp(CswNbtPropertySetPermission.PropertyName.View), 4);
                PermissionsView.AddViewProperty(PermRel, PermissionOC.getObjectClassProp(CswNbtPropertySetPermission.PropertyName.Edit), 5);
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(PermissionsGridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, PermissionsView.ToString());
            }
        }
Пример #10
0
        public CswNbtView setupPhraseView(CswNbtView View, CswCommaDelimitedString SelectedPhraseIds)
        {
            CswNbtMetaDataObjectClass GhsPhraseOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.GHSPhraseClass);
            CswNbtMetaDataNodeType    GhsPhraseNT = GhsPhraseOC.FirstNodeType;

            View.SetVisibility(CswEnumNbtViewVisibility.Hidden, null, null);
            View.ViewMode = CswEnumNbtViewRenderingMode.Grid;
            View.Root.ChildRelationships.Clear();
            if (SelectedPhraseIds.Count > 0)
            {
                CswNbtViewRelationship PhraseVR = View.AddViewRelationship(GhsPhraseOC, false);
                foreach (string PhraseId in SelectedPhraseIds)
                {
                    CswPrimaryKey PhrasePk = new CswPrimaryKey();
                    PhrasePk.FromString(PhraseId);
                    PhraseVR.NodeIdsToFilterIn.Add(PhrasePk);
                }

                View.AddViewProperty(PhraseVR, GhsPhraseOC.getObjectClassProp(CswNbtObjClassGHSPhrase.PropertyName.Code));
                if (null != GhsPhraseNT)
                {
                    CswNbtMetaDataNodeTypeProp LanguageProp = GhsPhraseNT.getNodeTypePropByObjectClassProp(_getLanguageForTranslation());
                    CswNbtViewProperty         LanguageVP   = View.AddViewProperty(PhraseVR, LanguageProp);
                    LanguageVP.Width = 100;
                }
            } // if( SelectedPhraseIds.Count > 0 )

            return(View);
        } // setupPhraseView()
Пример #11
0
        private void _updateMissingHazardClassesView()
        {
            CswNbtView MHCView = _CswNbtSchemaModTrnsctn.restoreView( "Missing Hazard Classes" );
            if( null == MHCView )
            {
                MHCView = _CswNbtSchemaModTrnsctn.makeNewView( "Missing Hazard Classes", CswEnumNbtViewVisibility.Global );
                MHCView.ViewMode = CswEnumNbtViewRenderingMode.Tree;
                MHCView.Category = "Materials";
            }
            else
            {
                MHCView.Root.ChildRelationships.Clear();
            }

            CswNbtViewRelationship RootRel = MHCView.AddViewRelationship( ChemicalOC, true );

            CswNbtMetaDataObjectClassProp SpecialFlagsOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.SpecialFlags );
            CswNbtViewProperty SpecialFlagsVP = MHCView.AddViewProperty( RootRel, SpecialFlagsOCP );
            MHCView.AddViewPropertyFilter( SpecialFlagsVP,
                                            CswEnumNbtFilterConjunction.And,
                                            CswEnumNbtFilterResultMode.Hide,
                                            CswEnumNbtSubFieldName.Value,
                                            CswEnumNbtFilterMode.NotContains,
                                            "Not Reportable" );

            CswNbtMetaDataObjectClassProp HazardClassesOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.HazardClasses );
            CswNbtViewProperty HazardClassesVP = MHCView.AddViewProperty( RootRel, HazardClassesOCP );
            MHCView.AddViewPropertyFilter( HazardClassesVP,
                                            CswEnumNbtFilterConjunction.And,
                                            CswEnumNbtFilterResultMode.Hide,
                                            CswEnumNbtSubFieldName.Value,
                                            CswEnumNbtFilterMode.Null );
            MHCView.save();
        }
Пример #12
0
        private void _updateContainersView( CswNbtMetaDataNodeType MaterialNT )
        {
            CswNbtMetaDataNodeTypeProp ContainersNTP = MaterialNT.getNodeTypeProp( MaterialNT.NodeTypeName + " Containers" );
            if( null != ContainersNTP )
            {
                CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ContainerClass );
                CswNbtMetaDataObjectClassProp MatOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Material );
                CswNbtMetaDataObjectClassProp DisposedOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Disposed );
                CswNbtMetaDataObjectClassProp BarcodeOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Barcode );
                CswNbtMetaDataObjectClassProp QuantityOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Quantity );
                CswNbtMetaDataObjectClassProp StatusOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Status );
                CswNbtMetaDataObjectClassProp OwnerOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner );
                CswNbtMetaDataObjectClassProp LocationOCP = ContainerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location );

                CswNbtView ContainersView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( ContainersNTP.ViewId );
                ContainersView.Root.ChildRelationships.Clear();
                CswNbtViewRelationship RootRel = ContainersView.AddViewRelationship( MaterialPS, false );
                CswNbtViewRelationship MatRel = ContainersView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, MatOCP, true );
                ContainersView.AddViewPropertyAndFilter( MatRel, DisposedOCP, CswEnumTristate.False.ToString(),
                                                             FilterMode: CswEnumNbtFilterMode.Equals,
                                                             ShowAtRuntime: false,
                                                             ShowInGrid: false );
                ContainersView.AddViewProperty( MatRel, BarcodeOCP, 1 );
                ContainersView.AddViewProperty( MatRel, QuantityOCP, 2 );
                ContainersView.AddViewProperty( MatRel, StatusOCP, 3 );
                ContainersView.AddViewProperty( MatRel, OwnerOCP, 4 );
                ContainersView.AddViewProperty( MatRel, LocationOCP, 5 );
                ContainersView.save();
            }
        }
Пример #13
0
        private void _updateDocumentsView( CswNbtMetaDataNodeType MaterialNT )
        {
            CswNbtMetaDataNodeTypeProp DocumentsNTP = MaterialNT.getNodeTypeProp( "Documents" );
            if( null != DocumentsNTP )
            {
                CswNbtMetaDataNodeType DocumentNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Material Document" );
                if( null != DocumentNT )
                {
                    CswNbtMetaDataNodeTypeProp MatOCP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Owner );
                    CswNbtMetaDataNodeTypeProp AcquiredDateNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.AcquiredDate );
                    CswNbtMetaDataNodeTypeProp ExpDateNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.ExpirationDate );
                    CswNbtMetaDataNodeTypeProp FileNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.File );
                    CswNbtMetaDataNodeTypeProp LinkNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Link );
                    CswNbtMetaDataNodeTypeProp ArchivedNTP = DocumentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassDocument.PropertyName.Archived );

                    CswNbtView DocumentsView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( DocumentsNTP.ViewId );
                    DocumentsView.Root.ChildRelationships.Clear();
                    CswNbtViewRelationship RootRel = DocumentsView.AddViewRelationship( MaterialPS, false );
                    CswNbtViewRelationship MatRel = DocumentsView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, MatOCP, true );
                    DocumentsView.AddViewPropertyAndFilter( MatRel, ArchivedNTP, CswEnumTristate.False.ToString(),
                                                             FilterMode: CswEnumNbtFilterMode.Equals,
                                                             ShowAtRuntime: true,
                                                             ShowInGrid: false );
                    DocumentsView.AddViewProperty( MatRel, AcquiredDateNTP, 1 );
                    DocumentsView.AddViewProperty( MatRel, ExpDateNTP, 2 );
                    DocumentsView.AddViewProperty( MatRel, FileNTP, 3 );
                    DocumentsView.AddViewProperty( MatRel, LinkNTP, 4 );
                    DocumentsView.save();
                }
            }
        }
Пример #14
0
        public static CswNbtView getAssignedCofADocumentsView( CswNbtResources _CswNbtResources, CswPrimaryKey ReceiptLotId, bool IncludeArchivedDocs = false )
        {
            CswNbtMetaDataObjectClass ReceiptLotOC = _CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.ReceiptLotClass );
            CswNbtMetaDataObjectClass CofADocOC = _CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.CofADocumentClass );
            CswNbtMetaDataObjectClassProp OwnerOCP = CofADocOC.getObjectClassProp( PropertyName.Owner );
            CswNbtMetaDataObjectClassProp RevisionDateOCP = CofADocOC.getObjectClassProp( PropertyName.RevisionDate );
            CswNbtMetaDataObjectClassProp ArchivedOCP = CofADocOC.getObjectClassProp( PropertyName.Archived );
            CswNbtMetaDataObjectClassProp FileOCP = CofADocOC.getObjectClassProp( PropertyName.File );
            CswNbtMetaDataObjectClassProp LinkOCP = CofADocOC.getObjectClassProp( PropertyName.Link );

            CswNbtView AssignedCofAView = new CswNbtView( _CswNbtResources )
            {
                ViewName = "All Assigned C of A Documents",
                ViewMode = CswEnumNbtViewRenderingMode.Grid,
                ViewVisibility = CswEnumNbtViewVisibility.Property.ToString()
            };
            CswNbtViewRelationship RootRel = AssignedCofAView.AddViewRelationship( ReceiptLotOC, false );
            RootRel.NodeIdsToFilterIn.Add( ReceiptLotId );
            CswNbtViewRelationship DocRel = AssignedCofAView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, OwnerOCP, true );
            if( false == IncludeArchivedDocs )
            {
                AssignedCofAView.AddViewPropertyAndFilter( DocRel, ArchivedOCP, CswEnumTristate.False.ToString(),
                                                            FilterMode : CswEnumNbtFilterMode.Equals,
                                                            ShowAtRuntime : true,
                                                            ShowInGrid : false );
            }
            AssignedCofAView.AddViewProperty( DocRel, RevisionDateOCP, 1 );
            AssignedCofAView.AddViewProperty( DocRel, FileOCP, 2 );
            AssignedCofAView.AddViewProperty( DocRel, LinkOCP, 3 );

            return AssignedCofAView;
        }
Пример #15
0
        } //Update()

        //Get all Inspection targets with Status = OK, and any inspection design nodes that been touched (i.e. - not pending or overdue)
        //If no designs exist in the view for the given target, then the target should have a status of Not Inspected instead.
        private CswNbtView _getInvalidTargetsView()
        {
            CswNbtView myView = _CswNbtSchemaModTrnsctn.makeView();

            myView.Visibility = NbtViewVisibility.Global;
            myView.ViewMode   = NbtViewRenderingMode.Tree;

            CswNbtMetaDataObjectClass Rel1SecondOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(NbtObjectClass.InspectionTargetClass);
            CswNbtViewRelationship    Rel1         = myView.AddViewRelationship(Rel1SecondOC, true);

            CswNbtViewProperty Prop2 = null;

            foreach (CswNbtMetaDataNodeType Rel1NT in Rel1SecondOC.getNodeTypes())
            {
                CswNbtMetaDataNodeTypeProp Prop2NTP = Rel1NT.getNodeTypeProp("Status");
                if (null != Prop2NTP)
                {
                    Prop2 = myView.AddViewProperty(Rel1, Prop2NTP);
                    break;
                }
            }
            myView.AddViewPropertyFilter(Prop2,
                                         CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                         CswNbtPropFilterSql.FilterResultMode.Hide,
                                         CswNbtSubField.SubFieldName.Value,
                                         CswNbtPropFilterSql.PropertyFilterMode.Equals,
                                         "OK");

            CswNbtMetaDataObjectClass     Rel4SecondOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(NbtObjectClass.InspectionDesignClass);
            CswNbtMetaDataObjectClassProp Rel4Prop     = Rel4SecondOC.getObjectClassProp(CswNbtObjClassInspectionDesign.PropertyName.Target);
            CswNbtViewRelationship        Rel4         = myView.AddViewRelationship(Rel1, NbtViewPropOwnerType.Second, Rel4Prop, true);

            CswNbtViewProperty Prop5 = null;

            foreach (CswNbtMetaDataNodeType Rel4NT in Rel4SecondOC.getNodeTypes())
            {
                CswNbtMetaDataNodeTypeProp Prop5NTP = Rel4NT.getNodeTypeProp("Status");
                if (null != Prop5NTP)
                {
                    Prop5 = myView.AddViewProperty(Rel4, Prop5NTP);
                    break;
                }
            }
            myView.AddViewPropertyFilter(Prop5,
                                         CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                         CswNbtPropFilterSql.FilterResultMode.Hide,
                                         CswNbtSubField.SubFieldName.Value,
                                         CswNbtPropFilterSql.PropertyFilterMode.NotEquals,
                                         "Pending");

            myView.AddViewPropertyFilter(Prop5,
                                         CswNbtPropFilterSql.PropertyFilterConjunction.And,
                                         CswNbtPropFilterSql.FilterResultMode.Hide,
                                         CswNbtSubField.SubFieldName.Value,
                                         CswNbtPropFilterSql.PropertyFilterMode.NotEquals,
                                         "Overdue");
            return(myView);
        }
Пример #16
0
        private CswNbtNode _getTargetNodeForGenerator(CswNbtNode CswNbtNodeGenerator, CswPrimaryKey ParentPk, string TargetDateFilter)
        {
            CswNbtNode ReturnVal = null;

            CswNbtObjClassGenerator GeneratorNode = (CswNbtObjClassGenerator)CswNbtNodeGenerator;

            if (String.IsNullOrEmpty(GeneratorNode.TargetType.SelectedNodeTypeIds.ToString()))
            {
                throw new CswDniException(CswEnumErrorType.Error, "Invalid generator configuration", "_getTargetNodeForGenerator got a null SelectedNodeTypeIds on nodeid " + GeneratorNode.NodeId);
            }
            else
            {
                Int32 NodeTypeId = CswConvert.ToInt32(GeneratorNode.TargetType.SelectedNodeTypeIds[0]);   // case 28612 - just check the first one
                if (Int32.MinValue != NodeTypeId)
                {
                    CswNbtMetaDataNodeType ThisCreatedNodeType = _CswNbtResources.MetaData.getNodeType(NodeTypeId);
                    if (null != ThisCreatedNodeType)
                    {
                        CswNbtMetaDataNodeType    CreatedNodeType            = ThisCreatedNodeType.getNodeTypeLatestVersion();
                        CswNbtMetaDataObjectClass CreatedMetaDataObjectClass = CreatedNodeType.getObjectClass();

                        CswNbtObjClass CreatedObjClass = CswNbtObjClassFactory.makeObjClass(_CswNbtResources, CreatedMetaDataObjectClass);
                        if (!(CreatedObjClass is CswNbtPropertySetGeneratorTarget))
                        {
                            throw new CswDniException("CswNbtActGenerateNodes got an invalid object class: " + CreatedObjClass.ObjectClass.ToString());
                        }
                        CswNbtPropertySetGeneratorTarget GeneratorTarget = (CswNbtPropertySetGeneratorTarget)CreatedObjClass;

                        // CreatedForNTP is the parent or owner of the new node. Inspections created for Inspection Targets, Tasks for Equipment, etc.
                        CswNbtMetaDataNodeTypeProp CreatedForNTP = CreatedNodeType.getNodeTypePropByObjectClassProp(GeneratorTarget.ParentPropertyName);
                        CswNbtMetaDataNodeTypeProp GeneratorNTP  = CreatedNodeType.getNodeTypePropByObjectClassProp(CswNbtPropertySetGeneratorTarget.PropertyName.Generator);
                        CswNbtMetaDataNodeTypeProp DueDateNTP    = CreatedNodeType.getNodeTypePropByObjectClassProp(CswNbtPropertySetGeneratorTarget.PropertyName.DueDate);

                        CswNbtView CswNbtView = new CswNbtView(_CswNbtResources);
                        CswNbtView.ViewName = "Nodes for Generator";

                        CswNbtViewRelationship RootRelationship     = CswNbtView.AddViewRelationship(CreatedNodeType, false);
                        CswNbtViewProperty     CreatedForParentProp = CswNbtView.AddViewProperty(RootRelationship, CreatedForNTP);
                        CswNbtView.AddViewPropertyFilter(CreatedForParentProp, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID, CswEnumNbtFilterMode.Equals, ParentPk.PrimaryKey.ToString(), false);
                        CswNbtViewProperty GeneratorProp = CswNbtView.AddViewProperty(RootRelationship, GeneratorNTP);
                        CswNbtView.AddViewPropertyFilter(GeneratorProp, CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID, CswEnumNbtFilterMode.Equals, CswNbtNodeGenerator.NodeId.PrimaryKey.ToString(), false);
                        CswNbtViewProperty DueDateProp = CswNbtView.AddViewProperty(RootRelationship, DueDateNTP);
                        //Case 24572
                        CswNbtView.AddViewPropertyFilter(DueDateProp, CswNbtFieldTypeRuleDateTime.SubFieldName.Value, CswEnumNbtFilterMode.Equals, TargetDateFilter, false);

                        ICswNbtTree ExistingNodesTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, CswNbtView, true, false, false);

                        if (ExistingNodesTree.getChildNodeCount() > 0)
                        {
                            ExistingNodesTree.goToNthChild(0);
                            ReturnVal = ExistingNodesTree.getNodeForCurrentPosition();
                        }
                    }
                }
            }
            return(ReturnVal);
        }//_getTargetNodeForGenerator
        /// <summary>
        /// Returns a view used to show the containers available for dispense for the given Request Item
        /// </summary>
        /// <returns></returns>
        public CswNbtView getDispensibleContainersView(CswPrimaryKey RequestItemId)
        {
            CswNbtView Ret = new CswNbtView(_CswNbtResources);

            CswNbtObjClassRequestItem NodeAsRequestItem = _CswNbtResources.Nodes[RequestItemId];

            if (null != NodeAsRequestItem)
            {
                //TODO - if we're dispensing a specific container or EP, we don't care about the specific material
                CswNbtNode TargetNode = _CswNbtResources.Nodes[NodeAsRequestItem.Target.RelatedNodeId];
                if (null != TargetNode)
                {
                    Ret.ViewName = "Containers of " + TargetNode.NodeName;
                    Ret.ViewMode = CswEnumNbtViewRenderingMode.Grid;
                    Ret.Category = "Dispensing";

                    CswNbtMetaDataObjectClass ContainerOc  = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);
                    CswNbtViewRelationship    ContainerRel = Ret.AddViewRelationship(ContainerOc, true);
                    CswNbtViewProperty        BarcodeVp    = Ret.AddViewProperty(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Barcode));

                    //Filter Containers by Materials in Requested EP
                    if (NodeAsRequestItem.Type.Value == CswNbtObjClassRequestItem.Types.EnterprisePart)
                    {
                        CswCommaDelimitedString EPMaterialPks = _getMaterialPKsForEP(NodeAsRequestItem.EnterprisePart.RelatedNodeId);
                        Ret.AddViewPropertyAndFilter(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Material), SubFieldName: CswEnumNbtSubFieldName.NodeID, FilterMode: CswEnumNbtFilterMode.In, Value: EPMaterialPks.ToString(), ShowInGrid: false);
                    }
                    else//Filters Containers by Requested Material
                    {
                        Ret.AddViewPropertyAndFilter(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Material), SubFieldName: CswEnumNbtSubFieldName.NodeID, Value: TargetNode.NodeId.PrimaryKey.ToString(), ShowInGrid: false);
                    }
                    Ret.AddViewPropertyAndFilter(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Missing), FilterMode: CswEnumNbtFilterMode.NotEquals, Value: CswEnumTristate.True, ShowInGrid: false);
                    Ret.AddViewPropertyAndFilter(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Quantity), SubFieldName: CswEnumNbtSubFieldName.Value, FilterMode: CswEnumNbtFilterMode.GreaterThan, Value: "0");
                    Ret.AddViewPropertyAndFilter(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Status), FilterMode: CswEnumNbtFilterMode.NotEquals, Value: CswEnumNbtContainerStatuses.Expired, ShowInGrid: false);
                    Ret.AddViewProperty(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Location));

                    CswNbtMetaDataObjectClass     LocationOc        = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);
                    CswNbtMetaDataObjectClassProp InventoryGroupOcp = LocationOc.getObjectClassProp(CswNbtObjClassLocation.PropertyName.InventoryGroup);
                    CswNbtViewRelationship        LocationVr        = Ret.AddViewRelationship(ContainerRel, CswEnumNbtViewPropOwnerType.First, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Location), IncludeDefaultFilters: true);
                    if (CswTools.IsPrimaryKey(NodeAsRequestItem.InventoryGroup.RelatedNodeId))   //Filter by Inventory Group
                    {
                        Ret.AddViewPropertyAndFilter(LocationVr, InventoryGroupOcp, SubFieldName: CswEnumNbtSubFieldName.NodeID, Value: NodeAsRequestItem.InventoryGroup.RelatedNodeId.PrimaryKey.ToString(), ShowInGrid: false);
                    }
                    else
                    {
                        Ret.AddViewPropertyAndFilter(LocationVr, InventoryGroupOcp, SubFieldName: CswEnumNbtSubFieldName.NodeID, FilterMode: CswEnumNbtFilterMode.Null, ShowInGrid: false);
                    }

                    if (NodeAsRequestItem.Type.Value == CswNbtObjClassRequestItem.Types.MaterialSize) //Filter By Size (if present)
                    {
                        Ret.AddViewPropertyAndFilter(ContainerRel, ContainerOc.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Size), SubFieldName: CswEnumNbtSubFieldName.NodeID, Value: NodeAsRequestItem.Size.RelatedNodeId.PrimaryKey.ToString(), ShowInGrid: false);
                    }
                }
            }
            return(Ret);
        }
Пример #18
0
        public override void update()
        {
            CswNbtMetaDataObjectClass CertDefSpecOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.CertDefSpecClass );

            CswNbtMetaDataObjectClass CertDefOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.CertificateDefinitionClass);
            CswNbtMetaDataObjectClass CertDefCharacteristicOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.CertDefCharacteristicLimitClass);
            CswNbtMetaDataObjectClass CertDefConditionOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.CertDefConditionClass);

            ICswNbtMetaDataProp CertDefConditionCertDefOCP = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( CertDefConditionOC.ObjectClassId,
                                                                                                                  CswNbtObjClassCertDefCondition.PropertyName.CertDefSpec );

            ICswNbtMetaDataProp CertDefCharacteristicCertDefOCP = _CswNbtSchemaModTrnsctn.MetaData.getObjectClassProp( CertDefCharacteristicOC.ObjectClassId,
                                                                                                                  CswNbtObjClassCertDefCharacteristicLimit.PropertyName.CertDefSpec );

            CswNbtView ConditionsView = _CswNbtSchemaModTrnsctn.makeSafeView( "CertDefConditionsGridOnCertDefSpec",
                                                                              CswEnumNbtViewVisibility.Property );
            CswNbtViewRelationship ParentRelationship = ConditionsView.AddViewRelationship( CertDefSpecOC, true );
            CswNbtViewRelationship ConditionsRelationship = ConditionsView.AddViewRelationship( ParentRelationship,
                                                CswEnumNbtViewPropOwnerType.Second,
                                                CertDefConditionCertDefOCP,
                                                true);

            ConditionsView.AddViewProperty( ConditionsRelationship, CertDefConditionOC.getObjectClassProp( CswNbtObjClassCertDefCondition.PropertyName.Value), 1 );
            ConditionsView.AddViewProperty( ConditionsRelationship, CertDefConditionOC.getObjectClassProp( CswNbtObjClassCertDefCondition.PropertyName.MethodCondition), 2 );

            _CswNbtSchemaModTrnsctn.createObjectClassProp( CertDefSpecOC, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassCertDefSpec.PropertyName.Conditions,
                FieldType = CswEnumNbtFieldType.Grid,
                ViewXml = ConditionsView.ToString()
            } );

            CswNbtView CharacteristicsView = _CswNbtSchemaModTrnsctn.makeSafeView( "CertDefCharacteristicsGridOnCertDefSpec",
                                                                              CswEnumNbtViewVisibility.Property );
            ParentRelationship = CharacteristicsView.AddViewRelationship( CertDefSpecOC, true );
            CswNbtViewRelationship CharacteristicsRelationship = CharacteristicsView.AddViewRelationship( ParentRelationship,
                                                CswEnumNbtViewPropOwnerType.Second,
                                                CertDefCharacteristicCertDefOCP,
                                                true);

            CharacteristicsView.AddViewProperty( CharacteristicsRelationship, CertDefCharacteristicOC.getObjectClassProp( CswNbtObjClassCertDefCharacteristicLimit.PropertyName.MethodCharacteristic), 1 );
            CharacteristicsView.AddViewProperty( CharacteristicsRelationship, CertDefCharacteristicOC.getObjectClassProp( CswNbtObjClassCertDefCharacteristicLimit.PropertyName.ResultType), 2 );
            CharacteristicsView.AddViewProperty( CharacteristicsRelationship, CertDefCharacteristicOC.getObjectClassProp( CswNbtObjClassCertDefCharacteristicLimit.PropertyName.Limits), 3 );
            CharacteristicsView.AddViewProperty( CharacteristicsRelationship, CertDefCharacteristicOC.getObjectClassProp( CswNbtObjClassCertDefCharacteristicLimit.PropertyName.PassOptions), 4 );
            CharacteristicsView.AddViewProperty( CharacteristicsRelationship, CertDefCharacteristicOC.getObjectClassProp( CswNbtObjClassCertDefCharacteristicLimit.PropertyName.PassValue), 5 );

            _CswNbtSchemaModTrnsctn.createObjectClassProp( CertDefSpecOC, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassCertDefSpec.PropertyName.Characteristics,
                FieldType = CswEnumNbtFieldType.Grid,
                ViewXml = CharacteristicsView.ToString()
            } );

        } // update()
        public override void update()
        {
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            if( null != ChemicalOC )
            {
                foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() )
                {
                    // Remove Regulatory Lists Grid header on Chemical
                    CswNbtMetaDataNodeTypeProp RegListsGridNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.RegulatoryListsGrid );
                    RegListsGridNTP.Attribute1 = false.ToString();

                    // case 28303 - Hide Suppressed Regulatory Lists prop
                    CswNbtMetaDataNodeTypeProp SuppressedRegListsNTP = ChemicalNT.getNodeTypePropByObjectClassProp( CswNbtObjClassChemical.PropertyName.SuppressedRegulatoryLists );
                    SuppressedRegListsNTP.removeFromAllLayouts();
                }
            }


            CswNbtMetaDataObjectClass RegListOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListClass );
            CswNbtMetaDataObjectClass RegListMemberOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListMemberClass );
            if( null != RegListOC && null != RegListMemberOC )
            {
                foreach( CswNbtMetaDataNodeType RegListNT in RegListOC.getNodeTypes() )
                {
                    // Fix help text on Regulatory List 'Add CAS Numbers' property
                    CswNbtMetaDataNodeTypeProp AddCasNosNTP = RegListNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRegulatoryList.PropertyName.AddCASNumbers );
                    AddCasNosNTP.HelpText = @"Enter a list of CAS numbers to add to this regulatory list, delimited by commas or newlines.";

                    // Add help text to Regulatory List 'Exclusive' property
                    CswNbtMetaDataNodeTypeProp ExclusiveNTP = RegListNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRegulatoryList.PropertyName.Exclusive );
                    ExclusiveNTP.HelpText = @"If checked, the normal behavior of the regulatory list is reversed; a chemical is only considered a member of the list if it does not match any CAS number on the list.";

                    // Fix property name of CASNosGrid
                    CswNbtMetaDataNodeTypeProp CASNosGridNTP = RegListNT.getNodeTypePropByObjectClassProp( CswNbtObjClassRegulatoryList.PropertyName.CASNosGrid );
                    CASNosGridNTP.PropName = CswNbtObjClassRegulatoryList.PropertyName.CASNosGrid;

                    // Add Chemical grid on Regulatory List
                    CswNbtMetaDataNodeTypeTab ChemTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTabDeprecated( RegListNT, "Chemicals", 2 );
                    CswNbtMetaDataNodeTypeProp ChemGrid = _CswNbtSchemaModTrnsctn.MetaData.makeNewPropDeprecated( RegListNT, CswEnumNbtFieldType.Grid, "Chemicals", ChemTab.TabId );
                    CswNbtView ChemView = _CswNbtSchemaModTrnsctn.restoreView( ChemGrid.ViewId );
                    ChemView.Root.ChildRelationships.Clear();
                    CswNbtViewRelationship regListRel = ChemView.AddViewRelationship( RegListOC, false );
                    CswNbtViewRelationship memberRel = ChemView.AddViewRelationship( regListRel, CswEnumNbtViewPropOwnerType.Second, RegListMemberOC.getObjectClassProp( CswNbtObjClassRegulatoryListMember.PropertyName.RegulatoryList ), false );
                    CswNbtViewRelationship chemRel = ChemView.AddViewRelationship( memberRel, CswEnumNbtViewPropOwnerType.First, RegListMemberOC.getObjectClassProp( CswNbtObjClassRegulatoryListMember.PropertyName.Chemical ), false );
                    ChemView.AddViewProperty( chemRel, ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.TradeName ) );
                    ChemView.AddViewProperty( chemRel, ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.CasNo ) );
                    ChemView.save();
                }
            }
        } // update()
Пример #20
0
        //takes the request view, adds items, and filters by submitted
        public CswNbtView getSubmittedRequestItemsView()
        {
            CswNbtView Ret = getRequestViewBase(LimitToUnsubmitted: false, AddRootRel: false, IncludeDefaultFilters: false);

            Ret.Visibility     = CswEnumNbtViewVisibility.Hidden;
            Ret.ViewName       = SubmittedItemsViewName;
            Ret.GridGroupByCol = CswNbtObjClassRequestItem.PropertyName.Request;
            CswNbtMetaDataObjectClassProp RequestOcp     = _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Request);
            CswNbtViewRelationship        RequestItemRel = Ret.AddViewRelationship(_RequestItemOC, IncludeDefaultFilters: true);

            CswNbtViewProperty NameVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Name), 1);
            //NameVP.ShowInGrid = true;
            CswNbtViewPropertyFilter NameVpf      = Ret.AddViewPropertyFilter(NameVP, ShowAtRuntime: true);
            CswNbtViewProperty       ItemNumberVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.ItemNumber), 2);

            ItemNumberVP.Width = 10;
            CswNbtViewProperty       StatusVP  = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Status), 3);
            CswNbtViewPropertyFilter StatusVpf = Ret.AddViewPropertyFilter(StatusVP, FilterMode: CswEnumNbtFilterMode.NotEquals, Value: CswNbtObjClassRequestItem.Statuses.Pending);

            StatusVpf.ShowAtRuntime = true;
            CswNbtViewProperty DescriptionVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Description), 4);

            DescriptionVP.Width = 50;
            CswNbtViewProperty NeededByVP    = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.NeededBy), 5);
            CswNbtViewProperty RequestVP     = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Request));
            CswNbtViewProperty CommentsVP    = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.Comments));
            CswNbtViewProperty RequestTypeVP = Ret.AddViewProperty(RequestItemRel, _RequestItemOC.getObjectClassProp(CswNbtObjClassRequestItem.PropertyName.RequestType), 7);

            RequestTypeVP.Width = 20;

            return(Ret);
        }
Пример #21
0
        private CswPrimaryKey _HandleReference(string LocationNodeIdStr, string LocationBarcode)   //, Dictionary<Int32, Int32> NodeMap )
        {
            CswPrimaryKey LocationNodeId = new CswPrimaryKey();

            if (!string.IsNullOrEmpty(LocationNodeIdStr))
            {
                LocationNodeId.FromString(LocationNodeIdStr);
                if (LocationNodeId.PrimaryKey == Int32.MinValue && LocationBarcode != string.Empty)
                {
                    // Find the location with this barcode value
                    CswNbtMetaDataObjectClass     LocationObjectClass    = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);
                    CswNbtMetaDataObjectClassProp BarcodeObjectClassProp = LocationObjectClass.getObjectClassProp(CswNbtObjClassLocation.PropertyName.Barcode);

                    CswNbtView LocationView = new CswNbtView(_CswNbtResources);
                    // All locations..
                    CswNbtViewRelationship LocationRelationship = LocationView.AddViewRelationship(LocationObjectClass, false);
                    // ..with barcodes
                    CswNbtViewProperty BarcodeViewProperty = LocationView.AddViewProperty(LocationRelationship, BarcodeObjectClassProp);
                    // ..equal to the given barcode
                    CswNbtViewPropertyFilter BarcodeViewPropertyFilter = LocationView.AddViewPropertyFilter(BarcodeViewProperty, CswNbtFieldTypeRuleBarCode.SubFieldName.Barcode, CswEnumNbtFilterMode.Equals, LocationBarcode, false);

                    ICswNbtTree LocationTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, LocationView, true, false, false);
                    if (LocationTree.getChildNodeCount() > 0)
                    {
                        LocationTree.goToNthChild(0);
                        CswNbtNode LocationNode = LocationTree.getNodeForCurrentPosition();
                        LocationNodeId = LocationNode.NodeId;
                    }
                }
            } // if(!string.IsNullOrEmpty(LocationNodeIdStr))
            return(LocationNodeId);
        }     // _HandleReference()
Пример #22
0
        public IEnumerable <CswPrimaryKey> getContainersInGroup()
        {
            CswNbtView ContainersInGroupView = new CswNbtView(_CswNbtResources);

            ContainersInGroupView.ViewName = "ContainersInGroup";

            CswNbtMetaDataObjectClass ContainerOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);
            CswNbtViewRelationship    Rel1        = ContainersInGroupView.AddViewRelationship(ContainerOC, true);

            CswNbtMetaDataObjectClassProp ContainerGroupOCP = ContainerOC.getObjectClassProp(CswNbtObjClassContainer.PropertyName.ContainerGroup);
            CswNbtViewProperty            Prop2             = ContainersInGroupView.AddViewProperty(Rel1, ContainerGroupOCP);
            CswNbtViewPropertyFilter      Filt3             = ContainersInGroupView.AddViewPropertyFilter(Prop2,
                                                                                                          CswEnumNbtFilterConjunction.And,
                                                                                                          CswEnumNbtFilterResultMode.Hide,
                                                                                                          CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID,
                                                                                                          CswEnumNbtFilterMode.Equals,
                                                                                                          this.NodeId.PrimaryKey.ToString(),
                                                                                                          false,
                                                                                                          false);

            Collection <CswPrimaryKey> _ContainerGroupNodePks = new Collection <CswPrimaryKey>();

            ICswNbtTree ContainersInGroupTree = _CswNbtResources.Trees.getTreeFromView(ContainersInGroupView, false, true, true);

            ContainersInGroupTree.goToRoot();
            for (int i = 0; i < ContainersInGroupTree.getChildNodeCount(); i++)
            {
                ContainersInGroupTree.goToNthChild(i);
                _ContainerGroupNodePks.Add(ContainersInGroupTree.getNodeIdForCurrentPosition());
                ContainersInGroupTree.goToParentNode();
            }

            return(_ContainerGroupNodePks);
        }
Пример #23
0
        public Collection<string> getCASNumbers()
        {
            Collection<string> ret = new Collection<string>();
            CswNbtMetaDataObjectClass RegListCasNoOC = _CswNbtResources.MetaData.getObjectClass( CswEnumNbtObjectClass.RegulatoryListCasNoClass );
            CswNbtMetaDataObjectClassProp RegListCasNoCasNoOCP = RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.CASNo );
            CswNbtMetaDataObjectClassProp RegListCasNoRegListOCP = RegListCasNoOC.getObjectClassProp( CswNbtObjClassRegulatoryListCasNo.PropertyName.RegulatoryList );

            CswNbtView View = new CswNbtView( _CswNbtResources );
            View.ViewName = "Reglist_getCASNumbers";
            CswNbtViewRelationship casnoRel = View.AddViewRelationship( RegListCasNoOC, false );
            View.AddViewProperty( casnoRel, RegListCasNoCasNoOCP );
            View.AddViewPropertyAndFilter( casnoRel,
                                           RegListCasNoRegListOCP,
                                           SubFieldName: CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID,
                                           FilterMode: CswEnumNbtFilterMode.Equals,
                                           Value: this.NodeId.PrimaryKey.ToString() );

            ICswNbtTree Tree = _CswNbtResources.Trees.getTreeFromView( View, RequireViewPermissions: false, IncludeSystemNodes: true, IncludeHiddenNodes: true );
            for( Int32 i = 0; i < Tree.getChildNodeCount(); i++ )
            {
                Tree.goToNthChild( i );

                CswNbtTreeNodeProp casnoTreeProp = Tree.getChildNodePropsOfNode().FirstOrDefault( p => p.ObjectClassPropName == RegListCasNoCasNoOCP.PropName );
                if( null != casnoTreeProp )
                {
                    ret.Add( casnoTreeProp[( (CswNbtFieldTypeRuleCASNo) RegListCasNoCasNoOCP.getFieldTypeRule() ).TextSubField.Column] );
                }

                Tree.goToParentNode();
            }
            return ret;
        } // getCASNumbers()
        public override void update()
        {
            // add active to constituent grid
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClass ComponentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.MaterialComponentClass );
            foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp ChemicalComponentsNTP = ChemicalNT.getNodeTypeProp( "Components" );
                if( null != ChemicalComponentsNTP )
                {
                    CswNbtView ComponentsView = _CswNbtSchemaModTrnsctn.restoreView( ChemicalComponentsNTP.ViewId );
                    if( ComponentsView.Root.ChildRelationships.Count > 0 )
                    {
                        CswNbtViewRelationship ChemRel = ComponentsView.Root.ChildRelationships[0];
                        if( ChemRel.ChildRelationships.Count > 0 )
                        {
                            CswNbtViewRelationship CompRel = ChemRel.ChildRelationships[0];
                            Int32 order = 1;
                            foreach( CswNbtViewProperty vp in CompRel.Properties )
                            {
                                vp.Order = order;
                                order++;
                            }
                            ComponentsView.AddViewProperty( CompRel, ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Active ), order );
                        }
                    }
                    ComponentsView.save();

                } // if( null != ChemicalComponentsNTP )
            } // foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalOC.getNodeTypes() )
        } // update()
        } //Update()

        private void _addRegListLOLIListCodesGrid()
        {
            CswNbtMetaDataObjectClass RegListOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RegulatoryListClass);

            if (null != RegListOC)
            {
                // Grid property
                CswNbtMetaDataObjectClassProp RegListLOLIListCodesGridOCP = RegListOC.getObjectClassProp(CswNbtObjClassRegulatoryList.PropertyName.LOLIListCodes);
                if (null == RegListLOLIListCodesGridOCP)
                {
                    RegListLOLIListCodesGridOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(RegListOC)
                    {
                        PropName  = CswNbtObjClassRegulatoryList.PropertyName.LOLIListCodes,
                        FieldType = CswEnumNbtFieldType.Grid
                    });

                    CswNbtMetaDataObjectClass RegListListCodeOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.RegulatoryListListCodeClass);
                    if (null != RegListListCodeOC)
                    {
                        CswNbtMetaDataObjectClassProp RegListListCodeRegListOCP = RegListListCodeOC.getObjectClassProp(CswNbtObjClassRegulatoryListListCode.PropertyName.RegulatoryList);

                        // Grid View
                        CswNbtView RegListListCodesView = _CswNbtSchemaModTrnsctn.makeView();
                        RegListListCodesView.ViewName = CswNbtObjClassRegulatoryList.PropertyName.LOLIListCodes;
                        RegListListCodesView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
                        CswNbtViewRelationship RegListRel     = RegListListCodesView.AddViewRelationship(RegListOC, false);
                        CswNbtViewRelationship MemberRel      = RegListListCodesView.AddViewRelationship(RegListRel, CswEnumNbtViewPropOwnerType.Second, RegListListCodeRegListOCP, true);
                        CswNbtViewProperty     LOLIListNameVP = RegListListCodesView.AddViewProperty(MemberRel, RegListListCodeOC.getObjectClassProp(CswNbtObjClassRegulatoryListListCode.PropertyName.LOLIListName), 1);
                        _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(RegListLOLIListCodesGridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, RegListListCodesView.ToString());
                    }
                } // if( null == RegListListCodesGridOCP )
            }     // if( null != RegListOC )
        }         // _addLoliCodesGrid()
Пример #26
0
        public CswNbtNode makeRoleNodeFromRoleName(string RoleName)
        {
            CswNbtNode RoleNode = null;

            CswNbtMetaDataObjectClass     Role_ObjectClass         = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.RoleClass);
            CswNbtMetaDataObjectClassProp RoleName_ObjectClassProp = Role_ObjectClass.getObjectClassProp(CswNbtObjClassRole.PropertyName.Name);

            // generate the view
            CswNbtView View = new CswNbtView(_CswNbtResources);

            View.ViewName = "CswNbtNodes.makeRoleNodeFromRoleName(" + RoleName + ")";
            CswNbtViewRelationship   RoleRelationship = View.AddViewRelationship(Role_ObjectClass, false);
            CswNbtViewProperty       Prop             = View.AddViewProperty(RoleRelationship, RoleName_ObjectClassProp);
            CswNbtViewPropertyFilter Filter           = View.AddViewPropertyFilter(Prop, CswNbtFieldTypeRuleText.SubFieldName.Text, CswEnumNbtFilterMode.Equals, RoleName, false);

            // generate the tree
            ICswNbtTree UserTree = _CswNbtResources.Trees.getTreeFromView(View, false, true, IncludeHiddenNodes: true);

            // get user node
            UserTree.goToRoot();
            if (UserTree.getChildNodeCount() > 0)
            {
                UserTree.goToNthChild(0);
                RoleNode = UserTree.getNodeForCurrentPosition();
            }
            return(RoleNode);
        }
        }//afterPopulateProps()

        public override CswNbtNode CopyNode(bool IsNodeTemp = false, Action <CswNbtNode> OnCopy = null)
        {
            // Copy this Assembly
            CswNbtNode CopiedAssemblyNode = base.CopyNodeImpl(IsNodeTemp, OnCopy);

            // Copy all Equipment
            CswNbtMetaDataObjectClass EquipmentObjectClass    = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.EquipmentClass);
            CswNbtView               EquipmentView            = new CswNbtView(_CswNbtResources);
            CswNbtViewRelationship   EquipmentRelationship    = EquipmentView.AddViewRelationship(EquipmentObjectClass, false);
            CswNbtViewProperty       AssemblyProperty         = EquipmentView.AddViewProperty(EquipmentRelationship, EquipmentObjectClass.getObjectClassProp(CswNbtObjClassEquipment.PropertyName.Assembly));
            CswNbtViewPropertyFilter AssemblyIsOriginalFilter = EquipmentView.AddViewPropertyFilter(
                AssemblyProperty,
                CswNbtFieldTypeRuleRelationship.SubFieldName.NodeID,
                CswEnumNbtFilterMode.Equals,
                NodeId.PrimaryKey.ToString());

            ICswNbtTree EquipmentTree = _CswNbtResources.Trees.getTreeFromView(_CswNbtResources.CurrentNbtUser, EquipmentView, true, false, false);

            EquipmentTree.goToRoot();
            Int32 c = 0;

            while (c < EquipmentTree.getChildNodeCount())
            {
                EquipmentTree.goToNthChild(c);
                CswNbtObjClassEquipment OriginalEquipmentNode = EquipmentTree.getNodeForCurrentPosition();
                OriginalEquipmentNode.CopyNode(IsNodeTemp, delegate(CswNbtNode CopiedEquipmentNode)
                {
                    ((CswNbtObjClassEquipment)CopiedEquipmentNode).Assembly.RelatedNodeId = CopiedAssemblyNode.NodeId;
                });
                EquipmentTree.goToParentNode();
                c++;
            }

            return(CopiedAssemblyNode);
        }
Пример #28
0
        }//Update()

        private void _addPropertyRecursively( CswNbtView View, Collection<CswNbtViewRelationship> Relationships, CswNbtMetaDataObjectClass documentOC, CswNbtMetaDataNodeType documentNT, CswNbtMetaDataNodeTypeProp fileNTP, CswNbtMetaDataNodeTypeProp linkNTP )
        {
            foreach( CswNbtViewRelationship ChildRelationship in Relationships )
            {
                if( ( ChildRelationship.SecondId == documentNT.NodeTypeId && ChildRelationship.SecondType == NbtViewRelatedIdType.NodeTypeId ) ||
                    ( ChildRelationship.SecondId == documentOC.ObjectClassId && ChildRelationship.SecondType == NbtViewRelatedIdType.ObjectClassId ) )
                {
                    View.AddViewProperty( ChildRelationship, fileNTP );
                    View.AddViewProperty( ChildRelationship, linkNTP );
                }
                if( ChildRelationship.ChildRelationships.Count > 0 )
                {
                    _addPropertyRecursively( View, ChildRelationship.ChildRelationships, documentOC, documentNT, fileNTP, linkNTP );
                }
            }
            View.save();
        }
Пример #29
0
        private CswNbtView _getReconciliationScansForOutOfScopeContainersView(ContainerData.ReconciliationRequest Request)
        {
            Collection <CswPrimaryKey> LocationIds = _getLocationIds(Request);

            CswNbtMetaDataObjectClass     LocationOC          = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.LocationClass);
            CswNbtMetaDataObjectClass     ContainerOC         = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);
            CswNbtMetaDataObjectClassProp CLocationOCP        = ContainerOC.getObjectClassProp(CswNbtObjClassContainer.PropertyName.Location);
            CswNbtMetaDataObjectClass     ContainerLocationOC = _CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerLocationClass);
            CswNbtMetaDataObjectClassProp ContainerOCP        = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Container);
            CswNbtMetaDataObjectClassProp TypeOCP             = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Type);
            CswNbtMetaDataObjectClassProp LocationOCP         = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.Location);
            CswNbtMetaDataObjectClassProp ScanDateOCP         = ContainerLocationOC.getObjectClassProp(CswNbtObjClassContainerLocation.PropertyName.ScanDate);

            CswNbtView ContainerLocationsView = new CswNbtView(_CswNbtResources);
            //Filter to selected location (and all child locations if applicable)
            CswNbtViewRelationship LocationVR = ContainerLocationsView.AddViewRelationship(LocationOC, false);

            LocationVR.NodeIdsToFilterIn = LocationIds;
            CswCommaDelimitedString LocIds = new CswCommaDelimitedString();

            foreach (CswPrimaryKey LocId in LocationIds)
            {
                LocIds.Add(LocId.PrimaryKey.ToString());
            }
            //Filter to Container Location records of type Reconcile Scans in the current time scope
            CswNbtViewRelationship ContainerLocationVR = ContainerLocationsView.AddViewRelationship(LocationVR, CswEnumNbtViewPropOwnerType.Second, LocationOCP, false);
            CswNbtViewProperty     TypeVP = ContainerLocationsView.AddViewProperty(ContainerLocationVR, TypeOCP);

            ContainerLocationsView.AddViewPropertyFilter(TypeVP, FilterMode: CswEnumNbtFilterMode.Equals, Value: CswEnumNbtContainerLocationTypeOptions.ReconcileScans.ToString());
            CswNbtViewProperty ScanDateVP = ContainerLocationsView.AddViewProperty(ContainerLocationVR, ScanDateOCP);

            if (CswConvert.ToDateTime(Request.StartDate) > CswConvert.ToDateTime(Request.EndDate))
            {
                Request.StartDate = Request.EndDate;
            }
            ContainerLocationsView.AddViewPropertyFilter(ScanDateVP, FilterMode: CswEnumNbtFilterMode.GreaterThanOrEquals, Value: Request.StartDate);
            ContainerLocationsView.AddViewPropertyFilter(ScanDateVP, FilterMode: CswEnumNbtFilterMode.LessThanOrEquals, Value: Request.EndDate);
            ContainerLocationsView.setSortProperty(ScanDateVP, CswEnumNbtViewPropertySortMethod.Descending);
            //Filter to Containers not matching current location scope
            CswNbtViewRelationship ContainerVR = ContainerLocationsView.AddViewRelationship(ContainerLocationVR, CswEnumNbtViewPropOwnerType.First, ContainerOCP, false);
            CswNbtViewProperty     CLocVP      = ContainerLocationsView.AddViewProperty(ContainerVR, CLocationOCP);

            ContainerLocationsView.AddViewPropertyFilter(CLocVP, CswEnumNbtSubFieldName.NodeID, CswEnumNbtFilterMode.In, LocIds.ToString());

            return(ContainerLocationsView);
        }
Пример #30
0
        public static void setReceiptLotPermissions(CswNbtResources CswNbtResources, bool ModuleIsActive)
        {
            // CIS-52258 - grant Receipt Lot permissions to cispro_ roles

            CswNbtMetaDataObjectClass ReceiptLotOC = CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.ReceiptLotClass);

            CswNbtMetaDataObjectClass     RoleOC      = CswNbtResources.MetaData.getObjectClass(CswEnumNbtObjectClass.RoleClass);
            CswNbtMetaDataObjectClassProp RoleNameOCP = RoleOC.getObjectClassProp(CswNbtObjClassRole.PropertyName.Name);

            CswNbtView View = new CswNbtView(CswNbtResources);

            View.ViewName = "MLM Enable - Find CISPro roles";
            CswNbtViewRelationship roleRelationship = View.AddViewRelationship(RoleOC, false);
            CswNbtViewProperty     roleNameProp     = View.AddViewProperty(roleRelationship, RoleNameOCP);

            View.AddViewPropertyFilter(roleNameProp,
                                       SubFieldName: CswNbtFieldTypeRuleText.SubFieldName.Text,
                                       FilterMode: CswEnumNbtFilterMode.Begins,
                                       Value: "cispro_",
                                       CaseSensitive: false);
            ICswNbtTree RoleTree = CswNbtResources.Trees.getTreeFromView(View, false, true, IncludeHiddenNodes: true);

            for (Int32 r = 0; r < RoleTree.getChildNodeCount(); r++)
            {
                RoleTree.goToNthChild(r);

                CswNbtObjClassRole RoleNode = RoleTree.getCurrentNode();
                foreach (CswNbtMetaDataNodeType ReceiptLotNT in ReceiptLotOC.getNodeTypes())
                {
                    //if MLM is on, everyone needs View and admins/receivers need Edit
                    if (CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.MLM))
                    {
                        CswNbtResources.Permit.set(CswEnumNbtNodeTypePermission.View, ReceiptLotNT, RoleNode, true);

                        if ("cispro_receiver" == RoleNode.Name.Text.ToLower() ||
                            "cispro_admin" == RoleNode.Name.Text.ToLower())
                        {
                            CswNbtResources.Permit.set(CswEnumNbtNodeTypePermission.Edit, ReceiptLotNT, RoleNode, true);
                        }
                    }
                    //otherwise, if only Lot Info is on, no one needs Edit, but everyone needs View
                    else if (CswNbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.ManufacturerLotInfo))
                    {
                        CswNbtResources.Permit.set(CswEnumNbtNodeTypePermission.View, ReceiptLotNT, RoleNode, true);
                        CswNbtResources.Permit.set(CswEnumNbtNodeTypePermission.Edit, ReceiptLotNT, RoleNode, false);
                    }
                    //if both MLM and Lot Info are off, no one needs to View or Edit
                    else
                    {
                        CswNbtResources.Permit.set(CswEnumNbtNodeTypePermission.View, ReceiptLotNT, RoleNode, false);
                        CswNbtResources.Permit.set(CswEnumNbtNodeTypePermission.Edit, ReceiptLotNT, RoleNode, false);
                    }
                }
                //RoleNode.postChanges( false );  CswNbtPermit does this.

                RoleTree.goToParentNode();
            }
        } // setReceiptLotPermissions()