Exemplo n.º 1
0
        } // saveSessionData(Search)

        /// <summary>
        /// Save a view to the session data collection.  Sets the SessionViewId on the view.
        /// </summary>
        public CswNbtSessionDataId saveSessionData( CswNbtView View, bool IncludeInQuickLaunch, bool KeepInQuickLaunch = false, bool UpdateCache = false )
        {
            CswTableUpdate SessionViewsUpdate = _CswNbtResources.makeCswTableUpdate( "saveSessionView_update", SessionDataTableName );
            DataTable SessionViewTable;
            if( View.SessionViewId != null && View.SessionViewId.isSet() ) //Get existing session view by SessionViewId
                SessionViewTable = SessionViewsUpdate.getTable( SessionDataColumn_PrimaryKey, View.SessionViewId.get(), "where sessionid = '" + SessionId + "'", false );
            else if( View.ViewId != null && View.ViewId.isSet() ) //Get existing session view by ViewId
                SessionViewTable = SessionViewsUpdate.getTable( SessionDataColumn_ViewId, View.ViewId.get(), "where sessionid = '" + SessionId + "'", false );
            else //Save new Session View
                SessionViewTable = SessionViewsUpdate.getEmptyTable();
            if( SessionViewTable.Rows.Count == 0 )
            {
                UpdateCache = true;
            }

            DataRow SessionViewRow = _getSessionViewRow( SessionViewTable, View.ViewName, CswEnumNbtSessionDataType.View, IncludeInQuickLaunch, KeepInQuickLaunch );
            if( UpdateCache && false == ( _CswNbtResources.CurrentNbtUser is CswNbtSystemUser ) )//Overwrite
            {
                SessionViewRow[SessionDataColumn_ViewId] = CswConvert.ToDbVal( View.ViewId.get() );
                SessionViewRow[SessionDataColumn_ViewMode] = View.ViewMode.ToString();
                SessionViewRow[SessionDataColumn_ViewXml] = View.ToString();
                SessionViewsUpdate.update( SessionViewTable );
            }

            return new CswNbtSessionDataId( CswConvert.ToInt32( SessionViewRow[SessionDataColumn_PrimaryKey] ) );

        } // saveSessionData(View)
Exemplo n.º 2
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 VendorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.VendorClass );
     CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswEnumNbtPropertySetName.MaterialSet );
     CswNbtMetaDataObjectClass ManufacturerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ManufacturerClass );
     if( null == ManufacturerOC )
     {
         ManufacturerOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.ManufacturerClass, "box.png", true );
         _CswNbtSchemaModTrnsctn.createModuleObjectClassJunction( CswEnumNbtModuleName.MLM, ManufacturerOC.ObjectClassId );
         _CswNbtSchemaModTrnsctn.createObjectClassProp( ManufacturerOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ManufacturerOC )
         {
             PropName = CswNbtObjClassManufacturer.PropertyName.Material,
             FieldType = CswEnumNbtFieldType.Relationship,
             IsFk = true,
             FkType = CswEnumNbtViewRelatedIdType.PropertySetId.ToString(),
             FkValue = MaterialPS.PropertySetId,
             IsRequired = true
         } );
         CswNbtView ManufacturingSiteView = _CswNbtSchemaModTrnsctn.makeView();
         CswNbtViewRelationship parent = ManufacturingSiteView.AddViewRelationship( VendorOC, true );
         CswNbtMetaDataObjectClassProp VendorTypeOCP = VendorOC.getObjectClassProp( CswNbtObjClassVendor.PropertyName.VendorTypeName );
         ManufacturingSiteView.AddViewPropertyAndFilter( parent,
                                                 MetaDataProp : VendorTypeOCP,
                                                 Value : CswNbtObjClassVendor.VendorTypes.Manufacturing,
                                                 FilterMode : CswEnumNbtFilterMode.Equals );
         ManufacturingSiteView.Visibility = CswEnumNbtViewVisibility.Property;
         ManufacturingSiteView.ViewName = "Manufacturing Site";
         _CswNbtSchemaModTrnsctn.createObjectClassProp( ManufacturerOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ManufacturerOC )
         {
             PropName = CswNbtObjClassManufacturer.PropertyName.ManufacturingSite,
             FieldType = CswEnumNbtFieldType.Relationship,
             IsFk = true,
             FkType = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(),
             FkValue = VendorOC.ObjectClassId,
             IsRequired = true,
             ViewXml = ManufacturingSiteView.ToString()
         } );
         _CswNbtSchemaModTrnsctn.createObjectClassProp( ManufacturerOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ManufacturerOC )
         {
             PropName = CswNbtObjClassManufacturer.PropertyName.Qualified,
             FieldType = CswEnumNbtFieldType.Logical
         } );
     }
     CswNbtMetaDataNodeType ManufacturerNT = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( ManufacturerOC )
                                                                                                   {
                                                                                                       NodeTypeName = "Manufacturer",
                                                                                                       Category = "MLM"
                                                                                                   } );
 } // update()
        public override void update()
        {

            CswNbtMetaDataObjectClass locationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.LocationClass );

            CswNbtMetaDataObjectClass containerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.ContainerClass );
            CswNbtMetaDataObjectClassProp locationOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Location );
            CswNbtMetaDataObjectClassProp barcodeOCP = containerOC.getBarcodeProp();
            CswNbtMetaDataObjectClassProp materialOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Material );
            CswNbtMetaDataObjectClassProp ownerOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Owner );
            CswNbtMetaDataObjectClassProp statusOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Status );
            CswNbtMetaDataObjectClassProp expDateOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.ExpirationDate );
            CswNbtMetaDataObjectClassProp quantOCP = containerOC.getObjectClassProp( CswNbtObjClassContainer.PropertyName.Quantity );

            CswNbtView containersByLocation = _CswNbtSchemaModTrnsctn.makeView();
            containersByLocation.SetViewMode( NbtViewRenderingMode.Grid );
            CswNbtViewRelationship locationParent = containersByLocation.AddViewRelationship( locationOC, true );
            CswNbtViewRelationship containerParent = containersByLocation.AddViewRelationship( locationParent, NbtViewPropOwnerType.Second, locationOCP, true );

            containersByLocation.AddViewProperty( containerParent, barcodeOCP );
            containersByLocation.AddViewProperty( containerParent, materialOCP );
            containersByLocation.AddViewProperty( containerParent, ownerOCP );
            containersByLocation.AddViewProperty( containerParent, expDateOCP );
            containersByLocation.AddViewProperty( containerParent, statusOCP );
            containersByLocation.AddViewProperty( containerParent, quantOCP );

            CswTableUpdate tu = _CswNbtSchemaModTrnsctn.makeCswTableUpdate( "fixLocationsContainersView_28507", "node_views" );
            DataTable node_views = tu.getTable( "where viewname = 'Containers' and visibility = 'Property'" );
            foreach( DataRow row in node_views.Rows )
            {
                row["viewxml"] = containersByLocation.ToString();
            }
            tu.update( node_views );


        } //Update()
Exemplo n.º 5
0
        public override void update()
        {
            #region Create DSD Phrase OC

            CswNbtMetaDataObjectClass DSDPhraseOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.DSDPhraseClass );
            if( null == DSDPhraseOC )
            {
                DSDPhraseOC = _CswNbtSchemaModTrnsctn.createObjectClass( CswEnumNbtObjectClass.DSDPhraseClass, "warning.png", false );

                _CswNbtSchemaModTrnsctn.createObjectClassProp( DSDPhraseOC, new CswNbtWcfMetaDataModel.ObjectClassProp( DSDPhraseOC )
                    {
                        PropName = CswNbtObjClassDSDPhrase.PropertyName.Code,
                        FieldType = CswEnumNbtFieldType.Text
                    } );

                _CswNbtSchemaModTrnsctn.createObjectClassProp( DSDPhraseOC, new CswNbtWcfMetaDataModel.ObjectClassProp( DSDPhraseOC )
                    {
                        PropName = CswNbtObjClassDSDPhrase.PropertyName.Category,
                        FieldType = CswEnumNbtFieldType.List,
                        ListOptions = "Risk,Safety,Hazard"
                    } );

                foreach( string Language in CswNbtPropertySetPhrase.SupportedLanguages.All )
                {
                    _CswNbtSchemaModTrnsctn.createObjectClassProp( DSDPhraseOC, new CswNbtWcfMetaDataModel.ObjectClassProp( DSDPhraseOC )
                        {
                            PropName = Language,
                            FieldType = CswEnumNbtFieldType.Text
                        } );
                }

            }

            #endregion

            #region Create DSD Chemical Props

            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );

            const string _pre = "Images/cispro/DSD/";
            CswDelimitedString dsdImgs = new CswDelimitedString( '\n' )
                {
                    _pre + "none.gif",
                    _pre + "e.gif",
                    _pre + "o.gif",
                    _pre + "f.gif",
                    _pre + "f_plus.gif",
                    _pre + "t.gif",
                    _pre + "t_plus.gif",
                    _pre + "xn.gif",
                    _pre + "xi.gif",
                    _pre + "c.gif",
                    _pre + "n.gif"
                };

            CswDelimitedString dsdValues = new CswDelimitedString( '\n' )
                {
                    "None","Explosive","Oxidizing","Highly flammable","Extremely flammable","Toxic","Very Toxic","Harmful","Irritant","Corrosive","Dangerous for the environment"
                };

            CswNbtMetaDataObjectClassProp PictorgramsOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.Pictograms ) ??
                _CswNbtSchemaModTrnsctn.createObjectClassProp( ChemicalOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ChemicalOC )
                    {
                        PropName = CswNbtObjClassChemical.PropertyName.Pictograms,
                        FieldType = CswEnumNbtFieldType.ImageList,
                        ListOptions = dsdValues.ToString(),
                        ValueOptions = dsdImgs.ToString(),
                        Extended = true.ToString()
                    } );

            CswNbtMetaDataObjectClassProp LabelCodesOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.LabelCodes ) ??
                _CswNbtSchemaModTrnsctn.createObjectClassProp( ChemicalOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ChemicalOC )
                    {
                        PropName = CswNbtObjClassChemical.PropertyName.LabelCodes,
                        FieldType = CswEnumNbtFieldType.MultiList,
                        ListOptions = "" //Intentionally empty - will be dynamic
                    } );

            CswNbtView DSDLabelCodesView = _CswNbtSchemaModTrnsctn.makeSafeView( "DSD Label Codes Property Grid", CswEnumNbtViewVisibility.Hidden );
            DSDLabelCodesView.SetViewMode( CswEnumNbtViewRenderingMode.Grid );
            DSDLabelCodesView.AddViewRelationship( DSDPhraseOC, false );
            DSDLabelCodesView.save();

            CswNbtMetaDataObjectClassProp LabelCodesGridOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.LabelCodesGrid ) ??
                _CswNbtSchemaModTrnsctn.createObjectClassProp( ChemicalOC, new CswNbtWcfMetaDataModel.ObjectClassProp( ChemicalOC )
                {
                    PropName = CswNbtObjClassChemical.PropertyName.LabelCodesGrid,
                    FieldType = CswEnumNbtFieldType.Grid,
                    ViewXml = DSDLabelCodesView.ToString(),
                    Extended = "Small"
                } );

            #endregion

        } // update()
        /// <summary>
        /// The actual update call
        /// </summary>
        public override void update()
        {
            CswNbtMetaDataObjectClass ReceiptLotOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ReceiptLotClass);
            //Put Manufacturer on add layout
            CswNbtMetaDataObjectClassProp ManufacturerOCP = ReceiptLotOC.getObjectClassProp(CswNbtObjClassReceiptLot.PropertyName.Manufacturer);

            foreach (CswNbtMetaDataNodeType ReceiptLotNT in ReceiptLotOC.getNodeTypes())
            {
                CswNbtMetaDataNodeTypeProp ManufacturerNTP = ReceiptLotNT.getNodeTypePropByObjectClassProp(ManufacturerOCP);
                ManufacturerNTP.updateLayout(CswEnumNbtLayoutType.Add, false);
            }
            //Add new props to ReceiptLot
            CswNbtMetaDataObjectClassProp ManufacturerLotNoOCP = ReceiptLotOC.getObjectClassProp(CswNbtObjClassReceiptLot.PropertyName.ManufacturerLotNo);

            if (null == ManufacturerLotNoOCP)
            {
                ManufacturerLotNoOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(ReceiptLotOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName    = CswNbtObjClassReceiptLot.PropertyName.ManufacturerLotNo,
                    FieldType   = CswEnumNbtFieldType.Text,
                    SetValOnAdd = true
                });
            }
            CswNbtMetaDataObjectClassProp ManufacturedDateOCP = ReceiptLotOC.getObjectClassProp(CswNbtObjClassReceiptLot.PropertyName.ManufacturedDate);

            if (null == ManufacturedDateOCP)
            {
                ManufacturedDateOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(ReceiptLotOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName    = CswNbtObjClassReceiptLot.PropertyName.ManufacturedDate,
                    FieldType   = CswEnumNbtFieldType.DateTime,
                    SetValOnAdd = true
                });
            }
            _CswNbtSchemaModTrnsctn.MetaData.makeMissingNodeTypeProps();
            //Upgrade AssignedCofA to OCP
            CswNbtMetaDataObjectClassProp AssignedCofAOCP = ReceiptLotOC.getObjectClassProp(CswNbtObjClassReceiptLot.PropertyName.AssignedCofA);

            if (null == AssignedCofAOCP)
            {
                AssignedCofAOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(ReceiptLotOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName  = CswNbtObjClassReceiptLot.PropertyName.AssignedCofA,
                    FieldType = CswEnumNbtFieldType.Grid
                });
                CswNbtView AssignedCofAView = _CswNbtSchemaModTrnsctn.restoreView("Assigned C of A");
                if (null != AssignedCofAView)
                {
                    _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(AssignedCofAOCP, CswEnumNbtObjectClassPropAttributes.viewxml, AssignedCofAView.ToString());
                }
            }
            //Remove the ManufacturerLotNo property off Container
            CswNbtMetaDataObjectClass ContainerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ContainerClass);

            foreach (CswNbtMetaDataNodeType ContainerNT in ContainerOC.getNodeTypes())
            {
                CswNbtMetaDataNodeTypeProp ManufacturerLotNoNTP = ContainerNT.getNodeTypeProp("Manufacturer Lot Number");
                if (null != ManufacturerLotNoNTP)
                {
                    _CswNbtSchemaModTrnsctn.MetaData.DeleteNodeTypeProp(ManufacturerLotNoNTP);
                }
            }
            //Rename "C of A" module to "Manufacturer Lot Info"
            CswTableUpdate ModulesTableUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("ModulesSelect_29700", "modules");
            DataTable      ModulesTable       = ModulesTableUpdate.getTable("where name = 'C of A'");

            if (ModulesTable.Rows.Count > 0)
            {
                ModulesTable.Rows[0]["name"]        = CswEnumNbtModuleName.ManufacturerLotInfo;
                ModulesTable.Rows[0]["description"] = "Manufacturer Lot Info";
                ModulesTableUpdate.update(ModulesTable);
            }
        }
Exemplo n.º 7
0
        protected void RightHeaderMenu_OnItemSelectedHandler(object sender, RadMenuEventArgs e)
        {
            try
            {
                switch (e.Item.Value)
                {
                case "HomeMenuItem":
                {
                    //clearView();
                    //setViewId( CswNbtResources.CurrentNbtUser.DefaultViewId, true );
                    //Master.GoMain();
                    GoHome();
                    break;
                }

                case "UserListMenuItem":
                {
                    Redirect("UserList.aspx");
                    break;
                }

                case "StatisticsMenuItem":
                {
                    Redirect("Statistics.aspx");
                    break;
                }

                case "HelpMenuItem":
                {
                    // Client-side
                    break;
                }

                case "AboutMenuItem":
                {
                    // Client-side
                    break;
                }

                case "ProfileMenuItem":
                {
                    CswNbtMetaDataObjectClass UserObjectClass =
                        Master.CswNbtResources.MetaData.getObjectClass(
                            CswEnumNbtObjectClass.UserClass);

                    CswNbtView UserView = new CswNbtView(Master.CswNbtResources);
                    UserView.ViewName = "Preferences";
                    CswNbtViewRelationship UserRelationship = UserView.AddViewRelationship(UserObjectClass,
                                                                                           true);
                    UserRelationship.NodeIdsToFilterIn.Add(Master.CswNbtResources.CurrentUser.UserId);

                    ICswNbtTree PrefsTree = Master.CswNbtResources.Trees.getTreeFromView(Master.CswNbtResources.CurrentNbtUser, UserView, true, false, false);
                    PrefsTree.goToNthChild(0);
                    Session["Main_SelectedNodeKey"] = PrefsTree.getNodeKeyForCurrentPosition().ToString();

                    Master.setViewXml(UserView.ToString());
                    Master.GoMain();
                    break;
                }

                case "SubscriptionsMenuItem":
                {
                    Master.Redirect("Subscriptions.aspx");
                    break;
                }

                case "LogoutMenuItem":
                {
                    Logout();
                    break;
                }

                case "LogMenuItem":
                {
                    Master.Redirect("DisplayLog.aspx");
                    break;
                }

                case "ConfigVarsMenuItem":
                {
                    Master.Redirect("ConfigVars.aspx");
                    break;
                }

                case "RemoveDemoDataItem":
                {
                    CswDemoDataManager DemoDataManager = new CswDemoDataManager(Master.CswNbtResources);
                    DemoDataManager.RemoveDemoData();
                    break;
                }

                default:
                {
                    Master.Redirect("Welcome.aspx");
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                HandleError(ex);
            }
        }
Exemplo n.º 8
0
        public override void update()
        {
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );

            CswNbtMetaDataNodeType ConstituentNT = null;
            Collection<CswNbtMetaDataNodeType> ChemicalNTs = new Collection<CswNbtMetaDataNodeType>();
            foreach( CswNbtMetaDataNodeType NodeType in _CswNbtSchemaModTrnsctn.MetaData.getNodeTypes( CswEnumNbtObjectClass.ChemicalClass ) )
            {
                if( NodeType.NodeTypeName == "Constituent" )
                {
                    ConstituentNT = NodeType;
                }
                else
                {
                    ChemicalNTs.Add( NodeType );
                }
            }

            if( null != ConstituentNT && ChemicalNTs.Count > 0 )
            {
                //4. Change Components Consituent property to point to the Constituent NT
                CswNbtMetaDataObjectClass ComponentOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.MaterialComponentClass );

                // Only Constituents for 'Constituent' property
                CswNbtMetaDataObjectClassProp ComponentConstituentOCP = ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Constituent );
                {
                    CswNbtView ocConstituentView = _CswNbtSchemaModTrnsctn.makeView();
                    ocConstituentView.ViewName = "Constituent View";
                    CswNbtViewRelationship rel1 = ocConstituentView.AddViewRelationship( ChemicalOC, false );
                    ocConstituentView.AddViewPropertyAndFilter( rel1,
                                                                ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                                                                FilterMode: CswEnumNbtFilterMode.Equals,
                                                                Value: CswEnumTristate.True.ToString() );
                    _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ComponentConstituentOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ocConstituentView.ToString() );
                }
                // Exclude Constituents from 'Mixture' property
                CswNbtMetaDataObjectClassProp ComponentMixtureOCP = ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Mixture );
                {
                    CswNbtView ocMixtureView = _CswNbtSchemaModTrnsctn.makeView();
                    ocMixtureView.ViewName = "Mixture View";
                    CswNbtViewRelationship rel2 = ocMixtureView.AddViewRelationship( ChemicalOC, false );
                    ocMixtureView.AddViewPropertyAndFilter( rel2,
                                                            ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                                                            FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                            Value: CswEnumTristate.True.ToString() );
                    _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ComponentMixtureOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ocMixtureView.ToString() );
                }
                // Fix views on existing nodetypes
                foreach( CswNbtMetaDataNodeType ComponentNT in ComponentOC.getNodeTypes() )
                {
                    // Only Constituents for 'Constituent' property
                    {
                        CswNbtMetaDataNodeTypeProp ComponentConstituentNTP = ComponentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Constituent );
                        ComponentConstituentNTP.SetFK( CswEnumNbtViewRelatedIdType.NodeTypeId.ToString(), ConstituentNT.NodeTypeId );

                        CswNbtView ntConstituentView = _CswNbtSchemaModTrnsctn.restoreView( ComponentConstituentNTP.ViewId );
                        ntConstituentView.Root.ChildRelationships.Clear();
                        CswNbtViewRelationship rel3 = ntConstituentView.AddViewRelationship( ConstituentNT, false );
                        //ntConstituentView.AddViewPropertyAndFilter( rel3,
                        //                                            ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                        //                                            FilterMode: CswEnumNbtFilterMode.Equals,
                        //                                            Value: CswEnumTristate.True.ToString() );
                        ntConstituentView.save();
                    }
                    // Exclude Constituents from 'Mixture' property
                    {
                        CswNbtMetaDataNodeTypeProp ComponentMixtureNTP = ComponentNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Mixture );
                        CswNbtView ntMixtureView = _CswNbtSchemaModTrnsctn.restoreView( ComponentMixtureNTP.ViewId );
                        ntMixtureView.Root.ChildRelationships.Clear();
                        CswNbtViewRelationship rel4 = ntMixtureView.AddViewRelationship( ChemicalOC, false );
                        ntMixtureView.AddViewPropertyAndFilter( rel4,
                                                                ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.IsConstituent ),
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                        ntMixtureView.save();
                    }
                } // foreach( CswNbtMetaDataNodeType ComponentNT in ComponentOC.getNodeTypes() )

                //// Fix Chemical Components Grid
                //foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalNTs )
                //{
                //    CswNbtMetaDataNodeTypeProp ComponentsGridNTP = ChemicalNT.getNodeTypeProp( "Components" );
                //    if( null != ComponentsGridNTP )
                //    {
                //        CswNbtMetaDataObjectClassProp ComponentPercentOCP = ComponentOC.getObjectClassProp( CswNbtObjClassMaterialComponent.PropertyName.Percentage );

                //        CswNbtView ComponentsGridView = _CswNbtSchemaModTrnsctn.restoreView( ComponentsGridNTP.ViewId );
                //        ComponentsGridView.Root.ChildRelationships.Clear();
                //        CswNbtViewRelationship ChemRel = ComponentsGridView.AddViewRelationship( ChemicalNT, false );
                //        CswNbtViewRelationship MixRel = ComponentsGridView.AddViewRelationship( ChemRel, CswEnumNbtViewPropOwnerType.Second, ComponentMixtureOCP, false );
                //        ComponentsGridView.AddViewProperty( MixRel, ComponentConstituentOCP, 1 );
                //        ComponentsGridView.AddViewProperty( MixRel, ComponentPercentOCP, 2 );
                //        ComponentsGridView.save();
                //    }
                //} // foreach( CswNbtMetaDataNodeType ChemicalNT in ChemicalNTs )


                // 6. Update any views or props that point to the Chemical ObjClass to point to the Chemical NT. 
                // We don't want Constituent Chemicals to show as the target for things like Requests Material or Size Owner.

                string Sql = @"select ocp.propname, oc.objectclass, t.nodetypename, p.propname, p.nodetypepropid, p.fktype, p.fkvalue
                                 from nodetype_props p
                                 join nodetypes t on p.nodetypeid = t.nodetypeid
                                 join object_class oc on t.objectclassid = oc.objectclassid
                                 left outer join object_class_props ocp on p.objectclasspropid = ocp.objectclasspropid
                                 join field_types f on p.fieldtypeid = f.fieldtypeid
                                where (    ( p.fktype = 'PropertySetId' and p.fkvalue = (select propertysetid from property_set where name = 'MaterialSet' ) )
                                        or ( p.fktype = 'ObjectClassId' and p.fkvalue = (select objectclassid from object_class where objectclass = 'ChemicalClass' ) )
                                        or ( p.fktype = 'NodeTypeId' and p.fkvalue = (select nodetypeid from nodetypes where nodetypename = 'Chemical' ) ) 
                                      )
                                  and f.fieldtype = 'Relationship'
                                  and ( p.objectclasspropid is null 
                                        or not (    ( oc.objectclass = 'GHSClass' and ocp.propname = 'Material' )
                                                 or ( oc.objectclass = 'MaterialComponentClass' and ocp.propname = 'Mixture' ) 
                                                 or ( oc.objectclass = 'MaterialComponentClass' and ocp.propname = 'Constituent' ) 
                                                 or ( oc.objectclass = 'DocumentClass' and ocp.propname = 'Owner' ) 
                                               )
                                      )";
                CswArbitrarySelect Select = _CswNbtSchemaModTrnsctn.makeCswArbitrarySelect( "29680_relationship_select", Sql );
                DataTable Table = Select.getTable();

                /*    
                    MaterialSynonymClass                Material	
                    SizeClass                           Material	
                    ContainerClass                      Material	
                    InventoryLevelClass                 Material	
                    CofAMethodTemplateClass             Material	
                    ManufacturerEquivalentPartClass     Material	
                    ReceiptLotClass                     Material	
                    RequestContainerDispenseClass       Material	
                    RequestContainerUpdateClass         Material	
                    RequestMaterialCreateClass          Material	
                    RequestMaterialDispenseClass        Material	
                */

                foreach( DataRow Row in Table.Rows )
                {

                    CswNbtMetaDataNodeTypeProp Prop = _CswNbtSchemaModTrnsctn.MetaData.getNodeTypeProp( CswConvert.ToInt32( Row["nodetypepropid"] ) );
                    CswNbtView View = _CswNbtSchemaModTrnsctn.restoreView( Prop.ViewId );
                    if( View.Root.ChildRelationships.Count == 0 )
                    {
                        // The 'Default Filter' will filter out constituents for us
                        if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.NodeTypeId.ToString() )
                        {
                            View.AddViewRelationship( _CswNbtSchemaModTrnsctn.MetaData.getNodeType( CswConvert.ToInt32( Row["fkvalue"] ) ), true );
                        }
                        else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() )
                        {
                            View.AddViewRelationship( _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswConvert.ToInt32( Row["fkvalue"] ) ), true );
                        }
                        else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.PropertySetId.ToString() )
                        {
                            View.AddViewRelationship( _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( CswConvert.ToInt32( Row["fkvalue"] ) ), true );
                        }
                    }
                    else
                    {
                        foreach( CswNbtViewRelationship viewRel in View.Root.GetAllChildrenOfType( CswEnumNbtViewNodeType.CswNbtViewRelationship ) )
                        {
                            if( CswConvert.ToInt32( Row["fkvalue"] ) == viewRel.SecondId )
                            {
                                if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.NodeTypeId.ToString() )
                                {
                                    CswNbtMetaDataNodeType MaterialNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( viewRel.SecondId );
                                    CswNbtViewProperty viewProp = View.AddViewProperty( viewRel, MaterialNT.getNodeTypePropByObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ) );
                                    viewProp.ShowInGrid = false;
                                    View.AddViewPropertyFilter( viewProp,
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                                }
                                else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() )
                                {
                                    CswNbtMetaDataObjectClass MaterialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( viewRel.SecondId );
                                    CswNbtViewProperty viewProp = View.AddViewProperty( viewRel, MaterialOC.getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ) );
                                    viewProp.ShowInGrid = false;
                                    View.AddViewPropertyFilter( viewProp,
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                                }
                                else if( Row["fktype"].ToString() == CswEnumNbtViewRelatedIdType.PropertySetId.ToString() )
                                {
                                    CswNbtMetaDataPropertySet MaterialPS = _CswNbtSchemaModTrnsctn.MetaData.getPropertySet( viewRel.SecondId );
                                    CswNbtViewProperty viewProp = View.AddViewProperty( viewRel, MaterialPS.getObjectClasses().First().getObjectClassProp( CswNbtPropertySetMaterial.PropertyName.IsConstituent ) );
                                    viewProp.ShowInGrid = false;
                                    View.AddViewPropertyFilter( viewProp,
                                                                FilterMode: CswEnumNbtFilterMode.NotEquals,
                                                                Value: CswEnumTristate.True.ToString() );
                                }
                            }
                        } // foreach( CswNbtViewRelationship viewRel in View.Root.GetAllChildrenOfType( CswEnumNbtViewNodeType.CswNbtViewRelationship ) )
                    }
                    View.save();
                } // foreach( DataRow relRow in relTable.Rows )

            } // if( null != ConstituentNT && ChemicalNTs.Count > 0 )
        } // update()
Exemplo n.º 9
0
        public override void update()
        {
            // Recreate the Inventory Level Grid view on Location OC
            CswNbtMetaDataObjectClass LocationOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.LocationClass );
            CswNbtMetaDataObjectClassProp InventoryLevelsOCP = LocationOC.getObjectClassProp( CswNbtObjClassLocation.PropertyName.InventoryLevels );

            CswNbtMetaDataObjectClass InventoryLvlsOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.InventoryLevelClass );
            CswNbtMetaDataObjectClassProp LocationOCP = InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Location );

            CswNbtView InventoryLevelsView = _CswNbtSchemaModTrnsctn.makeView();
            InventoryLevelsView.ViewName = CswNbtObjClassLocation.PropertyName.InventoryLevels;
            InventoryLevelsView.SetViewMode( CswEnumNbtViewRenderingMode.Grid );

            CswNbtViewRelationship LocationRel = InventoryLevelsView.AddViewRelationship( LocationOC, false );
            CswNbtViewRelationship InventoryLvlsRel = InventoryLevelsView.AddViewRelationship( LocationRel, CswEnumNbtViewPropOwnerType.Second, LocationOCP, true );
            InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.CurrentQuantity ), 1 );
            InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Level ), 2 );
            InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Material ), 3 );
            InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Status ), 4 );
            InventoryLevelsView.AddViewProperty( InventoryLvlsRel, InventoryLvlsOC.getObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Type ), 5 );

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( InventoryLevelsOCP, CswEnumNbtObjectClassPropAttributes.viewxml, InventoryLevelsView.ToString() );

        } // update()
Exemplo n.º 10
0
        protected void _getFilterProps(CswNbtViewEditorData Return)
        {
            string     viewStr  = CurrentView.ToString();
            CswNbtView TempView = new CswNbtView(_CswNbtResources);

            TempView.LoadXml(viewStr);
            HashSet <string> seenProps = new HashSet <string>();

            CswNbtViewRelationship Relationship = (CswNbtViewRelationship)TempView.FindViewNodeByArbitraryId(Request.Relationship.ArbitraryId);

            if (null != Relationship)
            {
                foreach (CswNbtViewProperty viewProp in Relationship.Properties.Where(p => CswEnumNbtFieldType.Button != p.FieldType))
                {
                    seenProps.Add(viewProp.TextLabel);
                    Return.Step4.Properties.Add(viewProp);
                }

                if (Relationship.SecondType.Equals(CswEnumNbtViewRelatedIdType.PropertySetId))
                {
                    CswNbtMetaDataPropertySet PropSet = _CswNbtResources.MetaData.getPropertySet(Relationship.SecondId);
                    if (null != PropSet)
                    {
                        foreach (CswNbtMetaDataObjectClass ObjClass in PropSet.getObjectClasses())
                        {
                            IEnumerable <CswNbtViewProperty> props = _getProps(ObjClass, TempView, seenProps, Relationship).Where(p => CswEnumNbtFieldType.Button != p.FieldType);;
                            foreach (CswNbtViewProperty vp in props)
                            {
                                Return.Step4.Properties.Add(vp);
                            }
                        }
                    }
                }
                else if (Relationship.SecondType.Equals(CswEnumNbtViewRelatedIdType.ObjectClassId))
                {
                    CswNbtMetaDataObjectClass ObjClass = _CswNbtResources.MetaData.getObjectClass(Relationship.SecondId);
                    if (null != ObjClass)
                    {
                        IEnumerable <CswNbtViewProperty> props = _getProps(ObjClass, TempView, seenProps, Relationship).Where(p => CswEnumNbtFieldType.Button != p.FieldType);;
                        foreach (CswNbtViewProperty vp in props)
                        {
                            Return.Step4.Properties.Add(vp);
                        }
                    }
                }
                else if (Relationship.SecondType.Equals(CswEnumNbtViewRelatedIdType.NodeTypeId))
                {
                    CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(Relationship.SecondId);
                    if (null != NodeType)
                    {
                        IEnumerable <CswNbtViewProperty> props = _getProps(NodeType, TempView, seenProps, Relationship).Where(p => CswEnumNbtFieldType.Button != p.FieldType);
                        foreach (CswNbtViewProperty vp in props)
                        {
                            Return.Step4.Properties.Add(vp);
                        }
                    }
                }
            }

            Collection <CswNbtViewProperty> sortedProps = new Collection <CswNbtViewProperty>();

            foreach (CswNbtViewProperty prop in Return.Step4.Properties.OrderBy(vp => vp.TextLabel))
            {
                sortedProps.Add(prop);
            }
            Return.Step4.Properties = sortedProps;
            Return.Step4.ViewJson   = TempView.ToJson().ToString();
        }
        } //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()
        }//_editView()

        private void _updateAssignedSDSOCP( CswNbtView View )
        {
            // Update the ViewXML on the AssignedSDSOCP
            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClassProp AssignedSDSOCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.AssignedSDS );
            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( AssignedSDSOCP, CswEnumNbtObjectClassPropAttributes.viewxml, View.ToString() );
        }
        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()
Exemplo n.º 14
0
 public override void update()
 {
     CswNbtMetaDataObjectClass MEPOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ManufacturerEquivalentPartClass );
     CswNbtMetaDataObjectClass ManufacturerOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ManufacturerClass );
     if( null != ManufacturerOC )
     {
         CswNbtMetaDataObjectClassProp MaterialOCP = MEPOC.getObjectClassProp( "Material" );
         if( null != MaterialOCP )
         {
             _CswNbtSchemaModTrnsctn.MetaData.DeleteObjectClassProp( MaterialOCP, true );
         }
         CswNbtMetaDataObjectClassProp ManufacturerOCP = MEPOC.getObjectClassProp( CswNbtObjClassManufacturerEquivalentPart.PropertyName.Manufacturer );
         if( null != ManufacturerOCP )
         {
             CswNbtView ManufacturerView = _CswNbtSchemaModTrnsctn.makeView();
             CswNbtViewRelationship parent = ManufacturerView.AddViewRelationship( ManufacturerOC, true );
             ManufacturerView.Visibility = CswEnumNbtViewVisibility.Property;
             ManufacturerView.ViewName = "Manufacturer";
             _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ManufacturerOCP, CswEnumNbtObjectClassPropAttributes.viewxml, ManufacturerView.ToString() );
             _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ManufacturerOCP, CswEnumNbtObjectClassPropAttributes.fktype, CswEnumNbtViewRelatedIdType.ObjectClassId.ToString() );
             _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ManufacturerOCP, CswEnumNbtObjectClassPropAttributes.fkvalue, ManufacturerOC.ObjectClassId.ToString() );
             _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( ManufacturerOCP, CswEnumNbtObjectClassPropAttributes.isrequired, true );
             CswNbtMetaDataObjectClassProp EPOCP = MEPOC.getObjectClassProp( CswNbtObjClassManufacturerEquivalentPart.PropertyName.EnterprisePart );
             _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( EPOCP, CswEnumNbtObjectClassPropAttributes.isrequired, true );
             foreach( CswNbtMetaDataNodeType MEPNT in MEPOC.getNodeTypes() )
             {
                 CswNbtMetaDataNodeTypeProp ManufacturerNTP = MEPNT.getNodeTypePropByObjectClassProp( ManufacturerOCP );
                 ManufacturerNTP.DesignNode.syncFromObjectClassProp();
                 CswNbtMetaDataNodeTypeProp EPNTP = MEPNT.getNodeTypePropByObjectClassProp( EPOCP );
                 EPNTP.DesignNode.syncFromObjectClassProp();
             }
         }
         _CswNbtSchemaModTrnsctn.createModuleObjectClassJunction( CswEnumNbtModuleName.MLM, MEPOC.ObjectClassId );
     }
 } // update()
        public override void update()
        {
            //All existing suppliers should have a vendor type of 'Sales'
            CswNbtMetaDataObjectClass vendorOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.VendorClass );
            foreach( CswNbtObjClassVendor vendorNode in vendorOC.getNodes( false, false, false, true ) )
            {
                vendorNode.VendorType.Value = CswNbtObjClassVendor.VendorTypes.Sales;
                vendorNode.postChanges( false );
            }

            //Remove the view filter on Materials
            CswNbtMetaDataObjectClass materialOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( NbtObjectClass.MaterialClass );
            CswNbtMetaDataObjectClassProp supplierOCP = materialOC.getObjectClassProp( CswNbtObjClassMaterial.PropertyName.Supplier );

            bool updatedOCP = false;
            foreach( CswNbtMetaDataNodeType materialNT in materialOC.getNodeTypes() )
            {
                CswNbtMetaDataNodeTypeProp supplierNTP = materialNT.getNodeTypePropByObjectClassProp( CswNbtObjClassMaterial.PropertyName.Supplier );
                CswNbtView oldSupplierView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( supplierNTP.ViewId );
                if( null != oldSupplierView )
                {
                    oldSupplierView.Delete();
                }
                CswNbtView newSupplierView = _CswNbtSchemaModTrnsctn.makeNewView( "Supplier", NbtViewVisibility.Property );
                newSupplierView.AddViewRelationship( vendorOC, true );
                newSupplierView.save();

                supplierNTP.ViewId = newSupplierView.ViewId;

                if( false == updatedOCP )
                {
                    updatedOCP = true;
                    _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( supplierOCP, CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.viewxml, newSupplierView.ToString() );
                }
            }

        } //Update()
        private void _createGridOCPFromNTP(CswNbtMetaDataObjectClass OC, String GridPropName)
        {
            CswNbtMetaDataObjectClassProp GridOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(OC, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName  = GridPropName,
                FieldType = CswEnumNbtFieldType.Grid
            });
            CswNbtMetaDataNodeType NT = OC.FirstNodeType;

            if (null != NT)
            {
                CswNbtMetaDataNodeTypeProp GridNTP = NT.getNodeTypeProp(GridPropName);
                if (null != GridNTP)
                {
                    CswNbtView GridView = _CswNbtSchemaModTrnsctn.restoreView(GridNTP.ViewId);
                    if (null != GridView)
                    {
                        _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(GridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, GridView.ToString());
                    }
                }
            }
        }
        private CswNbtMetaDataObjectClass _createPermissionGroupClass(PermissionSetAttributes PermSet)
        {
            CswNbtMetaDataObjectClass PermissionGroupOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(PermSet.GroupClassName);

            if (null == PermissionGroupOC)
            {
                PermissionGroupOC = _CswNbtSchemaModTrnsctn.createObjectClass(PermSet.GroupClassName, "smallicons.png", false);

                _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionGroupOC)
                {
                    PropName    = CswNbtObjClassReportGroup.PropertyName.Name,
                    FieldType   = CswEnumNbtFieldType.Text,
                    IsRequired  = true,
                    SetValOnAdd = true
                });
                _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionGroupOC)
                {
                    PropName    = CswNbtObjClassReportGroup.PropertyName.Description,
                    FieldType   = CswEnumNbtFieldType.Memo,
                    SetValOnAdd = true
                });

                CswNbtMetaDataObjectClassProp TargetsGridOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(PermissionGroupOC)
                {
                    PropName  = PermSet.GroupTargetPropName,
                    FieldType = CswEnumNbtFieldType.Grid
                });

                CswNbtMetaDataObjectClass     TargetOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(PermSet.TargetClassName);
                CswNbtMetaDataObjectClassProp GroupOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(new CswNbtWcfMetaDataModel.ObjectClassProp(TargetOC)
                {
                    PropName   = PermSet.TargetGroupPropName,
                    FieldType  = CswEnumNbtFieldType.Relationship,
                    IsFk       = true,
                    FkType     = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(),
                    FkValue    = PermissionGroupOC.ObjectClassId,
                    IsRequired = true
                });
                CswNbtView TargetsView = _CswNbtSchemaModTrnsctn.makeView();
                TargetsView.ViewName = PermSet.GroupTargetPropName;
                TargetsView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
                CswNbtViewRelationship GroupRel  = TargetsView.AddViewRelationship(PermissionGroupOC, false);
                CswNbtViewRelationship TargetRel = TargetsView.AddViewRelationship(GroupRel, CswEnumNbtViewPropOwnerType.Second, GroupOCP, true);
                for (int i = 0; i < PermSet.TargetsGridProperties.Count; i++)
                {
                    TargetsView.AddViewProperty(TargetRel, TargetOC.getObjectClassProp(PermSet.TargetsGridProperties[i]), i + 1);
                }
                _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(TargetsGridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, TargetsView.ToString());
            }
            return(PermissionGroupOC);
        }
Exemplo n.º 18
0
        public override void update()
        {
            //Fetch the data we need
            CswNbtMetaDataObjectClass SDSDocOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.SDSDocumentClass );
            CswNbtMetaDataObjectClassProp fileTypeOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.FileType );
            CswNbtMetaDataObjectClassProp archivedOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Archived );
            CswNbtMetaDataObjectClassProp formatOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Format );
            CswNbtMetaDataObjectClassProp languageOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Language );
            CswNbtMetaDataObjectClassProp fileOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.File );
            CswNbtMetaDataObjectClassProp linkOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Link );
            CswNbtMetaDataObjectClassProp ownerOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.Owner );
            CswNbtMetaDataObjectClassProp revisionDateOCP = SDSDocOC.getObjectClassProp( CswNbtObjClassSDSDocument.PropertyName.RevisionDate );

            CswNbtMetaDataObjectClass ChemicalOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswEnumNbtObjectClass.ChemicalClass );
            CswNbtMetaDataObjectClassProp AssignedSDS_OCP = ChemicalOC.getObjectClassProp( CswNbtObjClassChemical.PropertyName.AssignedSDS );

            //Find the relationship to add the prop to
            CswNbtView AssignedSDSView = _CswNbtSchemaModTrnsctn.ViewSelect.restoreView( AssignedSDS_OCP.ViewXml );
            AssignedSDSView.Clear();
            AssignedSDSView.SetVisibility( CswEnumNbtViewVisibility.Property, null, null );

            CswNbtViewRelationship chemLvl = AssignedSDSView.AddViewRelationship( ChemicalOC, false );
            CswNbtViewRelationship sdsLvl = AssignedSDSView.AddViewRelationship( chemLvl, CswEnumNbtViewPropOwnerType.Second, ownerOCP, true );

            AssignedSDSView.AddViewPropertyAndFilter( sdsLvl,
                                                        MetaDataProp : archivedOCP,
                                                        SubFieldName : CswEnumNbtSubFieldName.Checked,
                                                        Value : false.ToString(),
                                                        FilterMode : CswEnumNbtFilterMode.Equals,
                                                        ShowInGrid : false );

            AssignedSDSView.AddViewProperty( sdsLvl, revisionDateOCP, 1 );
            AssignedSDSView.AddViewProperty( sdsLvl, formatOCP, 5 );
            AssignedSDSView.AddViewProperty( sdsLvl, languageOCP, 4 );
            AssignedSDSView.AddViewProperty( sdsLvl, fileOCP, 2 );
            AssignedSDSView.AddViewProperty( sdsLvl, linkOCP, 3 );
            CswNbtViewProperty fileTypeVP = AssignedSDSView.AddViewProperty( sdsLvl, fileTypeOCP );
            fileTypeVP.ShowInGrid = false;

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( AssignedSDS_OCP, CswEnumNbtObjectClassPropAttributes.viewxml, AssignedSDSView.ToString() );

        } // 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());
            }
        }
        private void _upgradeControlZoneToObjectClass()
        {
            CswNbtMetaDataObjectClass ControlZoneOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.ControlZoneClass);

            if (null == ControlZoneOC)
            {
                ControlZoneOC = _CswNbtSchemaModTrnsctn.createObjectClass(CswEnumNbtObjectClass.ControlZoneClass, "folder.png", false);
                _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName   = CswNbtObjClassControlZone.PropertyName.Name,
                    FieldType  = CswEnumNbtFieldType.Text,
                    IsRequired = true,
                    IsUnique   = true
                });
                _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName       = CswNbtObjClassControlZone.PropertyName.MAQOffset,
                    FieldType      = CswEnumNbtFieldType.Number,
                    NumberMinValue = 0,
                    NumberMaxValue = 100
                });
                CswNbtMetaDataObjectClass FCEASOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(CswEnumNbtObjectClass.FireClassExemptAmountSetClass);
                _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName   = CswNbtObjClassControlZone.PropertyName.FireClassSetName,
                    FieldType  = CswEnumNbtFieldType.Relationship,
                    IsRequired = true,
                    IsFk       = true,
                    FkType     = CswEnumNbtViewRelatedIdType.ObjectClassId.ToString(),
                    FkValue    = FCEASOC.ObjectClassId
                });
                CswNbtMetaDataObjectClassProp LocationsOCP = _CswNbtSchemaModTrnsctn.createObjectClassProp(ControlZoneOC, new CswNbtWcfMetaDataModel.ObjectClassProp
                {
                    PropName  = CswNbtObjClassControlZone.PropertyName.Locations,
                    FieldType = CswEnumNbtFieldType.Grid
                });
                CswNbtMetaDataNodeType ControlZoneNT = _CswNbtSchemaModTrnsctn.MetaData.getNodeType("Control Zone");
                if (null != ControlZoneNT)
                {
                    CswNbtMetaDataNodeTypeProp CZLocationsNTP = ControlZoneNT.getNodeTypeProp("Locations");
                    if (null != CZLocationsNTP)
                    {
                        CswNbtView CZLocationsView = _CswNbtSchemaModTrnsctn.restoreView(CZLocationsNTP.ViewId);
                        if (null != CZLocationsView)
                        {
                            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(LocationsOCP, CswEnumNbtObjectClassPropAttributes.viewxml, CZLocationsView.ToString());
                        }
                    }
                    _CswNbtSchemaModTrnsctn.MetaData.ConvertObjectClass(ControlZoneNT, ControlZoneOC);
                }
            }
        }
Exemplo n.º 21
0
 private void _makeGridView( string RootOCName, string RootGridOCPName, string RelOCName, string RelOCPName, List<String> RelOCPNames )
 {
     CswNbtMetaDataObjectClass RootOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( RootOCName );
     CswNbtMetaDataObjectClass RelOC = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( RelOCName );
     CswNbtMetaDataObjectClassProp GridOCP = RootOC.getObjectClassProp( RootGridOCPName );
     CswNbtMetaDataObjectClassProp RelOCP = RelOC.getObjectClassProp( RelOCPName );
     CswNbtView GridView = _CswNbtSchemaModTrnsctn.makeSafeView( RootGridOCPName, CswEnumNbtViewVisibility.Property );
     GridView.ViewName = RootGridOCPName;
     GridView.ViewMode = CswEnumNbtViewRenderingMode.Grid;
     GridView.Root.ChildRelationships.Clear();
     CswNbtViewRelationship RootRel = GridView.AddViewRelationship( RootOC, false );
     CswNbtViewRelationship Rel = GridView.AddViewRelationship( RootRel, CswEnumNbtViewPropOwnerType.Second, RelOCP, true );
     for( int i = 0; i < RelOCPNames.Count; i++ )
     {
         GridView.AddViewProperty( Rel, RelOC.getObjectClassProp( RelOCPNames[i] ), i + 1 );
     }
     GridView.save();
     _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp( GridOCP, CswEnumNbtObjectClassPropAttributes.viewxml, GridView.ToString() );
     foreach( CswNbtMetaDataNodeType RootNT in RootOC.getNodeTypes() )
     {
         CswNbtMetaDataNodeTypeProp GridNTP = RootNT.getNodeTypePropByObjectClassProp( GridOCP );
         GridNTP.ViewId = GridView.ViewId;
     }
 }