Ejemplo n.º 1
0
        /// <summary>Archives a Status 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="statusCode">The value for the StatusCode column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        public static void Archive(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int statusCode)
        {
            // Accessor for the Status Table.
            ServerDataModel.StatusDataTable statusTable = ServerDataModel.Status;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.StatusRow statusRow = statusTable.FindByStatusCode(statusCode);
            if ((statusRow == null))
            {
                throw new Exception(string.Format("The Status table does not have an element identified by {0}", statusCode));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((statusRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < statusRow.GetBlockOrderRows().Length); index = (index + 1))
            {
                ServerDataModel.BlockOrderRow childBlockOrderRow = statusRow.GetBlockOrderRows()[index];
                BlockOrder.Archive(adoTransaction, sqlTransaction, childBlockOrderRow.RowVersion, childBlockOrderRow.BlockOrderId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            statusRow[statusTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(statusRow);
            statusRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Status\" set \"IsArchived\" = 1 where \"StatusCode\"=@statusCode");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@statusCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, statusCode));
            sqlCommand.ExecuteNonQuery();
        }
Ejemplo n.º 2
0
 /// <summary>Archives a BlockOrder 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="blockOrderId">The value for the BlockOrderId column.</param>
 /// <param name="archive">true to archive the object, false to unarchive it.</param>
 public static void Archive(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int blockOrderId)
 {
     // Accessor for the BlockOrder Table.
     ServerDataModel.BlockOrderDataTable blockOrderTable = ServerDataModel.BlockOrder;
     // Rule #1: Make sure the record exists before updating it.
     ServerDataModel.BlockOrderRow blockOrderRow = blockOrderTable.FindByBlockOrderId(blockOrderId);
     if ((blockOrderRow == null))
     {
         throw new Exception(string.Format("The BlockOrder table does not have an element identified by {0}", blockOrderId));
     }
     // Rule #2: Optimistic Concurrency Check
     if ((blockOrderRow.RowVersion != rowVersion))
     {
         throw new System.Exception("This record is busy.  Please try again later.");
     }
     // Archive the child records.
     for (int index = 0; (index < blockOrderRow.GetAllocationRows().Length); index = (index + 1))
     {
         ServerDataModel.AllocationRow childAllocationRow = blockOrderRow.GetAllocationRows()[index];
         Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
     }
     for (int index = 0; (index < blockOrderRow.GetBlockOrderTreeRowsByFKBlockOrderBlockOrderTreeChildId().Length); index = (index + 1))
     {
         ServerDataModel.BlockOrderTreeRow childBlockOrderTreeRow = blockOrderRow.GetBlockOrderTreeRowsByFKBlockOrderBlockOrderTreeChildId()[index];
         BlockOrderTree.Archive(adoTransaction, sqlTransaction, childBlockOrderTreeRow.RowVersion, childBlockOrderTreeRow.ParentId, childBlockOrderTreeRow.ChildId);
     }
     for (int index = 0; (index < blockOrderRow.GetBlockOrderTreeRowsByFKBlockOrderBlockOrderTreeParentId().Length); index = (index + 1))
     {
         ServerDataModel.BlockOrderTreeRow childBlockOrderTreeRow = blockOrderRow.GetBlockOrderTreeRowsByFKBlockOrderBlockOrderTreeParentId()[index];
         BlockOrderTree.Archive(adoTransaction, sqlTransaction, childBlockOrderTreeRow.RowVersion, childBlockOrderTreeRow.ParentId, childBlockOrderTreeRow.ChildId);
     }
     for (int index = 0; (index < blockOrderRow.GetExecutionRows().Length); index = (index + 1))
     {
         ServerDataModel.ExecutionRow childExecutionRow = blockOrderRow.GetExecutionRows()[index];
         Execution.Archive(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
     }
     for (int index = 0; (index < blockOrderRow.GetOrderRows().Length); index = (index + 1))
     {
         ServerDataModel.OrderRow childOrderRow = blockOrderRow.GetOrderRows()[index];
         Order.Archive(adoTransaction, sqlTransaction, childOrderRow.RowVersion, childOrderRow.OrderId);
     }
     for (int index = 0; (index < blockOrderRow.GetPlacementRows().Length); index = (index + 1))
     {
         ServerDataModel.PlacementRow childPlacementRow = blockOrderRow.GetPlacementRows()[index];
         Placement.Archive(adoTransaction, sqlTransaction, childPlacementRow.RowVersion, childPlacementRow.PlacementId);
     }
     // Increment the row version
     rowVersion = ServerDataModel.RowVersion.Increment();
     // Delete the record in the ADO database.
     blockOrderRow[blockOrderTable.RowVersionColumn] = rowVersion;
     adoTransaction.DataRows.Add(blockOrderRow);
     blockOrderRow.Delete();
     // Archive the record in the SQL database.
     SqlCommand sqlCommand = new SqlCommand("update \"BlockOrder\" set \"IsArchived\" = 1 where \"BlockOrderId\"=@blockOrderId");
     sqlCommand.Connection = sqlTransaction.Connection;
     sqlCommand.Transaction = sqlTransaction;
     sqlCommand.Parameters.Add(new SqlParameter("@blockOrderId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderId));
     sqlCommand.ExecuteNonQuery();
 }
Ejemplo n.º 3
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>
 public static void LockInsert(AdoTransaction adoTransaction, object blockOrderId, object accountId, object securityId, object settlementId, object brokerId, object positionTypeCode, object transactionTypeCode, object timeInForceCode, object orderTypeCode, object conditionCode, object createdUserId, object modifiedUserId)
 {
     // Lock the block order record.
     if (blockOrderId != null)
     {
         ServerDataModel.BlockOrderRow blockOrderRow = ServerDataModel.BlockOrder.FindByBlockOrderId((int)blockOrderId);
         if ((blockOrderRow != null))
         {
             adoTransaction.LockRequests.Add(new RowReaderRequest(blockOrderRow));
         }
     }
     // Lock the account record.
     if (accountId != null)
     {
         ServerDataModel.AccountRow accountRow = ServerDataModel.Account.FindByAccountId((int)accountId);
         if ((accountRow != null))
         {
             adoTransaction.LockRequests.Add(new RowReaderRequest(accountRow));
         }
     }
     // Lock the security record.
     if (securityId != null)
     {
         ServerDataModel.SecurityRow securityRow = ServerDataModel.Security.FindBySecurityId((int)securityId);
         if ((securityRow != null))
         {
             adoTransaction.LockRequests.Add(new RowReaderRequest(securityRow));
         }
     }
     // Lock the settlement record.
     if (settlementId != null)
     {
         ServerDataModel.SecurityRow settlementRow = ServerDataModel.Security.FindBySecurityId((int)settlementId);
         if ((settlementRow != null))
         {
             adoTransaction.LockRequests.Add(new RowReaderRequest(settlementRow));
         }
     }
     // Lock the broker record.
     if (brokerId != null)
     {
         ServerDataModel.BrokerRow brokerRow = ServerDataModel.Broker.FindByBrokerId((int)brokerId);
         if ((brokerRow != null))
         {
             adoTransaction.LockRequests.Add(new RowReaderRequest(brokerRow));
         }
     }
     // Lock the positionTypeCode record.
     if (positionTypeCode != null)
     {
         ServerDataModel.PositionTypeRow positionTypeRow = ServerDataModel.PositionType.FindByPositionTypeCode((int)positionTypeCode);
         if ((positionTypeRow != null))
         {
             adoTransaction.LockRequests.Add(new RowReaderRequest(positionTypeRow));
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>Deletes a TransactionType 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="transactionTypeCode">The value for the TransactionTypeCode column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        public static void Delete(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int transactionTypeCode)
        {
            // Accessor for the TransactionType Table.
            ServerDataModel.TransactionTypeDataTable transactionTypeTable = ServerDataModel.TransactionType;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.TransactionTypeRow transactionTypeRow = transactionTypeTable.FindByTransactionTypeCode(transactionTypeCode);
            if ((transactionTypeRow == null))
            {
                throw new Exception(string.Format("The TransactionType table does not have an element identified by {0}", transactionTypeCode));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((transactionTypeRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Delete the child records.
            for (int index = 0; (index < transactionTypeRow.GetAllocationRows().Length); index = (index + 1))
            {
                ServerDataModel.AllocationRow childAllocationRow = transactionTypeRow.GetAllocationRows()[index];
                Allocation.Delete(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < transactionTypeRow.GetBlockOrderRows().Length); index = (index + 1))
            {
                ServerDataModel.BlockOrderRow childBlockOrderRow = transactionTypeRow.GetBlockOrderRows()[index];
                BlockOrder.Delete(adoTransaction, sqlTransaction, childBlockOrderRow.RowVersion, childBlockOrderRow.BlockOrderId);
            }
            for (int index = 0; (index < transactionTypeRow.GetOrderRows().Length); index = (index + 1))
            {
                ServerDataModel.OrderRow childOrderRow = transactionTypeRow.GetOrderRows()[index];
                Order.Delete(adoTransaction, sqlTransaction, childOrderRow.RowVersion, childOrderRow.OrderId);
            }
            for (int index = 0; (index < transactionTypeRow.GetProposedOrderRows().Length); index = (index + 1))
            {
                ServerDataModel.ProposedOrderRow childProposedOrderRow = transactionTypeRow.GetProposedOrderRows()[index];
                ProposedOrder.Delete(adoTransaction, sqlTransaction, childProposedOrderRow.RowVersion, childProposedOrderRow.ProposedOrderId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            transactionTypeRow[transactionTypeTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(transactionTypeRow);
            transactionTypeRow.Delete();
            // Delete the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"TransactionType\" set \"IsDeleted\" = 1 where \"TransactionTypeCode\"=@transac" +
                                                   "tionTypeCode");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@transactionTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, transactionTypeCode));
            sqlCommand.ExecuteNonQuery();
        }
Ejemplo n.º 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>
 public static void LockUpdate(AdoTransaction adoTransaction, int orderId, object blockOrderId, object accountId, object securityId, object settlementId, object brokerId, object positionTypeCode, object transactionTypeCode, object timeInForceCode, object orderTypeCode, object conditionCode, object createdUserId, object modifiedUserId)
 {
     // This will create a request to lock this record for a write operation when the transaction begins.
     ServerDataModel.OrderRow orderRow = ServerDataModel.Order.FindByOrderId(orderId);
     if ((orderRow == null))
     {
         throw new Exception(string.Format("The Order table does not have an element identified by {0}", orderId));
     }
     adoTransaction.LockRequests.Add(new RowWriterRequest(orderRow));
     // Lock the block order record.
     if (blockOrderId != null)
     {
         ServerDataModel.BlockOrderRow blockOrderRow = ServerDataModel.BlockOrder.FindByBlockOrderId((int)blockOrderId);
         if ((blockOrderRow == null))
         {
             throw new Exception(string.Format("The Block Order table does not have an element identified by {0}", blockOrderId));
         }
         adoTransaction.LockRequests.Add(new RowReaderRequest(blockOrderRow));
     }
 }
Ejemplo n.º 6
0
        /// <summary>ArchiveChildrens a Blotter 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="blotterId">The value for the BlotterId 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 blotterId)
        {
            // Accessor for the Blotter Table.
            ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
            // This record can be used to iterate through all the children.
            ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
            // Archive the child records.
            for (int index = 0; (index < blotterRow.GetAccountRows().Length); index = (index + 1))
            {
                ServerDataModel.AccountRow childAccountRow = blotterRow.GetAccountRows()[index];
                Account.ArchiveChildren(adoTransaction, sqlTransaction, childAccountRow.RowVersion, childAccountRow.AccountId);
            }
            for (int index = 0; (index < blotterRow.GetBlotterMapRows().Length); index = (index + 1))
            {
                ServerDataModel.BlotterMapRow childBlotterMapRow = blotterRow.GetBlotterMapRows()[index];
                BlotterMap.Archive(adoTransaction, sqlTransaction, childBlotterMapRow.RowVersion, childBlotterMapRow.BlotterMapId);
            }
            for (int index = 0; (index < blotterRow.GetBlockOrderRows().Length); index = (index + 1))
            {
                ServerDataModel.BlockOrderRow childBlockOrderRow = blotterRow.GetBlockOrderRows()[index];
                BlockOrder.Archive(adoTransaction, sqlTransaction, childBlockOrderRow.RowVersion, childBlockOrderRow.BlockOrderId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            blotterRow[blotterTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(blotterRow);
            blotterRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Blotter\" set \"IsArchived\" = 1 where \"BlotterId\"=@blotterId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@blotterId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterId));
            sqlCommand.ExecuteNonQuery();
        }
Ejemplo n.º 7
0
 /// <summary>Inserts a BlockOrder record.</summary>
 /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
 /// <param name="blotterId">The value for the BlotterId column.</param>
 /// <param name="accountId">The value for the AccountId column.</param>
 /// <param name="securityId">The value for the SecurityId column.</param>
 /// <param name="settlementId">The value for the SettlementId column.</param>
 /// <param name="brokerId">The value for the BrokerId column.</param>
 /// <param name="statusCode">The value for the StatusCode column.</param>
 /// <param name="transactionTypeCode">The value for the TransactionTypeCode column.</param>
 /// <param name="timeInForceCode">The value for the TimeInForceCode column.</param>
 /// <param name="orderTypeCode">The value for the OrderTypeCode column.</param>
 /// <param name="conditionCode">The value for the ConditionCode column.</param>
 /// <param name="isDeleted">The value for the IsDeleted column.</param>
 /// <param name="isAgency">The value for the IsAgency column.</param>
 /// <param name="quantityExecuted">The value for the QuantityExecuted column.</param>
 /// <param name="quantityOrdered">The value for the QuantityOrdered column.</param>
 /// <param name="price1">The value for the Price1 column.</param>
 /// <param name="price2">The value for the Price2 column.</param>
 /// <param name="createdTime">The value for the CreatedTime column.</param>
 /// <param name="createdUserId">The value for the CreatedUserId column.</param>
 /// <param name="modifiedTime">The value for the ModifiedTime column.</param>
 /// <param name="modifiedUserId">The value for the ModifiedUserId column.</param>
 public static int Insert(
             AdoTransaction adoTransaction, 
             SqlTransaction sqlTransaction, 
             ref long rowVersion, 
             int blotterId, 
             object accountId, 
             int securityId, 
             int settlementId, 
             object brokerId, 
             int statusCode, 
             int transactionTypeCode, 
             object timeInForceCode, 
             object orderTypeCode, 
             object conditionCode, 
             object isDeleted, 
             object isAgency, 
             object quantityExecuted, 
             object quantityOrdered, 
             object price1, 
             object price2, 
             System.DateTime createdTime, 
             int createdUserId, 
             System.DateTime modifiedTime, 
             int modifiedUserId)
 {
     // Accessor for the BlockOrder Table.
     ServerDataModel.BlockOrderDataTable blockOrderTable = ServerDataModel.BlockOrder;
     // Apply Defaults
     if ((accountId == null))
     {
         accountId = System.DBNull.Value;
     }
     if ((brokerId == null))
     {
         brokerId = System.DBNull.Value;
     }
     if ((timeInForceCode == null))
     {
         timeInForceCode = System.DBNull.Value;
     }
     if ((orderTypeCode == null))
     {
         orderTypeCode = System.DBNull.Value;
     }
     if ((conditionCode == null))
     {
         conditionCode = System.DBNull.Value;
     }
     if ((isDeleted == null))
     {
         isDeleted = false;
     }
     if ((isAgency == null))
     {
         isAgency = false;
     }
     if ((quantityExecuted == null))
     {
         quantityExecuted = System.DBNull.Value;
     }
     if ((quantityOrdered == null))
     {
         quantityOrdered = System.DBNull.Value;
     }
     if ((price1 == null))
     {
         price1 = System.DBNull.Value;
     }
     if ((price2 == null))
     {
         price2 = System.DBNull.Value;
     }
     // Increment the row version
     rowVersion = ServerDataModel.RowVersion.Increment();
     // Insert the record into the ADO database.
     ServerDataModel.BlockOrderRow blockOrderRow = blockOrderTable.NewBlockOrderRow();
     blockOrderRow[blockOrderTable.RowVersionColumn] = rowVersion;
     blockOrderRow[blockOrderTable.BlotterIdColumn] = blotterId;
     blockOrderRow[blockOrderTable.AccountIdColumn] = accountId;
     blockOrderRow[blockOrderTable.SecurityIdColumn] = securityId;
     blockOrderRow[blockOrderTable.SettlementIdColumn] = settlementId;
     blockOrderRow[blockOrderTable.BrokerIdColumn] = brokerId;
     blockOrderRow[blockOrderTable.StatusCodeColumn] = statusCode;
     blockOrderRow[blockOrderTable.TransactionTypeCodeColumn] = transactionTypeCode;
     blockOrderRow[blockOrderTable.TimeInForceCodeColumn] = timeInForceCode;
     blockOrderRow[blockOrderTable.OrderTypeCodeColumn] = orderTypeCode;
     blockOrderRow[blockOrderTable.ConditionCodeColumn] = conditionCode;
     blockOrderRow[blockOrderTable.IsDeletedColumn] = isDeleted;
     blockOrderRow[blockOrderTable.IsAgencyColumn] = isAgency;
     blockOrderRow[blockOrderTable.QuantityExecutedColumn] = quantityExecuted;
     blockOrderRow[blockOrderTable.QuantityOrderedColumn] = quantityOrdered;
     blockOrderRow[blockOrderTable.Price1Column] = price1;
     blockOrderRow[blockOrderTable.Price2Column] = price2;
     blockOrderRow[blockOrderTable.CreatedTimeColumn] = createdTime;
     blockOrderRow[blockOrderTable.CreatedUserIdColumn] = createdUserId;
     blockOrderRow[blockOrderTable.ModifiedTimeColumn] = modifiedTime;
     blockOrderRow[blockOrderTable.ModifiedUserIdColumn] = modifiedUserId;
     blockOrderTable.AddBlockOrderRow(blockOrderRow);
     adoTransaction.DataRows.Add(blockOrderRow);
     // Insert the record into the SQL database.
     SqlCommand sqlCommand = new SqlCommand(@"insert ""BlockOrder"" (""rowVersion"",""BlockOrderId"",""BlotterId"",""AccountId"",""SecurityId"",""SettlementId"",""BrokerId"",""StatusCode"",""TransactionTypeCode"",""TimeInForceCode"",""OrderTypeCode"",""ConditionCode"",""IsDeleted"",""IsAgency"",""QuantityExecuted"",""QuantityOrdered"",""Price1"",""Price2"",""CreatedTime"",""CreatedUserId"",""ModifiedTime"",""ModifiedUserId"") values (@rowVersion,@blockOrderId,@blotterId,@accountId,@securityId,@settlementId,@brokerId,@statusCode,@transactionTypeCode,@timeInForceCode,@orderTypeCode,@conditionCode,@isDeleted,@isAgency,@quantityExecuted,@quantityOrdered,@price1,@price2,@createdTime,@createdUserId,@modifiedTime,@modifiedUserId)");
     sqlCommand.Connection = sqlTransaction.Connection;
     sqlCommand.Transaction = sqlTransaction;
     sqlCommand.Parameters.Add(new SqlParameter("@rowVersion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, rowVersion));
     sqlCommand.Parameters.Add(new SqlParameter("@blockOrderId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderRow[blockOrderTable.BlockOrderIdColumn]));
     sqlCommand.Parameters.Add(new SqlParameter("@blotterId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterId));
     sqlCommand.Parameters.Add(new SqlParameter("@accountId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountId));
     sqlCommand.Parameters.Add(new SqlParameter("@securityId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, securityId));
     sqlCommand.Parameters.Add(new SqlParameter("@settlementId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementId));
     sqlCommand.Parameters.Add(new SqlParameter("@brokerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, brokerId));
     sqlCommand.Parameters.Add(new SqlParameter("@statusCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, statusCode));
     sqlCommand.Parameters.Add(new SqlParameter("@transactionTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, transactionTypeCode));
     sqlCommand.Parameters.Add(new SqlParameter("@timeInForceCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, timeInForceCode));
     sqlCommand.Parameters.Add(new SqlParameter("@orderTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, orderTypeCode));
     sqlCommand.Parameters.Add(new SqlParameter("@conditionCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, conditionCode));
     sqlCommand.Parameters.Add(new SqlParameter("@isDeleted", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, isDeleted));
     sqlCommand.Parameters.Add(new SqlParameter("@isAgency", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, isAgency));
     sqlCommand.Parameters.Add(new SqlParameter("@quantityExecuted", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantityExecuted));
     sqlCommand.Parameters.Add(new SqlParameter("@quantityOrdered", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantityOrdered));
     sqlCommand.Parameters.Add(new SqlParameter("@price1", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, price1));
     sqlCommand.Parameters.Add(new SqlParameter("@price2", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, price2));
     sqlCommand.Parameters.Add(new SqlParameter("@createdTime", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, createdTime));
     sqlCommand.Parameters.Add(new SqlParameter("@createdUserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, createdUserId));
     sqlCommand.Parameters.Add(new SqlParameter("@modifiedTime", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, modifiedTime));
     sqlCommand.Parameters.Add(new SqlParameter("@modifiedUserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, modifiedUserId));
     sqlCommand.ExecuteNonQuery();
     // Return Statements
     return blockOrderRow.BlockOrderId;
 }
Ejemplo n.º 8
0
 /// <summary>Updates a BlockOrder record.</summary>
 /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
 /// <param name="rowVersion">The version number of the row</param>
 /// <param name="blockOrderId">The value for the BlockOrderId column.</param>
 /// <param name="blotterId">The value for the BlotterId column.</param>
 /// <param name="accountId">The value for the AccountId column.</param>
 /// <param name="securityId">The value for the SecurityId column.</param>
 /// <param name="settlementId">The value for the SettlementId column.</param>
 /// <param name="brokerId">The value for the BrokerId column.</param>
 /// <param name="statusCode">The value for the StatusCode column.</param>
 /// <param name="transactionTypeCode">The value for the TransactionTypeCode column.</param>
 /// <param name="timeInForceCode">The value for the TimeInForceCode column.</param>
 /// <param name="orderTypeCode">The value for the OrderTypeCode column.</param>
 /// <param name="conditionCode">The value for the ConditionCode column.</param>
 /// <param name="isDeleted">The value for the IsDeleted column.</param>
 /// <param name="isAgency">The value for the IsAgency column.</param>
 /// <param name="quantityExecuted">The value for the QuantityExecuted column.</param>
 /// <param name="quantityOrdered">The value for the QuantityOrdered column.</param>
 /// <param name="price1">The value for the Price1 column.</param>
 /// <param name="price2">The value for the Price2 column.</param>
 /// <param name="createdTime">The value for the CreatedTime column.</param>
 /// <param name="createdUserId">The value for the CreatedUserId column.</param>
 /// <param name="modifiedTime">The value for the ModifiedTime column.</param>
 /// <param name="modifiedUserId">The value for the ModifiedUserId column.</param>
 public static void Update(
             AdoTransaction adoTransaction, 
             SqlTransaction sqlTransaction, 
             ref long rowVersion, 
             int blockOrderId, 
             object blotterId, 
             object accountId, 
             object securityId, 
             object settlementId, 
             object brokerId, 
             object statusCode, 
             object transactionTypeCode, 
             object timeInForceCode, 
             object orderTypeCode, 
             object conditionCode, 
             object isDeleted, 
             object isAgency, 
             object quantityExecuted, 
             object quantityOrdered, 
             object price1, 
             object price2, 
             object createdTime, 
             object createdUserId, 
             object modifiedTime, 
             object modifiedUserId)
 {
     // Accessor for the BlockOrder Table.
     ServerDataModel.BlockOrderDataTable blockOrderTable = ServerDataModel.BlockOrder;
     // Rule #1: Make sure the record exists before updating it.
     ServerDataModel.BlockOrderRow blockOrderRow = blockOrderTable.FindByBlockOrderId(blockOrderId);
     if ((blockOrderRow == null))
     {
         throw new Exception(string.Format("The BlockOrder table does not have an element identified by {0}", blockOrderId));
     }
     // Rule #2: Optimistic Concurrency Check
     if ((blockOrderRow.RowVersion != rowVersion))
     {
         throw new System.Exception("This record is busy.  Please try again later.");
     }
     // Apply Defaults
     if ((blotterId == null))
     {
         blotterId = blockOrderRow[blockOrderTable.BlotterIdColumn];
     }
     if ((accountId == null))
     {
         accountId = blockOrderRow[blockOrderTable.AccountIdColumn];
     }
     if ((securityId == null))
     {
         securityId = blockOrderRow[blockOrderTable.SecurityIdColumn];
     }
     if ((settlementId == null))
     {
         settlementId = blockOrderRow[blockOrderTable.SettlementIdColumn];
     }
     if ((brokerId == null))
     {
         brokerId = blockOrderRow[blockOrderTable.BrokerIdColumn];
     }
     if ((statusCode == null))
     {
         statusCode = blockOrderRow[blockOrderTable.StatusCodeColumn];
     }
     if ((transactionTypeCode == null))
     {
         transactionTypeCode = blockOrderRow[blockOrderTable.TransactionTypeCodeColumn];
     }
     if ((timeInForceCode == null))
     {
         timeInForceCode = blockOrderRow[blockOrderTable.TimeInForceCodeColumn];
     }
     if ((orderTypeCode == null))
     {
         orderTypeCode = blockOrderRow[blockOrderTable.OrderTypeCodeColumn];
     }
     if ((conditionCode == null))
     {
         conditionCode = blockOrderRow[blockOrderTable.ConditionCodeColumn];
     }
     if ((isDeleted == null))
     {
         isDeleted = blockOrderRow[blockOrderTable.IsDeletedColumn];
     }
     if ((isAgency == null))
     {
         isAgency = blockOrderRow[blockOrderTable.IsAgencyColumn];
     }
     if ((quantityExecuted == null))
     {
         quantityExecuted = blockOrderRow[blockOrderTable.QuantityExecutedColumn];
     }
     if ((quantityOrdered == null))
     {
         quantityOrdered = blockOrderRow[blockOrderTable.QuantityOrderedColumn];
     }
     if ((price1 == null))
     {
         price1 = blockOrderRow[blockOrderTable.Price1Column];
     }
     if ((price2 == null))
     {
         price2 = blockOrderRow[blockOrderTable.Price2Column];
     }
     if ((createdTime == null))
     {
         createdTime = blockOrderRow[blockOrderTable.CreatedTimeColumn];
     }
     if ((createdUserId == null))
     {
         createdUserId = blockOrderRow[blockOrderTable.CreatedUserIdColumn];
     }
     if ((modifiedTime == null))
     {
         modifiedTime = blockOrderRow[blockOrderTable.ModifiedTimeColumn];
     }
     if ((modifiedUserId == null))
     {
         modifiedUserId = blockOrderRow[blockOrderTable.ModifiedUserIdColumn];
     }
     // Increment the row version
     rowVersion = ServerDataModel.RowVersion.Increment();
     // Update the record in the ADO database.
     blockOrderRow[blockOrderTable.RowVersionColumn] = rowVersion;
     blockOrderRow[blockOrderTable.BlotterIdColumn] = blotterId;
     blockOrderRow[blockOrderTable.AccountIdColumn] = accountId;
     blockOrderRow[blockOrderTable.SecurityIdColumn] = securityId;
     blockOrderRow[blockOrderTable.SettlementIdColumn] = settlementId;
     blockOrderRow[blockOrderTable.BrokerIdColumn] = brokerId;
     blockOrderRow[blockOrderTable.StatusCodeColumn] = statusCode;
     blockOrderRow[blockOrderTable.TransactionTypeCodeColumn] = transactionTypeCode;
     blockOrderRow[blockOrderTable.TimeInForceCodeColumn] = timeInForceCode;
     blockOrderRow[blockOrderTable.OrderTypeCodeColumn] = orderTypeCode;
     blockOrderRow[blockOrderTable.ConditionCodeColumn] = conditionCode;
     blockOrderRow[blockOrderTable.IsDeletedColumn] = isDeleted;
     blockOrderRow[blockOrderTable.IsAgencyColumn] = isAgency;
     blockOrderRow[blockOrderTable.QuantityExecutedColumn] = quantityExecuted;
     blockOrderRow[blockOrderTable.QuantityOrderedColumn] = quantityOrdered;
     blockOrderRow[blockOrderTable.Price1Column] = price1;
     blockOrderRow[blockOrderTable.Price2Column] = price2;
     blockOrderRow[blockOrderTable.CreatedTimeColumn] = createdTime;
     blockOrderRow[blockOrderTable.CreatedUserIdColumn] = createdUserId;
     blockOrderRow[blockOrderTable.ModifiedTimeColumn] = modifiedTime;
     blockOrderRow[blockOrderTable.ModifiedUserIdColumn] = modifiedUserId;
     adoTransaction.DataRows.Add(blockOrderRow);
     // Update the record in the SQL database.
     SqlCommand sqlCommand = new SqlCommand(@"update ""BlockOrder"" set ""RowVersion""=@rowVersion,""BlotterId""=@blotterId,""AccountId""=@accountId,""SecurityId""=@securityId,""SettlementId""=@settlementId,""BrokerId""=@brokerId,""StatusCode""=@statusCode,""TransactionTypeCode""=@transactionTypeCode,""TimeInForceCode""=@timeInForceCode,""OrderTypeCode""=@orderTypeCode,""ConditionCode""=@conditionCode,""IsDeleted""=@isDeleted,""IsAgency""=@isAgency,""QuantityExecuted""=@quantityExecuted,""QuantityOrdered""=@quantityOrdered,""Price1""=@price1,""Price2""=@price2,""CreatedTime""=@createdTime,""CreatedUserId""=@createdUserId,""ModifiedTime""=@modifiedTime,""ModifiedUserId""=@modifiedUserId where ""BlockOrderId""=@blockOrderId");
     sqlCommand.Connection = sqlTransaction.Connection;
     sqlCommand.Transaction = sqlTransaction;
     sqlCommand.Parameters.Add(new SqlParameter("@rowVersion", SqlDbType.BigInt, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, rowVersion));
     sqlCommand.Parameters.Add(new SqlParameter("@blockOrderId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderId));
     sqlCommand.Parameters.Add(new SqlParameter("@blotterId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterId));
     sqlCommand.Parameters.Add(new SqlParameter("@accountId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountId));
     sqlCommand.Parameters.Add(new SqlParameter("@securityId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, securityId));
     sqlCommand.Parameters.Add(new SqlParameter("@settlementId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementId));
     sqlCommand.Parameters.Add(new SqlParameter("@brokerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, brokerId));
     sqlCommand.Parameters.Add(new SqlParameter("@statusCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, statusCode));
     sqlCommand.Parameters.Add(new SqlParameter("@transactionTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, transactionTypeCode));
     sqlCommand.Parameters.Add(new SqlParameter("@timeInForceCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, timeInForceCode));
     sqlCommand.Parameters.Add(new SqlParameter("@orderTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, orderTypeCode));
     sqlCommand.Parameters.Add(new SqlParameter("@conditionCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, conditionCode));
     sqlCommand.Parameters.Add(new SqlParameter("@isDeleted", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, isDeleted));
     sqlCommand.Parameters.Add(new SqlParameter("@isAgency", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, isAgency));
     sqlCommand.Parameters.Add(new SqlParameter("@quantityExecuted", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantityExecuted));
     sqlCommand.Parameters.Add(new SqlParameter("@quantityOrdered", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantityOrdered));
     sqlCommand.Parameters.Add(new SqlParameter("@price1", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, price1));
     sqlCommand.Parameters.Add(new SqlParameter("@price2", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, price2));
     sqlCommand.Parameters.Add(new SqlParameter("@createdTime", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, createdTime));
     sqlCommand.Parameters.Add(new SqlParameter("@createdUserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, createdUserId));
     sqlCommand.Parameters.Add(new SqlParameter("@modifiedTime", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, modifiedTime));
     sqlCommand.Parameters.Add(new SqlParameter("@modifiedUserId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, modifiedUserId));
     // Update the record in the SQL database.
     sqlCommand.ExecuteNonQuery();
 }
Ejemplo n.º 9
0
        /// <summary>ArchiveChildrens a Security 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="securityId">The value for the SecurityId 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 securityId)
        {
            // Accessor for the Security Table.
            ServerDataModel.SecurityDataTable securityTable = ServerDataModel.Security;
            // This record can be used to iterate through all the children.
            ServerDataModel.SecurityRow securityRow = securityTable.FindBySecurityId(securityId);
            // Archive the child records.
            for (int index = 0; (index < securityRow.GetAccountRows().Length); index = (index + 1))
            {
                ServerDataModel.AccountRow childAccountRow = securityRow.GetAccountRows()[index];
                Account.ArchiveChildren(adoTransaction, sqlTransaction, childAccountRow.RowVersion, childAccountRow.AccountId);
            }
            for (int index = 0; (index < securityRow.GetAllocationRowsByFKSecurityAllocationSecurityId().Length); index = (index + 1))
            {
                ServerDataModel.AllocationRow childAllocationRow = securityRow.GetAllocationRowsByFKSecurityAllocationSecurityId()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < securityRow.GetAllocationRowsByFKSecurityAllocationSettlementId().Length); index = (index + 1))
            {
                ServerDataModel.AllocationRow childAllocationRow = securityRow.GetAllocationRowsByFKSecurityAllocationSettlementId()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < securityRow.GetBlockOrderRowsByFKSecurityBlockOrderSecurityId().Length); index = (index + 1))
            {
                ServerDataModel.BlockOrderRow childBlockOrderRow = securityRow.GetBlockOrderRowsByFKSecurityBlockOrderSecurityId()[index];
                BlockOrder.Archive(adoTransaction, sqlTransaction, childBlockOrderRow.RowVersion, childBlockOrderRow.BlockOrderId);
            }
            for (int index = 0; (index < securityRow.GetBlockOrderRowsByFKSecurityBlockOrderSettlementId().Length); index = (index + 1))
            {
                ServerDataModel.BlockOrderRow childBlockOrderRow = securityRow.GetBlockOrderRowsByFKSecurityBlockOrderSettlementId()[index];
                BlockOrder.Archive(adoTransaction, sqlTransaction, childBlockOrderRow.RowVersion, childBlockOrderRow.BlockOrderId);
            }
            for (int index = 0; (index < securityRow.GetBlotterMapRows().Length); index = (index + 1))
            {
                ServerDataModel.BlotterMapRow childBlotterMapRow = securityRow.GetBlotterMapRows()[index];
                BlotterMap.Archive(adoTransaction, sqlTransaction, childBlotterMapRow.RowVersion, childBlotterMapRow.BlotterMapId);
            }
            for (int index = 0; (index < securityRow.GetDebtRowsByFKSecurityDebtDebtId().Length); index = (index + 1))
            {
                ServerDataModel.DebtRow childDebtRow = securityRow.GetDebtRowsByFKSecurityDebtDebtId()[index];
                Debt.ArchiveChildren(adoTransaction, sqlTransaction, childDebtRow.RowVersion, childDebtRow.DebtId);
            }
            for (int index = 0; (index < securityRow.GetDebtRowsByFKSecurityDebtSettlementId().Length); index = (index + 1))
            {
                ServerDataModel.DebtRow childDebtRow = securityRow.GetDebtRowsByFKSecurityDebtSettlementId()[index];
                Debt.ArchiveChildren(adoTransaction, sqlTransaction, childDebtRow.RowVersion, childDebtRow.DebtId);
            }
            for (int index = 0; (index < securityRow.GetCurrencyRows().Length); index = (index + 1))
            {
                ServerDataModel.CurrencyRow childCurrencyRow = securityRow.GetCurrencyRows()[index];
                Currency.ArchiveChildren(adoTransaction, sqlTransaction, childCurrencyRow.RowVersion, childCurrencyRow.CurrencyId);
            }
            for (int index = 0; (index < securityRow.GetEquityRowsByFKSecurityEquityEquityId().Length); index = (index + 1))
            {
                ServerDataModel.EquityRow childEquityRow = securityRow.GetEquityRowsByFKSecurityEquityEquityId()[index];
                Equity.ArchiveChildren(adoTransaction, sqlTransaction, childEquityRow.RowVersion, childEquityRow.EquityId);
            }
            for (int index = 0; (index < securityRow.GetEquityRowsByFKSecurityEquitySettlementId().Length); index = (index + 1))
            {
                ServerDataModel.EquityRow childEquityRow = securityRow.GetEquityRowsByFKSecurityEquitySettlementId()[index];
                Equity.ArchiveChildren(adoTransaction, sqlTransaction, childEquityRow.RowVersion, childEquityRow.EquityId);
            }
            for (int index = 0; (index < securityRow.GetOrderRowsByFKSecurityOrderSecurityId().Length); index = (index + 1))
            {
                ServerDataModel.OrderRow childOrderRow = securityRow.GetOrderRowsByFKSecurityOrderSecurityId()[index];
                Order.Archive(adoTransaction, sqlTransaction, childOrderRow.RowVersion, childOrderRow.OrderId);
            }
            for (int index = 0; (index < securityRow.GetOrderRowsByFKSecurityOrderSettlementId().Length); index = (index + 1))
            {
                ServerDataModel.OrderRow childOrderRow = securityRow.GetOrderRowsByFKSecurityOrderSettlementId()[index];
                Order.Archive(adoTransaction, sqlTransaction, childOrderRow.RowVersion, childOrderRow.OrderId);
            }
            for (int index = 0; (index < securityRow.GetPositionRows().Length); index = (index + 1))
            {
                ServerDataModel.PositionRow childPositionRow = securityRow.GetPositionRows()[index];
                Position.Archive(adoTransaction, sqlTransaction, childPositionRow.RowVersion, childPositionRow.AccountId, childPositionRow.SecurityId, childPositionRow.PositionTypeCode);
            }
            for (int index = 0; (index < securityRow.GetPositionTargetRows().Length); index = (index + 1))
            {
                ServerDataModel.PositionTargetRow childPositionTargetRow = securityRow.GetPositionTargetRows()[index];
                PositionTarget.Archive(adoTransaction, sqlTransaction, childPositionTargetRow.RowVersion, childPositionTargetRow.ModelId, childPositionTargetRow.SecurityId, childPositionTargetRow.PositionTypeCode);
            }
            for (int index = 0; (index < securityRow.GetPriceRows().Length); index = (index + 1))
            {
                ServerDataModel.PriceRow childPriceRow = securityRow.GetPriceRows()[index];
                Price.Archive(adoTransaction, sqlTransaction, childPriceRow.RowVersion, childPriceRow.SecurityId, childPriceRow.CurrencyId);
            }
            for (int index = 0; (index < securityRow.GetProposedOrderRowsByFKSecurityProposedOrderSecurityId().Length); index = (index + 1))
            {
                ServerDataModel.ProposedOrderRow childProposedOrderRow = securityRow.GetProposedOrderRowsByFKSecurityProposedOrderSecurityId()[index];
                ProposedOrder.Archive(adoTransaction, sqlTransaction, childProposedOrderRow.RowVersion, childProposedOrderRow.ProposedOrderId);
            }
            for (int index = 0; (index < securityRow.GetProposedOrderRowsByFKSecurityProposedOrderSettlementId().Length); index = (index + 1))
            {
                ServerDataModel.ProposedOrderRow childProposedOrderRow = securityRow.GetProposedOrderRowsByFKSecurityProposedOrderSettlementId()[index];
                ProposedOrder.Archive(adoTransaction, sqlTransaction, childProposedOrderRow.RowVersion, childProposedOrderRow.ProposedOrderId);
            }
            for (int index = 0; (index < securityRow.GetTaxLotRows().Length); index = (index + 1))
            {
                ServerDataModel.TaxLotRow childTaxLotRow = securityRow.GetTaxLotRows()[index];
                TaxLot.Archive(adoTransaction, sqlTransaction, childTaxLotRow.RowVersion, childTaxLotRow.TaxLotId);
            }
            for (int index = 0; (index < securityRow.GetViolationRows().Length); index = (index + 1))
            {
                ServerDataModel.ViolationRow childViolationRow = securityRow.GetViolationRows()[index];
                Violation.Archive(adoTransaction, sqlTransaction, childViolationRow.RowVersion, childViolationRow.ViolationId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            securityRow[securityTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(securityRow);
            securityRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Security\" set \"IsArchived\" = 1 where \"SecurityId\"=@securityId");

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