} // GetNodeCountForNodeType

        /// <summary>
        /// Returns the number of locked nodes for an object class
        /// </summary>
        public Int32 GetLockedNodeCountForObjectClass( Int32 ObjectClassId )
        {
            CswTableSelect NodesSelect = _CswNbtResources.makeCswTableSelect( "CswNbtActQuotas_SelectLockedNodes", "nodes" );
            string WhereClause = @"where nodetypeid in (select nodetypeid from nodetypes 
                                                         where objectclassid = " + ObjectClassId.ToString() + @") 
                                        and locked = '" + CswConvert.ToDbVal( true ).ToString() + @"'";
            return NodesSelect.getRecordCount( WhereClause );
        } // GetLockedNodeCountForObjectClass()
        public void getStatus(out Int32 RowsDone,
                              out Int32 RowsTotal,
                              out Int32 RowsError,
                              out Int32 ItemsDone,
                              out Int32 ItemsTotal)
        {
            RowsDone   = 0;
            RowsTotal  = 0;
            RowsError  = 0;
            ItemsDone  = 0;
            ItemsTotal = 0;

            if (false == string.IsNullOrEmpty(ImportDataTableName) && _CswNbtResources.isTableDefinedInDataBase(ImportDataTableName))
            {
                CswTableSelect  ImportDataSelect = _CswNbtResources.makeCswTableSelect("getStatus_data_select", ImportDataTableName);
                CswNbtImportDef BindingDef       = new CswNbtImportDef(_CswNbtResources, ImportDefinitionId);
                if (null != BindingDef && BindingDef.ImportOrder.Count > 0)
                {
                    // RowsDone
                    string RowsPendingWhereClause = string.Empty;
                    foreach (CswNbtImportDefOrder Order in BindingDef.ImportOrder.Values)
                    {
                        if (string.Empty != RowsPendingWhereClause)
                        {
                            RowsPendingWhereClause += " and ";
                        }
                        RowsPendingWhereClause += Order.PkColName + " is not null";
                    }
                    RowsDone = ImportDataSelect.getRecordCount("where " + CswNbtImportTables.ImportDataN.error + " = '" + CswConvert.ToDbVal(false) + "' and (" + RowsPendingWhereClause + ") ");

                    // ItemsPending
                    foreach (CswNbtImportDefOrder Order in BindingDef.ImportOrder.Values)
                    {
                        ItemsDone += ImportDataSelect.getRecordCount("where " + CswNbtImportTables.ImportDataN.error + " = '" + CswConvert.ToDbVal(false) + "' and " + Order.PkColName + " is not null ");
                    }

                    // And the rest
                    RowsTotal  = ImportDataSelect.getRecordCount();
                    RowsError  = ImportDataSelect.getRecordCount("where error = '" + CswConvert.ToDbVal(true) + "'");
                    ItemsTotal = RowsTotal * BindingDef.ImportOrder.Values.Count;
                } // if( null != BindingDef && BindingDef.ImportOrder.Count > 0 )
            }     // if( false == string.IsNullOrEmpty( ImportDataTableName ) && _CswNbtResources.isTableDefinedInDataBase( ImportDataTableName ) )
        }         // getStatus()
        } // GetLockedNodeCountForObjectClass()

        /// <summary>
        /// Returns the number of locked nodes for a nodetype
        /// </summary>
        public Int32 GetLockedNodeCountForNodeType( Int32 NodeTypeId )
        {
            Int32 ret = 0;
            CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType( NodeTypeId );
            if( NodeType != null )
            {
                CswTableSelect NodesSelect = _CswNbtResources.makeCswTableSelect( "CswNbtActQuotas_SelectLockedNodes", "nodes" );
                string WhereClause = @"where nodetypeid in (select nodetypeid from nodetypes
                                                             where firstversionid = " + NodeType.FirstVersionNodeTypeId.ToString() + @") 
                                        and locked = '" + CswConvert.ToDbVal( true ).ToString() + @"'";
                ret = NodesSelect.getRecordCount( WhereClause );
            }
            return ret;
        } // GetLockedNodeCountForNodeType()
        public void afterCreateNodeTypeProp(CswNbtMetaDataNodeTypeProp NodeTypeProp)
        {
            // Enforce only one Barcode property per nodetype
            CswTableSelect ProbeSelect          = _CswNbtFieldResources.CswNbtResources.makeCswTableSelect("barcode_check", "nodetype_props");
            Int32          ExistingBarcodeCount = ProbeSelect.getRecordCount("where nodetypeid=" + NodeTypeProp.NodeTypeId.ToString() +
                                                                             " and nodetypepropid <> " + NodeTypeProp.PropId +
                                                                             " and fieldtypeid=" + NodeTypeProp.FieldTypeId.ToString());

            if (ExistingBarcodeCount > 0)
            {
                throw (new CswDniException(CswEnumErrorType.Warning, "Nodetype already has a barcode", "Unable to add barcode node type property because the nodetype (" + NodeTypeProp.NodeTypeId.ToString() + ") already has a barcode"));
            }

            _CswNbtFieldTypeRuleDefault.afterCreateNodeTypeProp(NodeTypeProp);
        }