public override void update() { // Adapted from CswNbtSessionDataMgr.removeAllSessionData() CswTableSelect NodesSelect = _CswNbtSchemaModTrnsctn.makeCswTableSelect( "30983_nodes_select", "nodes" ); DataTable NodesTable = NodesSelect.getTable( new CswCommaDelimitedString { "nodeid" }, "where istemp = '1'" ); if( NodesTable.Rows.Count > 0 ) { Collection<CswNbtNode> DoomedNodes = new Collection<CswNbtNode>(); foreach( DataRow Row in NodesTable.Rows ) { CswPrimaryKey NodeId = new CswPrimaryKey( "nodes", CswConvert.ToInt32( Row["nodeid"] ) ); if( CswTools.IsPrimaryKey( NodeId ) ) { CswNbtNode TempNode = _CswNbtSchemaModTrnsctn.Nodes[NodeId]; if( null != TempNode ) { DoomedNodes.Add( TempNode ); } } } foreach( CswNbtNode DoomedNode in DoomedNodes ) { DoomedNode.delete( DeleteAllRequiredRelatedNodes: true, OverridePermissions: true ); } } //there are nodes rows } // update()
} // removeSessionData(CswNbtSessionDataId) public void removeAllSessionData( string SessionId ) { if( SessionId != string.Empty ) { if( _CswNbtResources.IsInitializedForDbAccess ) { CswTableUpdate SessionDataUpdate = _CswNbtResources.makeCswTableUpdate( "removeSessionData_update", SessionDataTableName ); DataTable SessionDataTable = SessionDataUpdate.getTable( "where " + SessionDataColumn_SessionId + " = '" + SessionId + "'" ); if( SessionDataTable.Rows.Count > 0 ) { Collection<DataRow> DoomedRows = new Collection<DataRow>(); foreach( DataRow Row in SessionDataTable.Rows ) DoomedRows.Add( Row ); foreach( DataRow Row in DoomedRows ) Row.Delete(); SessionDataUpdate.update( SessionDataTable ); }//there are session records CswArbitrarySelect SessionNodeSelect = _CswNbtResources.makeCswArbitrarySelect( "removeSessionData_update_nodes", "select nodeid from nodes where istemp = 1 and sessionid = :sessionid " ); SessionNodeSelect.addParameter( "sessionid", SessionId ); DataTable NodesTable = SessionNodeSelect.getTable(); if( NodesTable.Rows.Count > 0 ) { Collection<CswNbtNode> DoomedNodes = new Collection<CswNbtNode>(); foreach( DataRow Row in NodesTable.Rows ) { CswPrimaryKey NodeId = new CswPrimaryKey( "nodes", CswConvert.ToInt32( Row["nodeid"] ) ); if( CswTools.IsPrimaryKey( NodeId ) ) { CswNbtNode TempNode = _CswNbtResources.Nodes[NodeId]; if( null != TempNode ) { DoomedNodes.Add( TempNode ); } } } foreach( CswNbtNode DoomedNode in DoomedNodes ) { DoomedNode.delete( DeleteAllRequiredRelatedNodes : true, OverridePermissions : true ); } }//there are nodes rows }//Db resources are initialzied }//SessionId is not empty } // removeAllSessionData()