Exemple #1
0
        /// <summary>Inserts a SystemFolder record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public new static void Insert(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction  = parameters["adoTransaction"];
            SqlTransaction sqlTransaction  = parameters["sqlTransaction"];
            object         description     = parameters["description"].Value;
            object         externalId0     = parameters["externalId0"].Value;
            object         externalId1     = parameters["externalId1"].Value;
            object         externalId2     = parameters["externalId2"].Value;
            object         externalId3     = parameters["externalId3"].Value;
            object         externalId4     = parameters["externalId4"].Value;
            object         externalId5     = parameters["externalId5"].Value;
            object         externalId6     = parameters["externalId6"].Value;
            object         externalId7     = parameters["externalId7"].Value;
            object         groupPermission = parameters["groupPermission"].Value;
            object         hidden          = parameters["hidden"].Value;
            string         name            = parameters["name"];
            object         owner           = parameters["owner"].Value;
            object         ownerPermission = parameters["ownerPermission"].Value;
            object         readOnly        = parameters["readOnly"].Value;
            object         worldPermission = parameters["worldPermission"].Value;
            object         typeCode        = parameters["typeCode"].Value;
            // The rowVersion is passed back to the caller in the event it's needed for additional commands in the batch.
            long rowVersion = long.MinValue;
            // Call the internal method to complete the operation.
            int systemFolderId = SystemFolder.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, typeCode);

            // Return values.
            parameters["rowVersion"] = rowVersion;
            parameters.Return        = systemFolderId;
        }
Exemple #2
0
        /// <summary>ArchiveChildrens 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 ArchiveChildren(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);
            // Archive the child records.
            for (int index = 0; (index < folderRow.GetSystemFolderRows().Length); index = (index + 1))
            {
                ServerMarketData.SystemFolderRow childSystemFolderRow = folderRow.GetSystemFolderRows()[index];
                SystemFolder.ArchiveChildren(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();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Folder\" set \"IsArchived\" = 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();
        }
Exemple #3
0
        /// <summary>Inserts a SystemFolder record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public new static void Update(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction  = parameters["adoTransaction"];
            SqlTransaction sqlTransaction  = parameters["sqlTransaction"];
            long           rowVersion      = parameters["rowVersion"];
            object         description     = parameters["description"].Value;
            object         externalId0     = parameters["externalId0"].Value;
            object         externalId1     = parameters["externalId1"].Value;
            object         externalId2     = parameters["externalId2"].Value;
            object         externalId3     = parameters["externalId3"].Value;
            object         externalId4     = parameters["externalId4"].Value;
            object         externalId5     = parameters["externalId5"].Value;
            object         externalId6     = parameters["externalId6"].Value;
            object         externalId7     = parameters["externalId7"].Value;
            object         groupPermission = parameters["groupPermission"].Value;
            object         hidden          = parameters["hidden"].Value;
            object         name            = parameters["name"].Value;
            object         owner           = parameters["owner"].Value;
            object         ownerPermission = parameters["ownerPermission"].Value;
            object         readOnly        = parameters["readOnly"].Value;
            object         worldPermission = parameters["worldPermission"].Value;
            int            systemFolderId  = parameters["systemFolderId"];
            object         typeCode        = parameters["typeCode"].Value;

            // Call the internal method to complete the operation.
            SystemFolder.Update(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, systemFolderId, typeCode);
            // Return values.
            parameters["rowVersion"] = rowVersion;
        }
Exemple #4
0
        /// <summary>Inserts a SystemFolder record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public new static void Archive(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction = parameters["adoTransaction"];
            SqlTransaction sqlTransaction = parameters["sqlTransaction"];
            long           rowVersion     = parameters["rowVersion"];
            int            systemFolderId = parameters["systemFolderId"];

            // Call the internal method to complete the operation.
            SystemFolder.Archive(adoTransaction, sqlTransaction, rowVersion, systemFolderId);
        }
Exemple #5
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 ArchiveChildren(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.FolderLock);
     SystemFolder.ArchiveChildren(adoTransaction);
 }