コード例 #1
0
        public override void update()
        {
            CswNbtMetaDataObjectClass ContDispTransOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.ContainerDispenseTransactionClass );
            CswNbtMetaDataObjectClassProp DispensedDate = ContDispTransOc.getObjectClassProp( CswNbtObjClassContainerDispenseTransaction.DispensedDatePropertyName );

            _CswNbtSchemaModTrnsctn.MetaData.UpdateObjectClassProp(
                DispensedDate,
                CswNbtMetaDataObjectClassProp.ObjectClassPropAttributes.extended,
                ChemSW.Nbt.PropTypes.CswNbtNodePropDateTime.DateDisplayMode.DateTime.ToString()
            );

            CswNbtMetaDataNodeType ContDispTransNt = ContDispTransOc.getLatestVersionNodeTypes().FirstOrDefault();
            if( null == ContDispTransNt )
            {
                CswStatusMessage Msg = new CswStatusMessage
                {
                    AppType = AppType.SchemUpdt,
                    ContentType = ContentType.Error
                };
                Msg.Attributes.Add( Log.LegalAttribute.escoteric_message, "Could not get a Container Dispense Transaction NodeType" );
                _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );
            }
            else
            {
                CswNbtView GridView = _CswNbtSchemaModTrnsctn.restoreView( "Container Container Dispense Transactions Grid Property View" );
                if( GridView != null )
                {
                    GridView.ViewName = "Container Dispense Transactions";
                    GridView.save();
                }
            }
        }//Update()
コード例 #2
0
        }//Update()

        private void makeDispenseTransactionGridView( CswNbtView GridView, CswNbtMetaDataNodeType RootNt )
        {
            CswNbtMetaDataObjectClass ContDispTransOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.ContainerDispenseTransactionClass );
            CswNbtMetaDataNodeType ContDispTransNt = ContDispTransOc.getLatestVersionNodeTypes().FirstOrDefault();
            if( null == ContDispTransNt )
            {
                CswStatusMessage Msg = new CswStatusMessage
                {
                    AppType = AppType.SchemUpdt,
                    ContentType = ContentType.Error
                };
                Msg.Attributes.Add( Log.LegalAttribute.escoteric_message, "Could not get a Container Dispense Transaction NodeType" );
                _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );
            }
            else
            {
                CswNbtMetaDataNodeTypeProp SourceContainerNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.SourceContainerPropertyName );
                CswNbtMetaDataNodeTypeProp DestinationContainerNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.DestinationContainerPropertyName );
                CswNbtMetaDataNodeTypeProp QuantityDispensedNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.QuantityDispensedPropertyName );
                CswNbtMetaDataNodeTypeProp TypeNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.TypePropertyName );
                CswNbtMetaDataNodeTypeProp DispensedDateNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.DispensedDatePropertyName );
                CswNbtMetaDataNodeTypeProp RemainingSourceContainerQuantityNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.RemainingSourceContainerQuantityPropertyName );
                CswNbtMetaDataNodeTypeProp RequestNtp = ContDispTransNt.getNodeTypePropByObjectClassProp( CswNbtObjClassContainerDispenseTransaction.RequestItemPropertyName );

                GridView.Root.ChildRelationships.Clear();
                GridView.ViewName = RootNt.NodeTypeName + " Container Dispense Transactions Grid Property View";
                GridView.Visibility = NbtViewVisibility.Property;
                GridView.ViewMode = NbtViewRenderingMode.Grid;
                GridView.Category = "Dispenses";

                CswNbtViewRelationship RootRel = GridView.AddViewRelationship( RootNt, false );

                if( null == SourceContainerNtp )
                {
                    CswStatusMessage Msg = new CswStatusMessage
                                                {
                                                    AppType = AppType.SchemUpdt,
                                                    ContentType = ContentType.Error
                                                };
                    Msg.Attributes.Add( Log.LegalAttribute.escoteric_message, "Container Dispense Transaction grids of this type are not supported." );
                    _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );
                }
                else
                {
                    CswNbtViewRelationship SrcContDispTransRel = GridView.AddViewRelationship( RootRel, NbtViewPropOwnerType.Second, SourceContainerNtp, false );

                    CswNbtViewProperty SourceContainerVp = GridView.AddViewProperty( SrcContDispTransRel, SourceContainerNtp );
                    SourceContainerVp.Order = 1;
                    SourceContainerVp.SortBy = true;
                    SourceContainerVp.SortMethod = NbtViewPropertySortMethod.Descending;

                    CswNbtViewProperty DispensedDateVp = GridView.AddViewProperty( SrcContDispTransRel, DispensedDateNtp );
                    DispensedDateVp.Order = 2;
                    DispensedDateVp.SortBy = true;
                    DispensedDateVp.SortMethod = NbtViewPropertySortMethod.Descending;

                    CswNbtViewProperty DestinationContainerVp = GridView.AddViewProperty( SrcContDispTransRel, DestinationContainerNtp );
                    DestinationContainerVp.Order = 3;
                    DestinationContainerVp.SortBy = true;
                    DestinationContainerVp.SortMethod = NbtViewPropertySortMethod.Descending;

                    CswNbtViewProperty TypeVp = GridView.AddViewProperty( SrcContDispTransRel, TypeNtp );
                    TypeVp.Order = 4;

                    CswNbtViewProperty QuantityDispensedVp = GridView.AddViewProperty( SrcContDispTransRel, QuantityDispensedNtp );
                    QuantityDispensedVp.Order = 5;

                    CswNbtViewProperty RemainingSourceContainerQuantityVp = GridView.AddViewProperty( SrcContDispTransRel, RemainingSourceContainerQuantityNtp );
                    RemainingSourceContainerQuantityVp.Order = 6;

                    CswNbtViewProperty RequestVp = GridView.AddViewProperty( SrcContDispTransRel, RequestNtp );
                    RequestVp.Order = 7;

                    GridView.save();
                }
            }
        }
コード例 #3
0
        public override void update()
        {
            CswNbtMetaDataObjectClass InventoryLevelOc = _CswNbtSchemaModTrnsctn.createObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.InventoryLevelClass, "docs.gif", true, false );
            CswNbtMetaDataObjectClass MaterialOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass );
            CswNbtMetaDataObjectClassProp IlMaterialOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.Material,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.Relationship,
                IsFk = true,
                FkType = NbtViewRelatedIdType.ObjectClassId.ToString(),
                FkValue = MaterialOc.ObjectClassId,
                IsRequired = true,
                IsCompoundUnique = true
            } );

            CswNbtMetaDataObjectClassProp IlLocationOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.Location,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.Location,
                IsRequired = true,
                IsCompoundUnique = true
            } );

            CswNbtMetaDataObjectClassProp IlTypeOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.Type,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.List,
                ListOptions = CswNbtObjClassInventoryLevel.Types.Options.ToString(),
                IsRequired = true,
                IsCompoundUnique = true
            } );

            CswNbtMetaDataObjectClassProp IlLevelOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.Level,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.Quantity,
                IsRequired = true
            } );

            _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.Subscribe,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.UserSelect,
                SetValOnAdd = true
            } );

            _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.LastNotified,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.DateTime,
                ServerManaged = true
            } );

            CswNbtMetaDataObjectClassProp IlStatusOcp = _CswNbtSchemaModTrnsctn.createObjectClassProp( InventoryLevelOc, new CswNbtWcfMetaDataModel.ObjectClassProp
            {
                PropName = CswNbtObjClassInventoryLevel.PropertyName.Status,
                FieldType = CswNbtMetaDataFieldType.NbtFieldType.List,
                ListOptions = CswNbtObjClassInventoryLevel.Statuses.Options.ToString(),
                ServerManaged = true
            } );
            _CswNbtSchemaModTrnsctn.MetaData.SetObjectClassPropDefaultValue( IlStatusOcp, IlStatusOcp.getFieldTypeRule().SubFields.Default.Name, CswNbtObjClassInventoryLevel.Statuses.Ok );

            _CswNbtSchemaModTrnsctn.createModuleObjectClassJunction( CswNbtResources.CswNbtModule.CISPro, InventoryLevelOc.ObjectClassId );

            CswNbtMetaDataNodeType InventoryLevelNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "Inventory Level" );
            if( null != InventoryLevelNt && InventoryLevelNt.ObjectClassId != InventoryLevelOc.ObjectClassId )
            {
                InventoryLevelNt = _CswNbtSchemaModTrnsctn.MetaData.getNodeType( "CISPro Inventory Level" );
            }
            if( null != InventoryLevelNt && InventoryLevelNt.ObjectClassId != InventoryLevelOc.ObjectClassId )
            {
                CswStatusMessage Msg = new CswStatusMessage
                                            {
                                                AppType = AppType.SchemUpdt,
                                                ContentType = ContentType.Error
                                            };
                Msg.Attributes.Add( ChemSW.Log.LegalAttribute.exoteric_message, "Nodetypes 'Inventory Level' and 'CISPro Inventory Level' already exist and are not of the InventoryLevel Object Class." );
                _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );
            }
            if( null == InventoryLevelNt )
            {
                InventoryLevelNt = _CswNbtSchemaModTrnsctn.MetaData.makeNewNodeType( new CswNbtWcfMetaDataModel.NodeType( InventoryLevelOc )
                                                                         {
                                                                             NodeTypeName = "Inventory Level",
                                                                             Category = "Materials",
                                                                         } );
                CswNbtMetaDataNodeTypeProp Material = InventoryLevelNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Material );
                CswNbtMetaDataNodeTypeProp Level = InventoryLevelNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Level );
                CswNbtMetaDataNodeTypeProp Type = InventoryLevelNt.getNodeTypePropByObjectClassProp( CswNbtObjClassInventoryLevel.PropertyName.Type );
                InventoryLevelNt.addNameTemplateText( Material.PropName );
                InventoryLevelNt.addNameTemplateText( Type.PropName );
                InventoryLevelNt.addNameTemplateText( Level.PropName );
            }

            foreach( CswNbtMetaDataNodeType MaterialNt in MaterialOc.getLatestVersionNodeTypes() )
            {
                CswNbtMetaDataNodeTypeTab PhysicalTab = MaterialNt.getNodeTypeTab( "Physical Tab" );
                if( null != PhysicalTab )
                {
                    PhysicalTab.TabName = "Physical";
                }
                else
                {
                    PhysicalTab = MaterialNt.getNodeTypeTab( "Physical" );
                    if( null == PhysicalTab )
                    {
                        PhysicalTab = _CswNbtSchemaModTrnsctn.MetaData.makeNewTab( MaterialNt, "Physical", MaterialNt.getNodeTypeTabIds().Count );
                    }
                }
                CswNbtMetaDataNodeTypeProp LevelsNtp = _CswNbtSchemaModTrnsctn.MetaData.makeNewProp( new CswNbtWcfMetaDataModel.NodeTypeProp( MaterialNt, _CswNbtSchemaModTrnsctn.MetaData.getFieldType( CswNbtMetaDataFieldType.NbtFieldType.Grid ), "Inventory Levels" )
                {
                    TabId = PhysicalTab.TabId
                } );
                LevelsNtp.Extended = CswNbtNodePropGrid.GridPropMode.Link.ToString();

                CswNbtView LevelsView = _CswNbtSchemaModTrnsctn.restoreView( LevelsNtp.ViewId );
                if( null == LevelsView )
                {
                    LevelsView = _CswNbtSchemaModTrnsctn.makeView();
                    LevelsNtp.ViewId = LevelsView.ViewId;
                }

                LevelsView.Root.ChildRelationships.Clear();
                LevelsView.ViewMode = NbtViewRenderingMode.Grid;
                LevelsView.Visibility = NbtViewVisibility.Property;

                CswNbtViewRelationship RootRel = LevelsView.AddViewRelationship( MaterialNt, true );
                CswNbtViewRelationship LevelRel = LevelsView.AddViewRelationship( RootRel, NbtViewPropOwnerType.Second, IlMaterialOcp, true );
                LevelsView.AddViewProperty( LevelRel, IlTypeOcp );
                LevelsView.AddViewProperty( LevelRel, IlLevelOcp );
                LevelsView.AddViewProperty( LevelRel, IlLocationOcp );
                LevelsView.AddViewProperty( LevelRel, IlStatusOcp );
                LevelsView.save();
            }

        }//Update()
コード例 #4
0
        }//Update()


        private void makeRequestGridView( CswNbtView GridView, CswNbtMetaDataNodeType RootNt )
        {
            CswNbtMetaDataObjectClass RequestOc = _CswNbtSchemaModTrnsctn.MetaData.getObjectClass( CswNbtMetaDataObjectClass.NbtObjectClass.RequestClass );
            CswNbtMetaDataNodeType RequestNt = RequestOc.getLatestVersionNodeTypes().FirstOrDefault();
            if( null == RequestNt )
            {
                CswStatusMessage Msg = new CswStatusMessage
                {
                    AppType = AppType.SchemUpdt,
                    ContentType = ContentType.Error
                };
                Msg.Attributes.Add( ChemSW.Log.LegalAttribute.exoteric_message, "Could not get a Request NodeType" );
                _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );
            }
            else
            {

                CswNbtMetaDataNodeTypeProp NameNtp =
                    RequestNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequest.PropertyName.Name.ToString() );
                CswNbtMetaDataNodeTypeProp SubmittedDateNtp =
                    RequestNt.getNodeTypePropByObjectClassProp(
                        CswNbtObjClassRequest.PropertyName.SubmittedDate.ToString() );
                CswNbtMetaDataNodeTypeProp CompletedDateNtpNtp =
                    RequestNt.getNodeTypePropByObjectClassProp(
                        CswNbtObjClassRequest.PropertyName.CompletedDate.ToString() );
                CswNbtMetaDataNodeTypeProp RequestorNtp =
                    RequestNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequest.PropertyName.Requestor.ToString() );

                CswNbtMetaDataObjectClass RequestItemOc =
                    _CswNbtSchemaModTrnsctn.MetaData.getObjectClass(
                        CswNbtMetaDataObjectClass.NbtObjectClass.RequestItemClass );
                CswNbtMetaDataNodeType RequestItemNt = RequestItemOc.getLatestVersionNodeTypes().FirstOrDefault();
                if( null == RequestItemNt )
                {
                    CswStatusMessage Msg = new CswStatusMessage
                    {
                        AppType = AppType.SchemUpdt,
                        ContentType = ContentType.Error
                    };
                    Msg.Attributes.Add( ChemSW.Log.LegalAttribute.exoteric_message, "Could not get a Request Item NodeType" );
                    _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );

                }
                else
                {
                    CswNbtMetaDataNodeTypeProp TypeNtp =
                        RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Type );
                    CswNbtMetaDataNodeTypeProp StatusNtp =
                        RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Status );
                    CswNbtMetaDataNodeTypeProp ExternalOrderNoNtp =
                        RequestItemNt.getNodeTypePropByObjectClassProp(
                            CswNbtObjClassRequestItem.PropertyName.ExternalOrderNumber );
                    CswNbtMetaDataNodeTypeProp NumberNtp =
                        RequestItemNt.getNodeTypePropByObjectClassProp( CswNbtObjClassRequestItem.PropertyName.Number );

                    GridView.Root.ChildRelationships.Clear();
                    GridView.ViewName = RootNt.NodeTypeName + " Requested Items";
                    GridView.Visibility = NbtViewVisibility.Property;
                    GridView.ViewMode = NbtViewRenderingMode.Grid;
                    GridView.Category = "Requests";

                    CswNbtViewRelationship RootRel = GridView.AddViewRelationship( RootNt, false );

                    CswNbtMetaDataNodeTypeProp RelationshipToRootNtp = null;
                    switch( RootNt.getObjectClass().ObjectClass )
                    {
                        case CswNbtMetaDataObjectClass.NbtObjectClass.MaterialClass:
                            RelationshipToRootNtp =
                                RequestItemNt.getNodeTypePropByObjectClassProp(
                                    CswNbtObjClassRequestItem.PropertyName.Material );
                            break;

                        case CswNbtMetaDataObjectClass.NbtObjectClass.ContainerClass:
                            RelationshipToRootNtp =
                                RequestItemNt.getNodeTypePropByObjectClassProp(
                                    CswNbtObjClassRequestItem.PropertyName.Container );
                            break;
                        default:
                            CswStatusMessage Msg = new CswStatusMessage
                                                       {
                                                           AppType = AppType.SchemUpdt,
                                                           ContentType = ContentType.Error
                                                       };
                            Msg.Attributes.Add( ChemSW.Log.LegalAttribute.exoteric_message, "Request grids of this type are not supported." );
                            _CswNbtSchemaModTrnsctn.CswLogger.send( Msg );
                            break;
                    }
                    if( null != RelationshipToRootNtp )
                    {
                        CswNbtViewRelationship RequestItemRel = GridView.AddViewRelationship( RootRel,
                                                                                             NbtViewPropOwnerType.Second,
                                                                                             RelationshipToRootNtp,
                                                                                             false );
                        CswNbtMetaDataNodeTypeProp RiRequestNtp =
                            RequestItemNt.getNodeTypePropByObjectClassProp(
                                CswNbtObjClassRequestItem.PropertyName.Request );
                        CswNbtViewRelationship RequestRel = GridView.AddViewRelationship( RequestItemRel,
                                                                                         NbtViewPropOwnerType.First,
                                                                                         RiRequestNtp, false );

                        CswNbtViewProperty CompletedVp = GridView.AddViewProperty( RequestRel, CompletedDateNtpNtp );
                        CompletedVp.Order = 3;
                        CompletedVp.SortBy = true;
                        CompletedVp.SortMethod = NbtViewPropertySortMethod.Descending;

                        CswNbtViewProperty SubmittedVp = GridView.AddViewProperty( RequestRel, SubmittedDateNtp );
                        SubmittedVp.Order = 2;
                        SubmittedVp.SortMethod = NbtViewPropertySortMethod.Descending;

                        CswNbtViewProperty NameVp = GridView.AddViewProperty( RequestRel, NameNtp );
                        NameVp.Order = 1;
                        NameVp.SortMethod = NbtViewPropertySortMethod.Descending;

                        CswNbtViewProperty RequestorVp = GridView.AddViewProperty( RequestRel, RequestorNtp );
                        RequestorVp.Order = 4;

                        CswNbtViewProperty TypeVp = GridView.AddViewProperty( RequestItemRel, TypeNtp );
                        TypeVp.Order = 5;
                        CswNbtViewProperty NumberVp = GridView.AddViewProperty( RequestItemRel, NumberNtp );
                        NumberVp.Order = 6;
                        CswNbtViewProperty OrderVp = GridView.AddViewProperty( RequestItemRel, ExternalOrderNoNtp );
                        OrderVp.Order = 7;
                        CswNbtViewProperty StatusVp = GridView.AddViewProperty( RequestItemRel, StatusNtp );
                        StatusVp.Order = 8;

                        GridView.save();
                    }
                }
            }
        }