/// <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); }
/// <summary>Inserts a ClearingBroker 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 clearingBrokerId = parameters["clearingBrokerId"]; // Call the internal method to complete the operation. ClearingBroker.Archive(adoTransaction, sqlTransaction, rowVersion, clearingBrokerId); }
/// <summary>Inserts a ClearingBroker 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 advertisementStylesheetId = parameters["advertisementStylesheetId"].Value; object destinationOrderDetailStylesheetId = parameters["destinationOrderDetailStylesheetId"].Value; object destinationOrderStylesheetId = parameters["destinationOrderStylesheetId"].Value; object executionDetailStylesheetId = parameters["executionDetailStylesheetId"].Value; object executionStylesheetId = parameters["executionStylesheetId"].Value; object matchStylesheetId = parameters["matchStylesheetId"].Value; object matchHistoryStylesheetId = parameters["matchHistoryStylesheetId"].Value; int partyTypeCode = parameters["partyTypeCode"]; object sourceOrderDetailStylesheetId = parameters["sourceOrderDetailStylesheetId"].Value; object sourceOrderStylesheetId = parameters["sourceOrderStylesheetId"].Value; object workingOrderStylesheetId = parameters["workingOrderStylesheetId"].Value; object buyMarketValueThreshold = parameters["buyMarketValueThreshold"].Value; object buyQuantityThreshold = parameters["buyQuantityThreshold"].Value; object sellMarketValueThreshold = parameters["sellMarketValueThreshold"].Value; object sellQuantityThreshold = parameters["sellQuantityThreshold"].Value; object connected = parameters["connected"].Value; object phone = parameters["phone"].Value; string symbol = parameters["symbol"]; string shortName = parameters["shortName"]; 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 clearingBrokerId = ClearingBroker.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, advertisementStylesheetId, destinationOrderDetailStylesheetId, destinationOrderStylesheetId, executionDetailStylesheetId, executionStylesheetId, matchStylesheetId, matchHistoryStylesheetId, partyTypeCode, sourceOrderDetailStylesheetId, sourceOrderStylesheetId, workingOrderStylesheetId, buyMarketValueThreshold, buyQuantityThreshold, sellMarketValueThreshold, sellQuantityThreshold, connected, phone, symbol, shortName, typeCode); // Return values. parameters["rowVersion"] = rowVersion; parameters.Return = clearingBrokerId; }
/// <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(); }