示例#1
0
        /// <summary>Archives a TaxLot 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="taxLotId">The value for the TaxLotId 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 taxLotId)
        {
            // Accessor for the TaxLot Table.
            ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.TaxLotRow taxLotRow = taxLotTable.FindByTaxLotId(taxLotId);
            if ((taxLotRow == null))
            {
                throw new Exception(string.Format("The TaxLot table does not have an element identified by {0}", taxLotId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((taxLotRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            taxLotRow[taxLotTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(taxLotRow);
            taxLotRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"TaxLot\" set \"IsArchived\" = 1 where \"TaxLotId\"=@taxLotId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@taxLotId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, taxLotId));
            sqlCommand.ExecuteNonQuery();
        }
示例#2
0
 /// <summary>Initializes the static elements of an Object.</summary>
 static TaxLot()
 {
     // The table must be locked before the indices can be read into an accelerator array.
     ServerMarketData.TaxLotLock.AcquireReaderLock(System.Threading.Timeout.Infinite);
     // Accessor for the TaxLot Table.
     ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
     // This does an indirect lookup operation using the views created for the ExternalId columns.  Take the index of the user
     // identifier column calcualted above and use it to find a record containing the external identifier.
     TaxLot.externalKeyArray = new DataView[] {
             taxLotTable.KeyTaxLotExternalId0,
             taxLotTable.KeyTaxLotExternalId1,
             taxLotTable.KeyTaxLotExternalId2,
             taxLotTable.KeyTaxLotExternalId3};
     // The table must be released after the array is constructed.
     ServerMarketData.TaxLotLock.ReleaseReaderLock();
 }
示例#3
0
 /// <summary>Updates a TaxLot record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public static void Update(ParameterList parameters)
 {
     // Accessor for the TaxLot Table.
     ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object externalAccountId = parameters["accountId"].Value;
     object cost = parameters["cost"].Value;
     object localCost = parameters["localCost"].Value;
     object externalPositionTypeCode = parameters["positionTypeCode"].Value;
     object quantity = parameters["quantity"].Value;
     object externalSecurityId = parameters["securityId"].Value;
     object settlementDate = parameters["settlementDate"].Value;
     string externalTaxLotId = ((string)(parameters["taxLotId"]));
     object tradeDate = parameters["tradeDate"].Value;
     object userData0 = parameters["userData0"].Value;
     object userData1 = parameters["userData1"].Value;
     object userData2 = parameters["userData2"].Value;
     object userData3 = parameters["userData3"].Value;
     object userData4 = parameters["userData4"].Value;
     object userData5 = parameters["userData5"].Value;
     object userData6 = parameters["userData6"].Value;
     object userData7 = parameters["userData7"].Value;
     // The row versioning is largely disabled for external operations.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     object accountId = Account.FindOptionalKey(configurationId, "accountId", externalAccountId);
     object positionTypeCode = PositionType.FindOptionalKey(configurationId, "positionTypeCode", externalPositionTypeCode);
     object securityId = Security.FindOptionalKey(configurationId, "securityId", externalSecurityId);
     int taxLotId = TaxLot.FindRequiredKey(configurationId, "taxLotId", externalTaxLotId);
     // While the optimistic concurrency checking is disabled for the external methods, the internal methods
     // still need to perform the check.  This ncurrency checking logic by finding the current row version to be
     // will bypass the coused when the internal method is called.
     ServerMarketData.TaxLotRow taxLotRow = taxLotTable.FindByTaxLotId(taxLotId);
     rowVersion = ((long)(taxLotRow[taxLotTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Guardian.Core.TaxLot.Update(adoTransaction, sqlTransaction, ref rowVersion, accountId, cost, null, null, null, null, localCost, positionTypeCode, quantity, securityId, settlementDate, taxLotId, tradeDate, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
示例#4
0
 /// <summary>Finds a a TaxLot record using a configuration and an external identifier.</summary>
 /// <param name="configurationId">Specified which mappings (user id columns) to use when looking up external identifiers.</param>
 /// <param name="parameterId">The name of the parameter as specified in the configuration table.</param>
 /// <param name="externalId">The external (user supplied) identifier for the record.</param>
 public static int FindKey(object configurationId, string parameterId, object externalId)
 {
     // A missing key will never match a column.
     if ((externalId == null))
     {
         return int.MinValue;
     }
     // Accessor for the TaxLot Table.
     ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
     // Look for the record using the external identifier.  The configuration selected the key to use, which effectively
     // selected the external id column to use for the search.  If a record is found in the view, a translation still needs
     // to be made back to the original table before an index to the record can be returned to the caller.
     int externalKeyIndex = TaxLot.GetExternalKeyIndex(configurationId, parameterId);
     System.Data.DataView externalKeyView = TaxLot.externalKeyArray[externalKeyIndex];
     int recordIndex = externalKeyView.Find(new object[] {
                 externalId});
     if ((recordIndex == -1))
     {
         return int.MinValue;
     }
     return ((int)(externalKeyView[recordIndex].Row[taxLotTable.TaxLotIdColumn]));
 }
示例#5
0
 /// <summary>Archives a TaxLot record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public static void Archive(ParameterList parameters)
 {
     // Accessor for the TaxLot Table.
     ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     string externalTaxLotId = parameters["taxLotId"];
     // The row versioning is largely disabled for external operations.
     long rowVersion = long.MinValue;
     // Find the internal identifier using the primar key elements.
     // identifier is used to determine if a record exists with the same key.
     int taxLotId = TaxLot.FindRequiredKey(configurationId, "taxLotId", externalTaxLotId);
     // While the optimistic concurrency checking is disabled for the external methods, the internal methods
     // still need to perform the check.  This ncurrency checking logic by finding the current row version to be
     // will bypass the coused when the internal method is called.
     ServerMarketData.TaxLotRow taxLotRow = taxLotTable.FindByTaxLotId(taxLotId);
     rowVersion = ((long)(taxLotRow[taxLotTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Guardian.Core.TaxLot.Archive(adoTransaction, sqlTransaction, rowVersion, taxLotId);
 }
示例#6
0
 /// <summary>Loads a TaxLot record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public static void Load(ParameterList parameters)
 {
     // Accessor for the TaxLot Table.
     ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     string externalAccountId = parameters["accountId"];
     decimal cost = parameters["cost"];
     object externalId0 = parameters["externalId0"].Value;
     object externalId1 = parameters["externalId1"].Value;
     object externalId2 = parameters["externalId2"].Value;
     object externalId3 = parameters["externalId3"].Value;
     object localCost = parameters["localCost"].Value;
     string externalPositionTypeCode = parameters["positionTypeCode"];
     decimal quantity = parameters["quantity"];
     string externalSecurityId = parameters["securityId"];
     object settlementDate = parameters["settlementDate"].Value;
     object externalTaxLotId = parameters["taxLotId"].Value;
     object tradeDate = parameters["tradeDate"].Value;
     object userData0 = parameters["userData0"].Value;
     object userData1 = parameters["userData1"].Value;
     object userData2 = parameters["userData2"].Value;
     object userData3 = parameters["userData3"].Value;
     object userData4 = parameters["userData4"].Value;
     object userData5 = parameters["userData5"].Value;
     object userData6 = parameters["userData6"].Value;
     object userData7 = parameters["userData7"].Value;
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     int accountId = Account.FindRequiredKey(configurationId, "accountId", externalAccountId);
     int positionTypeCode = PositionType.FindRequiredKey(configurationId, "positionTypeCode", externalPositionTypeCode);
     int securityId = Security.FindRequiredKey(configurationId, "securityId", externalSecurityId);
     int taxLotId = TaxLot.FindKey(configurationId, "taxLotId", externalTaxLotId);
     // The load operation will create a record if it doesn't exist, or update an existing record.  The external
     // identifier is used to determine if a record exists with the same key.
     if ((taxLotId == int.MinValue))
     {
         // Populate the 'externalId' varaibles so that the external identifier can be used to find the row when an
         // external method is called with the same 'configurationId' parameter.
         int externalKeyIndex = TaxLot.GetExternalKeyIndex(configurationId, "taxLotId");
         object[] externalIdArray = new object[4];
         externalIdArray[externalKeyIndex] = externalTaxLotId;
         externalId0 = externalIdArray[0];
         externalId1 = externalIdArray[1];
         externalId2 = externalIdArray[2];
         externalId3 = externalIdArray[3];
         // Call the internal method to complete the operation.
         MarkThree.Guardian.Core.TaxLot.Insert(adoTransaction, sqlTransaction, ref rowVersion, accountId, cost, externalId0, externalId1, externalId2, externalId3, localCost, positionTypeCode, quantity, securityId, settlementDate, tradeDate, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
     }
     else
     {
         // While the optimistic concurrency checking is disabled for the external methods, the internal methods
         // still need to perform the check.  This ncurrency checking logic by finding the current row version to be
         // will bypass the coused when the internal method is called.
         ServerMarketData.TaxLotRow taxLotRow = taxLotTable.FindByTaxLotId(taxLotId);
         rowVersion = ((long)(taxLotRow[taxLotTable.RowVersionColumn]));
         // Call the internal method to complete the operation.
         MarkThree.Guardian.Core.TaxLot.Update(adoTransaction, sqlTransaction, ref rowVersion, accountId, cost, externalId0, externalId1, externalId2, externalId3, localCost, positionTypeCode, quantity, securityId, settlementDate, taxLotId, tradeDate, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
     }
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
示例#7
0
        /// <summary>Inserts a TaxLot record.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit</param>
        /// <param name="accountId">The value for the AccountId column.</param>
        /// <param name="cost">The value for the Cost column.</param>
        /// <param name="externalId0">The value for the ExternalId0 column.</param>
        /// <param name="externalId1">The value for the ExternalId1 column.</param>
        /// <param name="externalId2">The value for the ExternalId2 column.</param>
        /// <param name="externalId3">The value for the ExternalId3 column.</param>
        /// <param name="localCost">The value for the LocalCost column.</param>
        /// <param name="positionTypeCode">The value for the PositionTypeCode column.</param>
        /// <param name="quantity">The value for the Quantity column.</param>
        /// <param name="securityId">The value for the SecurityId column.</param>
        /// <param name="settlementDate">The value for the SettlementDate column.</param>
        /// <param name="tradeDate">The value for the TradeDate column.</param>
        /// <param name="userData0">The value for the UserData0 column.</param>
        /// <param name="userData1">The value for the UserData1 column.</param>
        /// <param name="userData2">The value for the UserData2 column.</param>
        /// <param name="userData3">The value for the UserData3 column.</param>
        /// <param name="userData4">The value for the UserData4 column.</param>
        /// <param name="userData5">The value for the UserData5 column.</param>
        /// <param name="userData6">The value for the UserData6 column.</param>
        /// <param name="userData7">The value for the UserData7 column.</param>
        public static int Insert(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            int accountId,
            decimal cost,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object localCost,
            int positionTypeCode,
            decimal quantity,
            int securityId,
            object settlementDate,
            object tradeDate,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7)
        {
            // Accessor for the TaxLot Table.
            ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
            // Apply Defaults
            if ((externalId0 == null))
            {
                externalId0 = System.DBNull.Value;
            }
            if ((externalId1 == null))
            {
                externalId1 = System.DBNull.Value;
            }
            if ((externalId2 == null))
            {
                externalId2 = System.DBNull.Value;
            }
            if ((externalId3 == null))
            {
                externalId3 = System.DBNull.Value;
            }
            if ((localCost == null))
            {
                localCost = 0.0m;
            }
            if ((settlementDate == null))
            {
                settlementDate = System.DBNull.Value;
            }
            if ((tradeDate == null))
            {
                tradeDate = System.DBNull.Value;
            }
            if ((userData0 == null))
            {
                userData0 = System.DBNull.Value;
            }
            if ((userData1 == null))
            {
                userData1 = System.DBNull.Value;
            }
            if ((userData2 == null))
            {
                userData2 = System.DBNull.Value;
            }
            if ((userData3 == null))
            {
                userData3 = System.DBNull.Value;
            }
            if ((userData4 == null))
            {
                userData4 = System.DBNull.Value;
            }
            if ((userData5 == null))
            {
                userData5 = System.DBNull.Value;
            }
            if ((userData6 == null))
            {
                userData6 = System.DBNull.Value;
            }
            if ((userData7 == null))
            {
                userData7 = System.DBNull.Value;
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerMarketData.TaxLotRow taxLotRow = taxLotTable.NewTaxLotRow();
            taxLotRow[taxLotTable.RowVersionColumn]       = rowVersion;
            taxLotRow[taxLotTable.AccountIdColumn]        = accountId;
            taxLotRow[taxLotTable.CostColumn]             = cost;
            taxLotRow[taxLotTable.ExternalId0Column]      = externalId0;
            taxLotRow[taxLotTable.ExternalId1Column]      = externalId1;
            taxLotRow[taxLotTable.ExternalId2Column]      = externalId2;
            taxLotRow[taxLotTable.ExternalId3Column]      = externalId3;
            taxLotRow[taxLotTable.LocalCostColumn]        = localCost;
            taxLotRow[taxLotTable.PositionTypeCodeColumn] = positionTypeCode;
            taxLotRow[taxLotTable.QuantityColumn]         = quantity;
            taxLotRow[taxLotTable.SecurityIdColumn]       = securityId;
            taxLotRow[taxLotTable.SettlementDateColumn]   = settlementDate;
            taxLotRow[taxLotTable.TradeDateColumn]        = tradeDate;
            taxLotRow[taxLotTable.UserData0Column]        = userData0;
            taxLotRow[taxLotTable.UserData1Column]        = userData1;
            taxLotRow[taxLotTable.UserData2Column]        = userData2;
            taxLotRow[taxLotTable.UserData3Column]        = userData3;
            taxLotRow[taxLotTable.UserData4Column]        = userData4;
            taxLotRow[taxLotTable.UserData5Column]        = userData5;
            taxLotRow[taxLotTable.UserData6Column]        = userData6;
            taxLotRow[taxLotTable.UserData7Column]        = userData7;
            taxLotTable.AddTaxLotRow(taxLotRow);
            adoTransaction.DataRows.Add(taxLotRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"insert ""TaxLot"" (""rowVersion"",""AccountId"",""Cost"",""ExternalId0"",""ExternalId1"",""ExternalId2"",""ExternalId3"",""LocalCost"",""PositionTypeCode"",""Quantity"",""SecurityId"",""SettlementDate"",""TaxLotId"",""TradeDate"",""UserData0"",""UserData1"",""UserData2"",""UserData3"",""UserData4"",""UserData5"",""UserData6"",""UserData7"") values (@rowVersion,@accountId,@cost,@externalId0,@externalId1,@externalId2,@externalId3,@localCost,@positionTypeCode,@quantity,@securityId,@settlementDate,@taxLotId,@tradeDate,@userData0,@userData1,@userData2,@userData3,@userData4,@userData5,@userData6,@userData7)");

            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("@accountId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountId));
            sqlCommand.Parameters.Add(new SqlParameter("@cost", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, cost));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId0", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId0));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId1", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId1));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId2", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId2));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId3", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId3));
            sqlCommand.Parameters.Add(new SqlParameter("@localCost", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, localCost));
            sqlCommand.Parameters.Add(new SqlParameter("@positionTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, positionTypeCode));
            sqlCommand.Parameters.Add(new SqlParameter("@quantity", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantity));
            sqlCommand.Parameters.Add(new SqlParameter("@securityId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, securityId));
            sqlCommand.Parameters.Add(new SqlParameter("@settlementDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementDate));
            sqlCommand.Parameters.Add(new SqlParameter("@taxLotId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, taxLotRow[taxLotTable.TaxLotIdColumn]));
            sqlCommand.Parameters.Add(new SqlParameter("@tradeDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, tradeDate));
            sqlCommand.Parameters.Add(new SqlParameter("@userData0", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData0));
            sqlCommand.Parameters.Add(new SqlParameter("@userData1", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData1));
            sqlCommand.Parameters.Add(new SqlParameter("@userData2", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData2));
            sqlCommand.Parameters.Add(new SqlParameter("@userData3", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData3));
            sqlCommand.Parameters.Add(new SqlParameter("@userData4", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData4));
            sqlCommand.Parameters.Add(new SqlParameter("@userData5", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData5));
            sqlCommand.Parameters.Add(new SqlParameter("@userData6", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData6));
            sqlCommand.Parameters.Add(new SqlParameter("@userData7", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData7));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(taxLotRow.TaxLotId);
        }
示例#8
0
        /// <summary>Updates a TaxLot 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="accountId">The value for the AccountId column.</param>
        /// <param name="cost">The value for the Cost column.</param>
        /// <param name="externalId0">The value for the ExternalId0 column.</param>
        /// <param name="externalId1">The value for the ExternalId1 column.</param>
        /// <param name="externalId2">The value for the ExternalId2 column.</param>
        /// <param name="externalId3">The value for the ExternalId3 column.</param>
        /// <param name="localCost">The value for the LocalCost column.</param>
        /// <param name="positionTypeCode">The value for the PositionTypeCode column.</param>
        /// <param name="quantity">The value for the Quantity column.</param>
        /// <param name="securityId">The value for the SecurityId column.</param>
        /// <param name="settlementDate">The value for the SettlementDate column.</param>
        /// <param name="taxLotId">The value for the TaxLotId column.</param>
        /// <param name="tradeDate">The value for the TradeDate column.</param>
        /// <param name="userData0">The value for the UserData0 column.</param>
        /// <param name="userData1">The value for the UserData1 column.</param>
        /// <param name="userData2">The value for the UserData2 column.</param>
        /// <param name="userData3">The value for the UserData3 column.</param>
        /// <param name="userData4">The value for the UserData4 column.</param>
        /// <param name="userData5">The value for the UserData5 column.</param>
        /// <param name="userData6">The value for the UserData6 column.</param>
        /// <param name="userData7">The value for the UserData7 column.</param>
        public static void Update(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object accountId,
            object cost,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object localCost,
            object positionTypeCode,
            object quantity,
            object securityId,
            object settlementDate,
            int taxLotId,
            object tradeDate,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7)
        {
            // Accessor for the TaxLot Table.
            ServerMarketData.TaxLotDataTable taxLotTable = ServerMarketData.TaxLot;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.TaxLotRow taxLotRow = taxLotTable.FindByTaxLotId(taxLotId);
            if ((taxLotRow == null))
            {
                throw new Exception(string.Format("The TaxLot table does not have an element identified by {0}", taxLotId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((taxLotRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((accountId == null))
            {
                accountId = taxLotRow[taxLotTable.AccountIdColumn];
            }
            if ((cost == null))
            {
                cost = taxLotRow[taxLotTable.CostColumn];
            }
            if ((externalId0 == null))
            {
                externalId0 = taxLotRow[taxLotTable.ExternalId0Column];
            }
            if ((externalId1 == null))
            {
                externalId1 = taxLotRow[taxLotTable.ExternalId1Column];
            }
            if ((externalId2 == null))
            {
                externalId2 = taxLotRow[taxLotTable.ExternalId2Column];
            }
            if ((externalId3 == null))
            {
                externalId3 = taxLotRow[taxLotTable.ExternalId3Column];
            }
            if ((localCost == null))
            {
                localCost = taxLotRow[taxLotTable.LocalCostColumn];
            }
            if ((positionTypeCode == null))
            {
                positionTypeCode = taxLotRow[taxLotTable.PositionTypeCodeColumn];
            }
            if ((quantity == null))
            {
                quantity = taxLotRow[taxLotTable.QuantityColumn];
            }
            if ((securityId == null))
            {
                securityId = taxLotRow[taxLotTable.SecurityIdColumn];
            }
            if ((settlementDate == null))
            {
                settlementDate = taxLotRow[taxLotTable.SettlementDateColumn];
            }
            if ((tradeDate == null))
            {
                tradeDate = taxLotRow[taxLotTable.TradeDateColumn];
            }
            if ((userData0 == null))
            {
                userData0 = taxLotRow[taxLotTable.UserData0Column];
            }
            if ((userData1 == null))
            {
                userData1 = taxLotRow[taxLotTable.UserData1Column];
            }
            if ((userData2 == null))
            {
                userData2 = taxLotRow[taxLotTable.UserData2Column];
            }
            if ((userData3 == null))
            {
                userData3 = taxLotRow[taxLotTable.UserData3Column];
            }
            if ((userData4 == null))
            {
                userData4 = taxLotRow[taxLotTable.UserData4Column];
            }
            if ((userData5 == null))
            {
                userData5 = taxLotRow[taxLotTable.UserData5Column];
            }
            if ((userData6 == null))
            {
                userData6 = taxLotRow[taxLotTable.UserData6Column];
            }
            if ((userData7 == null))
            {
                userData7 = taxLotRow[taxLotTable.UserData7Column];
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Update the record in the ADO database.
            taxLotRow[taxLotTable.RowVersionColumn]       = rowVersion;
            taxLotRow[taxLotTable.AccountIdColumn]        = accountId;
            taxLotRow[taxLotTable.CostColumn]             = cost;
            taxLotRow[taxLotTable.ExternalId0Column]      = externalId0;
            taxLotRow[taxLotTable.ExternalId1Column]      = externalId1;
            taxLotRow[taxLotTable.ExternalId2Column]      = externalId2;
            taxLotRow[taxLotTable.ExternalId3Column]      = externalId3;
            taxLotRow[taxLotTable.LocalCostColumn]        = localCost;
            taxLotRow[taxLotTable.PositionTypeCodeColumn] = positionTypeCode;
            taxLotRow[taxLotTable.QuantityColumn]         = quantity;
            taxLotRow[taxLotTable.SecurityIdColumn]       = securityId;
            taxLotRow[taxLotTable.SettlementDateColumn]   = settlementDate;
            taxLotRow[taxLotTable.TradeDateColumn]        = tradeDate;
            taxLotRow[taxLotTable.UserData0Column]        = userData0;
            taxLotRow[taxLotTable.UserData1Column]        = userData1;
            taxLotRow[taxLotTable.UserData2Column]        = userData2;
            taxLotRow[taxLotTable.UserData3Column]        = userData3;
            taxLotRow[taxLotTable.UserData4Column]        = userData4;
            taxLotRow[taxLotTable.UserData5Column]        = userData5;
            taxLotRow[taxLotTable.UserData6Column]        = userData6;
            taxLotRow[taxLotTable.UserData7Column]        = userData7;
            adoTransaction.DataRows.Add(taxLotRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"update ""TaxLot"" set ""RowVersion""=@rowVersion,""AccountId""=@accountId,""Cost""=@cost,""ExternalId0""=@externalId0,""ExternalId1""=@externalId1,""ExternalId2""=@externalId2,""ExternalId3""=@externalId3,""LocalCost""=@localCost,""PositionTypeCode""=@positionTypeCode,""Quantity""=@quantity,""SecurityId""=@securityId,""SettlementDate""=@settlementDate,""TradeDate""=@tradeDate,""UserData0""=@userData0,""UserData1""=@userData1,""UserData2""=@userData2,""UserData3""=@userData3,""UserData4""=@userData4,""UserData5""=@userData5,""UserData6""=@userData6,""UserData7""=@userData7 where ""TaxLotId""=@taxLotId");

            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("@accountId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountId));
            sqlCommand.Parameters.Add(new SqlParameter("@cost", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, cost));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId0", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId0));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId1", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId1));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId2", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId2));
            sqlCommand.Parameters.Add(new SqlParameter("@externalId3", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, externalId3));
            sqlCommand.Parameters.Add(new SqlParameter("@localCost", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, localCost));
            sqlCommand.Parameters.Add(new SqlParameter("@positionTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, positionTypeCode));
            sqlCommand.Parameters.Add(new SqlParameter("@quantity", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, quantity));
            sqlCommand.Parameters.Add(new SqlParameter("@securityId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, securityId));
            sqlCommand.Parameters.Add(new SqlParameter("@settlementDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, settlementDate));
            sqlCommand.Parameters.Add(new SqlParameter("@taxLotId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, taxLotId));
            sqlCommand.Parameters.Add(new SqlParameter("@tradeDate", SqlDbType.DateTime, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, tradeDate));
            sqlCommand.Parameters.Add(new SqlParameter("@userData0", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData0));
            sqlCommand.Parameters.Add(new SqlParameter("@userData1", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData1));
            sqlCommand.Parameters.Add(new SqlParameter("@userData2", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData2));
            sqlCommand.Parameters.Add(new SqlParameter("@userData3", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData3));
            sqlCommand.Parameters.Add(new SqlParameter("@userData4", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData4));
            sqlCommand.Parameters.Add(new SqlParameter("@userData5", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData5));
            sqlCommand.Parameters.Add(new SqlParameter("@userData6", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData6));
            sqlCommand.Parameters.Add(new SqlParameter("@userData7", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, userData7));
            // Update the record in the SQL database.
            sqlCommand.ExecuteNonQuery();
        }