Esempio n. 1
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 new static void ArchiveChildren(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.BrokerLock);
     Execution.Archive(adoTransaction);
     BrokerAccount.Archive(adoTransaction);
     ClearingBroker.ArchiveChildren(adoTransaction);
 }
Esempio n. 2
0
        /// <summary>Inserts a BrokerAccount record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public 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            brokerAccountId = parameters["brokerAccountId"];

            // Call the internal method to complete the operation.
            BrokerAccount.Archive(adoTransaction, sqlTransaction, rowVersion, brokerAccountId);
        }
Esempio n. 3
0
        /// <summary>ArchiveChildrens a Broker 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="brokerId">The value for the BrokerId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        internal new static void ArchiveChildren(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int brokerId)
        {
            // Accessor for the Broker Table.
            ServerMarketData.BrokerDataTable brokerTable = ServerMarketData.Broker;
            // This record can be used to iterate through all the children.
            ServerMarketData.BrokerRow brokerRow = brokerTable.FindByBrokerId(brokerId);
            // Archive the child records.
            for (int index = 0; (index < brokerRow.GetExecutionRows().Length); index = (index + 1))
            {
                ServerMarketData.ExecutionRow childExecutionRow = brokerRow.GetExecutionRows()[index];
                Execution.Archive(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
            }
            for (int index = 0; (index < brokerRow.GetBrokerAccountRows().Length); index = (index + 1))
            {
                ServerMarketData.BrokerAccountRow childBrokerAccountRow = brokerRow.GetBrokerAccountRows()[index];
                BrokerAccount.Archive(adoTransaction, sqlTransaction, childBrokerAccountRow.RowVersion, childBrokerAccountRow.BrokerAccountId);
            }
            for (int index = 0; (index < brokerRow.GetClearingBrokerRows().Length); index = (index + 1))
            {
                ServerMarketData.ClearingBrokerRow childClearingBrokerRow = brokerRow.GetClearingBrokerRows()[index];
                ClearingBroker.ArchiveChildren(adoTransaction, sqlTransaction, childClearingBrokerRow.RowVersion, childClearingBrokerRow.ClearingBrokerId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            brokerRow[brokerTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(brokerRow);
            brokerRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Broker\" set \"IsArchived\" = 1 where \"BrokerId\"=@brokerId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@brokerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, brokerId));
            sqlCommand.ExecuteNonQuery();
        }