コード例 #1
0
ファイル: Broker.cs プロジェクト: DonaldAirey/quasar
        /// <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 static void ArchiveChildren(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int brokerId)
        {
            // Accessor for the Broker Table.
            ServerDataModel.BrokerDataTable brokerTable = ServerDataModel.Broker;
            // This record can be used to iterate through all the children.
            ServerDataModel.BrokerRow brokerRow = brokerTable.FindByBrokerId(brokerId);
            // Archive the child records.
            for (int index = 0; (index < brokerRow.GetExecutionRows().Length); index = (index + 1))
            {
                ServerDataModel.ExecutionRow childExecutionRow = brokerRow.GetExecutionRows()[index];
                Execution.Archive(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
            }
            for (int index = 0; (index < brokerRow.GetPlacementRows().Length); index = (index + 1))
            {
                ServerDataModel.PlacementRow childPlacementRow = brokerRow.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.
            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();
        }
コード例 #2
0
        /// <summary>Archives a Execution 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="executionId">The value for the ExecutionId 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 executionId)
        {
            // Accessor for the Execution Table.
            ServerDataModel.ExecutionDataTable executionTable = ServerDataModel.Execution;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.ExecutionRow executionRow = executionTable.FindByExecutionId(executionId);
            if ((executionRow == null))
            {
                throw new Exception(string.Format("The Execution table does not have an element identified by {0}", executionId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((executionRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            executionRow[executionTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(executionRow);
            executionRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Execution\" set \"IsArchived\" = 1 where \"ExecutionId\"=@executionId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@executionId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, executionId));
            sqlCommand.ExecuteNonQuery();
        }
コード例 #3
0
ファイル: BlockOrder.cs プロジェクト: DonaldAirey/quasar
 /// <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();
 }
コード例 #4
0
        /// <summary>DeleteChildrens a User 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="userId">The value for the UserId 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 userId)
        {
            // Accessor for the User Table.
            ServerDataModel.UserDataTable userTable = ServerDataModel.User;
            // This record can be used to iterate through all the children.
            ServerDataModel.UserRow userRow = userTable.FindByUserId(userId);
            // Delete the child records.
            for (int index = 0; (index < userRow.GetAllocationRowsByFKUserAllocationCreatedUserId().Length); index = (index + 1))
            {
                ServerDataModel.AllocationRow childAllocationRow = userRow.GetAllocationRowsByFKUserAllocationCreatedUserId()[index];
                Allocation.Delete(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < userRow.GetAllocationRowsByFKUserAllocationModifiedUserId().Length); index = (index + 1))
            {
                ServerDataModel.AllocationRow childAllocationRow = userRow.GetAllocationRowsByFKUserAllocationModifiedUserId()[index];
                Allocation.Delete(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < userRow.GetExecutionRowsByFKUserExecutionCreatedUserId().Length); index = (index + 1))
            {
                ServerDataModel.ExecutionRow childExecutionRow = userRow.GetExecutionRowsByFKUserExecutionCreatedUserId()[index];
                Execution.Delete(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
            }
            for (int index = 0; (index < userRow.GetExecutionRowsByFKUserExecutionModifiedUserId().Length); index = (index + 1))
            {
                ServerDataModel.ExecutionRow childExecutionRow = userRow.GetExecutionRowsByFKUserExecutionModifiedUserId()[index];
                Execution.Delete(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
            }
            for (int index = 0; (index < userRow.GetPlacementRowsByFKUserPlacementCreatedUserId().Length); index = (index + 1))
            {
                ServerDataModel.PlacementRow childPlacementRow = userRow.GetPlacementRowsByFKUserPlacementCreatedUserId()[index];
                Placement.Delete(adoTransaction, sqlTransaction, childPlacementRow.RowVersion, childPlacementRow.PlacementId);
            }
            for (int index = 0; (index < userRow.GetPlacementRowsByFKUserPlacementModifiedUserId().Length); index = (index + 1))
            {
                ServerDataModel.PlacementRow childPlacementRow = userRow.GetPlacementRowsByFKUserPlacementModifiedUserId()[index];
                Placement.Delete(adoTransaction, sqlTransaction, childPlacementRow.RowVersion, childPlacementRow.PlacementId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            userRow[userTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(userRow);
            userRow.Delete();
            // Delete the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"User\" set \"IsDeleted\" = 1 where \"UserId\"=@userId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@userId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userId));
            sqlCommand.ExecuteNonQuery();
        }
コード例 #5
0
        /// <summary>Inserts a Execution record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="blockOrderId">The value for the BlockOrderId column.</param>
        /// <param name="brokerId">The value for the BrokerId column.</param>
        /// <param name="isDeleted">The value for the IsDeleted column.</param>
        /// <param name="quantity">The value for the Quantity column.</param>
        /// <param name="price">The value for the Price column.</param>
        /// <param name="commission">The value for the Commission column.</param>
        /// <param name="accruedInterest">The value for the AccruedInterest column.</param>
        /// <param name="userFee0">The value for the UserFee0 column.</param>
        /// <param name="userFee1">The value for the UserFee1 column.</param>
        /// <param name="userFee2">The value for the UserFee2 column.</param>
        /// <param name="userFee3">The value for the UserFee3 column.</param>
        /// <param name="tradeDate">The value for the TradeDate column.</param>
        /// <param name="settlementDate">The value for the SettlementDate 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 blockOrderId,
            int brokerId,
            object isDeleted,
            decimal quantity,
            decimal price,
            object commission,
            object accruedInterest,
            object userFee0,
            object userFee1,
            object userFee2,
            object userFee3,
            System.DateTime tradeDate,
            System.DateTime settlementDate,
            object createdTime,
            object createdUserId,
            object modifiedTime,
            object modifiedUserId)
        {
            // Accessor for the Execution Table.
            ServerDataModel.ExecutionDataTable executionTable = ServerDataModel.Execution;
            // Apply Defaults
            if ((isDeleted == null))
            {
                isDeleted = false;
            }
            if ((commission == null))
            {
                commission = 0.0m;
            }
            if ((accruedInterest == null))
            {
                accruedInterest = 0.0m;
            }
            if ((userFee0 == null))
            {
                userFee0 = 0.0m;
            }
            if ((userFee1 == null))
            {
                userFee1 = 0.0m;
            }
            if ((userFee2 == null))
            {
                userFee2 = 0.0m;
            }
            if ((userFee3 == null))
            {
                userFee3 = 0.0m;
            }
            if ((createdTime == null))
            {
                createdTime = System.DBNull.Value;
            }
            if ((createdUserId == null))
            {
                createdUserId = System.DBNull.Value;
            }
            if ((modifiedTime == null))
            {
                modifiedTime = System.DBNull.Value;
            }
            if ((modifiedUserId == null))
            {
                modifiedUserId = System.DBNull.Value;
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerDataModel.ExecutionRow executionRow = executionTable.NewExecutionRow();
            executionRow[executionTable.RowVersionColumn]      = rowVersion;
            executionRow[executionTable.BlockOrderIdColumn]    = blockOrderId;
            executionRow[executionTable.BrokerIdColumn]        = brokerId;
            executionRow[executionTable.IsDeletedColumn]       = isDeleted;
            executionRow[executionTable.QuantityColumn]        = quantity;
            executionRow[executionTable.PriceColumn]           = price;
            executionRow[executionTable.CommissionColumn]      = commission;
            executionRow[executionTable.AccruedInterestColumn] = accruedInterest;
            executionRow[executionTable.UserFee0Column]        = userFee0;
            executionRow[executionTable.UserFee1Column]        = userFee1;
            executionRow[executionTable.UserFee2Column]        = userFee2;
            executionRow[executionTable.UserFee3Column]        = userFee3;
            executionRow[executionTable.TradeDateColumn]       = tradeDate;
            executionRow[executionTable.SettlementDateColumn]  = settlementDate;
            executionRow[executionTable.CreatedTimeColumn]     = createdTime;
            executionRow[executionTable.CreatedUserIdColumn]   = createdUserId;
            executionRow[executionTable.ModifiedTimeColumn]    = modifiedTime;
            executionRow[executionTable.ModifiedUserIdColumn]  = modifiedUserId;
            executionTable.AddExecutionRow(executionRow);
            adoTransaction.DataRows.Add(executionRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"insert ""Execution"" (""rowVersion"",""ExecutionId"",""BlockOrderId"",""BrokerId"",""IsDeleted"",""Quantity"",""Price"",""Commission"",""AccruedInterest"",""UserFee0"",""UserFee1"",""UserFee2"",""UserFee3"",""TradeDate"",""SettlementDate"",""CreatedTime"",""CreatedUserId"",""ModifiedTime"",""ModifiedUserId"") values (@rowVersion,@executionId,@blockOrderId,@brokerId,@isDeleted,@quantity,@price,@commission,@accruedInterest,@userFee0,@userFee1,@userFee2,@userFee3,@tradeDate,@settlementDate,@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("@executionId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, executionRow[executionTable.ExecutionIdColumn]));
            sqlCommand.Parameters.Add(new SqlParameter("@blockOrderId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderId));
            sqlCommand.Parameters.Add(new SqlParameter("@brokerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, brokerId));
            sqlCommand.Parameters.Add(new SqlParameter("@isDeleted", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, isDeleted));
            sqlCommand.Parameters.Add(new SqlParameter("@quantity", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantity));
            sqlCommand.Parameters.Add(new SqlParameter("@price", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, price));
            sqlCommand.Parameters.Add(new SqlParameter("@commission", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, commission));
            sqlCommand.Parameters.Add(new SqlParameter("@accruedInterest", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accruedInterest));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee0", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee0));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee1", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee1));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee2", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee2));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee3", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee3));
            sqlCommand.Parameters.Add(new SqlParameter("@tradeDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, tradeDate));
            sqlCommand.Parameters.Add(new SqlParameter("@settlementDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementDate));
            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(executionRow.ExecutionId);
        }
コード例 #6
0
        /// <summary>Updates a Execution 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="executionId">The value for the ExecutionId column.</param>
        /// <param name="blockOrderId">The value for the BlockOrderId column.</param>
        /// <param name="brokerId">The value for the BrokerId column.</param>
        /// <param name="isDeleted">The value for the IsDeleted column.</param>
        /// <param name="quantity">The value for the Quantity column.</param>
        /// <param name="price">The value for the Price column.</param>
        /// <param name="commission">The value for the Commission column.</param>
        /// <param name="accruedInterest">The value for the AccruedInterest column.</param>
        /// <param name="userFee0">The value for the UserFee0 column.</param>
        /// <param name="userFee1">The value for the UserFee1 column.</param>
        /// <param name="userFee2">The value for the UserFee2 column.</param>
        /// <param name="userFee3">The value for the UserFee3 column.</param>
        /// <param name="tradeDate">The value for the TradeDate column.</param>
        /// <param name="settlementDate">The value for the SettlementDate 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 executionId,
            object blockOrderId,
            object brokerId,
            object isDeleted,
            object quantity,
            object price,
            object commission,
            object accruedInterest,
            object userFee0,
            object userFee1,
            object userFee2,
            object userFee3,
            object tradeDate,
            object settlementDate,
            object createdTime,
            object createdUserId,
            object modifiedTime,
            object modifiedUserId)
        {
            // Accessor for the Execution Table.
            ServerDataModel.ExecutionDataTable executionTable = ServerDataModel.Execution;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.ExecutionRow executionRow = executionTable.FindByExecutionId(executionId);
            if ((executionRow == null))
            {
                throw new Exception(string.Format("The Execution table does not have an element identified by {0}", executionId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((executionRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((blockOrderId == null))
            {
                blockOrderId = executionRow[executionTable.BlockOrderIdColumn];
            }
            if ((brokerId == null))
            {
                brokerId = executionRow[executionTable.BrokerIdColumn];
            }
            if ((isDeleted == null))
            {
                isDeleted = executionRow[executionTable.IsDeletedColumn];
            }
            if ((quantity == null))
            {
                quantity = executionRow[executionTable.QuantityColumn];
            }
            if ((price == null))
            {
                price = executionRow[executionTable.PriceColumn];
            }
            if ((commission == null))
            {
                commission = executionRow[executionTable.CommissionColumn];
            }
            if ((accruedInterest == null))
            {
                accruedInterest = executionRow[executionTable.AccruedInterestColumn];
            }
            if ((userFee0 == null))
            {
                userFee0 = executionRow[executionTable.UserFee0Column];
            }
            if ((userFee1 == null))
            {
                userFee1 = executionRow[executionTable.UserFee1Column];
            }
            if ((userFee2 == null))
            {
                userFee2 = executionRow[executionTable.UserFee2Column];
            }
            if ((userFee3 == null))
            {
                userFee3 = executionRow[executionTable.UserFee3Column];
            }
            if ((tradeDate == null))
            {
                tradeDate = executionRow[executionTable.TradeDateColumn];
            }
            if ((settlementDate == null))
            {
                settlementDate = executionRow[executionTable.SettlementDateColumn];
            }
            if ((createdTime == null))
            {
                createdTime = executionRow[executionTable.CreatedTimeColumn];
            }
            if ((createdUserId == null))
            {
                createdUserId = executionRow[executionTable.CreatedUserIdColumn];
            }
            if ((modifiedTime == null))
            {
                modifiedTime = executionRow[executionTable.ModifiedTimeColumn];
            }
            if ((modifiedUserId == null))
            {
                modifiedUserId = executionRow[executionTable.ModifiedUserIdColumn];
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Update the record in the ADO database.
            executionRow[executionTable.RowVersionColumn]      = rowVersion;
            executionRow[executionTable.BlockOrderIdColumn]    = blockOrderId;
            executionRow[executionTable.BrokerIdColumn]        = brokerId;
            executionRow[executionTable.IsDeletedColumn]       = isDeleted;
            executionRow[executionTable.QuantityColumn]        = quantity;
            executionRow[executionTable.PriceColumn]           = price;
            executionRow[executionTable.CommissionColumn]      = commission;
            executionRow[executionTable.AccruedInterestColumn] = accruedInterest;
            executionRow[executionTable.UserFee0Column]        = userFee0;
            executionRow[executionTable.UserFee1Column]        = userFee1;
            executionRow[executionTable.UserFee2Column]        = userFee2;
            executionRow[executionTable.UserFee3Column]        = userFee3;
            executionRow[executionTable.TradeDateColumn]       = tradeDate;
            executionRow[executionTable.SettlementDateColumn]  = settlementDate;
            executionRow[executionTable.CreatedTimeColumn]     = createdTime;
            executionRow[executionTable.CreatedUserIdColumn]   = createdUserId;
            executionRow[executionTable.ModifiedTimeColumn]    = modifiedTime;
            executionRow[executionTable.ModifiedUserIdColumn]  = modifiedUserId;
            adoTransaction.DataRows.Add(executionRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"update ""Execution"" set ""RowVersion""=@rowVersion,""BlockOrderId""=@blockOrderId,""BrokerId""=@brokerId,""IsDeleted""=@isDeleted,""Quantity""=@quantity,""Price""=@price,""Commission""=@commission,""AccruedInterest""=@accruedInterest,""UserFee0""=@userFee0,""UserFee1""=@userFee1,""UserFee2""=@userFee2,""UserFee3""=@userFee3,""TradeDate""=@tradeDate,""SettlementDate""=@settlementDate,""CreatedTime""=@createdTime,""CreatedUserId""=@createdUserId,""ModifiedTime""=@modifiedTime,""ModifiedUserId""=@modifiedUserId where ""ExecutionId""=@executionId");

            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("@executionId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, executionId));
            sqlCommand.Parameters.Add(new SqlParameter("@blockOrderId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderId));
            sqlCommand.Parameters.Add(new SqlParameter("@brokerId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, brokerId));
            sqlCommand.Parameters.Add(new SqlParameter("@isDeleted", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, isDeleted));
            sqlCommand.Parameters.Add(new SqlParameter("@quantity", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantity));
            sqlCommand.Parameters.Add(new SqlParameter("@price", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, price));
            sqlCommand.Parameters.Add(new SqlParameter("@commission", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, commission));
            sqlCommand.Parameters.Add(new SqlParameter("@accruedInterest", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accruedInterest));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee0", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee0));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee1", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee1));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee2", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee2));
            sqlCommand.Parameters.Add(new SqlParameter("@userFee3", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userFee3));
            sqlCommand.Parameters.Add(new SqlParameter("@tradeDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, tradeDate));
            sqlCommand.Parameters.Add(new SqlParameter("@settlementDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementDate));
            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();
        }