コード例 #1
0
        /// <summary>DeleteChildrens a Folder record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="rowVersion">the version number of this row.</param>
        /// <param name="folderId">The value for the FolderId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        internal static void DeleteChildren(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int folderId)
        {
            // Accessor for the Folder Table.
            ServerMarketData.FolderDataTable folderTable = ServerMarketData.Folder;
            // This record can be used to iterate through all the children.
            ServerMarketData.FolderRow folderRow = folderTable.FindByFolderId(folderId);
            // Delete the child records.
            for (int index = 0; (index < folderRow.GetSystemFolderRows().Length); index = (index + 1))
            {
                ServerMarketData.SystemFolderRow childSystemFolderRow = folderRow.GetSystemFolderRows()[index];
                SystemFolder.DeleteChildren(adoTransaction, sqlTransaction, childSystemFolderRow.RowVersion, childSystemFolderRow.SystemFolderId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            folderRow[folderTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(folderRow);
            folderRow.Delete();
            // Delete the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Folder\" set \"IsDeleted\" = 1 where \"FolderId\"=@folderId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@folderId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, folderId));
            sqlCommand.ExecuteNonQuery();
        }
コード例 #2
0
 /// <summary>Collects the table lock request(s) for an Update operation</summary>
 /// <param name="adoTransaction">A list of locks required for this operation.</param>
 internal static void DeleteChildren(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Delete' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.FolderLock);
     SystemFolder.DeleteChildren(adoTransaction);
 }