Exemplo n.º 1
0
 /// <summary>Collects the table lock request(s) for an Update operation</summary>
 /// <param name="adoTransaction">A list of locks required for this operation.</param>
 internal new static void ArchiveChildren(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.AccountLock);
     Allocation.Archive(adoTransaction);
     Position.Archive(adoTransaction);
     TaxLot.Archive(adoTransaction);
 }
Exemplo n.º 2
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 Archive(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.OrderTypeLock);
     Allocation.Archive(adoTransaction);
     SourceOrder.Archive(adoTransaction);
     WorkingOrder.Archive(adoTransaction);
 }
Exemplo n.º 3
0
        /// <summary>Inserts a Allocation record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public static void Archive(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction = parameters["adoTransaction"];
            SqlTransaction sqlTransaction = parameters["sqlTransaction"];
            long           rowVersion     = parameters["rowVersion"];
            int            allocationId   = parameters["allocationId"];

            // Call the internal method to complete the operation.
            Allocation.Archive(adoTransaction, sqlTransaction, rowVersion, allocationId);
        }
Exemplo n.º 4
0
 /// <summary>Collects the table lock request(s) for an Update operation</summary>
 /// <param name="adoTransaction">A list of locks required for this operation.</param>
 internal static void ArchiveChildren(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.UserLock);
     AccountBase.ArchiveChildren(adoTransaction);
     Allocation.Archive(adoTransaction);
     ComplianceOfficer.ArchiveChildren(adoTransaction);
     Execution.Archive(adoTransaction);
     SourceOrder.Archive(adoTransaction);
     Trader.ArchiveChildren(adoTransaction);
     WorkingOrder.Archive(adoTransaction);
 }
Exemplo 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>
 internal static void ArchiveChildren(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.SecurityLock);
     AccountBase.ArchiveChildren(adoTransaction);
     Allocation.Archive(adoTransaction);
     Currency.ArchiveChildren(adoTransaction);
     Debt.ArchiveChildren(adoTransaction);
     Equity.ArchiveChildren(adoTransaction);
     Position.Archive(adoTransaction);
     Price.Archive(adoTransaction);
     SourceOrder.Archive(adoTransaction);
     TaxLot.Archive(adoTransaction);
     WorkingOrder.Archive(adoTransaction);
 }
Exemplo n.º 6
0
        /// <summary>Archives a OrderType 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="orderTypeCode">The value for the OrderTypeCode 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 orderTypeCode)
        {
            // Accessor for the OrderType Table.
            ServerMarketData.OrderTypeDataTable orderTypeTable = ServerMarketData.OrderType;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.OrderTypeRow orderTypeRow = orderTypeTable.FindByOrderTypeCode(orderTypeCode);
            if ((orderTypeRow == null))
            {
                throw new Exception(string.Format("The OrderType table does not have an element identified by {0}", orderTypeCode));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((orderTypeRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < orderTypeRow.GetAllocationRows().Length); index = (index + 1))
            {
                ServerMarketData.AllocationRow childAllocationRow = orderTypeRow.GetAllocationRows()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < orderTypeRow.GetSourceOrderRows().Length); index = (index + 1))
            {
                ServerMarketData.SourceOrderRow childSourceOrderRow = orderTypeRow.GetSourceOrderRows()[index];
                SourceOrder.Archive(adoTransaction, sqlTransaction, childSourceOrderRow.RowVersion, childSourceOrderRow.SourceOrderId);
            }
            for (int index = 0; (index < orderTypeRow.GetWorkingOrderRows().Length); index = (index + 1))
            {
                ServerMarketData.WorkingOrderRow childWorkingOrderRow = orderTypeRow.GetWorkingOrderRows()[index];
                WorkingOrder.Archive(adoTransaction, sqlTransaction, childWorkingOrderRow.RowVersion, childWorkingOrderRow.WorkingOrderId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            orderTypeRow[orderTypeTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(orderTypeRow);
            orderTypeRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"OrderType\" set \"IsArchived\" = 1 where \"OrderTypeCode\"=@orderTypeCode");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@orderTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, orderTypeCode));
            sqlCommand.ExecuteNonQuery();
        }
Exemplo n.º 7
0
        /// <summary>Inserts a Allocation record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public static void Insert(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction  = parameters["adoTransaction"];
            SqlTransaction sqlTransaction  = parameters["sqlTransaction"];
            int            accountId       = parameters["accountId"];
            decimal        accruedInterest = parameters["accruedInterest"];
            decimal        commission      = parameters["commission"];

            System.DateTime createdTime   = parameters["createdTime"];
            int             createdUserId = parameters["createdUserId"];

            System.DateTime modifiedTime     = parameters["modifiedTime"];
            int             modifiedUserId   = parameters["modifiedUserId"];
            int             orderTypeCode    = parameters["orderTypeCode"];
            int             positionTypeCode = parameters["positionTypeCode"];
            decimal         price            = parameters["price"];
            decimal         quantity         = parameters["quantity"];
            int             securityId       = parameters["securityId"];

            System.DateTime settlementDate = parameters["settlementDate"];
            int             settlementId   = parameters["settlementId"];

            System.DateTime tradeDate      = parameters["tradeDate"];
            decimal         userFee0       = parameters["userFee0"];
            decimal         userFee1       = parameters["userFee1"];
            decimal         userFee2       = parameters["userFee2"];
            decimal         userFee3       = parameters["userFee3"];
            int             workingOrderId = parameters["workingOrderId"];
            // The rowVersion is passed back to the caller in the event it's needed for additional commands in the batch.
            long rowVersion = long.MinValue;
            // Call the internal method to complete the operation.
            int allocationId = Allocation.Insert(adoTransaction, sqlTransaction, ref rowVersion, accountId, accruedInterest, commission, createdTime, createdUserId, modifiedTime, modifiedUserId, orderTypeCode, positionTypeCode, price, quantity, securityId, settlementDate, settlementId, tradeDate, userFee0, userFee1, userFee2, userFee3, workingOrderId);

            // Return values.
            parameters["rowVersion"] = rowVersion;
            parameters.Return        = allocationId;
        }
Exemplo n.º 8
0
        /// <summary>ArchiveChildrens a Account 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="accountId">The value for the AccountId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        internal new static void ArchiveChildren(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int accountId)
        {
            // Accessor for the Account Table.
            ServerMarketData.AccountDataTable accountTable = ServerMarketData.Account;
            // This record can be used to iterate through all the children.
            ServerMarketData.AccountRow accountRow = accountTable.FindByAccountId(accountId);
            // Archive the child records.
            for (int index = 0; (index < accountRow.GetAllocationRows().Length); index = (index + 1))
            {
                ServerMarketData.AllocationRow childAllocationRow = accountRow.GetAllocationRows()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < accountRow.GetPositionRows().Length); index = (index + 1))
            {
                ServerMarketData.PositionRow childPositionRow = accountRow.GetPositionRows()[index];
                Position.Archive(adoTransaction, sqlTransaction, childPositionRow.RowVersion, childPositionRow.AccountId, childPositionRow.SecurityId, childPositionRow.PositionTypeCode);
            }
            for (int index = 0; (index < accountRow.GetTaxLotRows().Length); index = (index + 1))
            {
                ServerMarketData.TaxLotRow childTaxLotRow = accountRow.GetTaxLotRows()[index];
                TaxLot.Archive(adoTransaction, sqlTransaction, childTaxLotRow.RowVersion, childTaxLotRow.TaxLotId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            accountRow[accountTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(accountRow);
            accountRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Account\" set \"IsArchived\" = 1 where \"AccountId\"=@accountId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@accountId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountId));
            sqlCommand.ExecuteNonQuery();
        }
Exemplo 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.
            ServerMarketData.SecurityDataTable securityTable = ServerMarketData.Security;
            // This record can be used to iterate through all the children.
            ServerMarketData.SecurityRow securityRow = securityTable.FindBySecurityId(securityId);
            // Archive the child records.
            for (int index = 0; (index < securityRow.GetAccountBaseRows().Length); index = (index + 1))
            {
                ServerMarketData.AccountBaseRow childAccountBaseRow = securityRow.GetAccountBaseRows()[index];
                AccountBase.ArchiveChildren(adoTransaction, sqlTransaction, childAccountBaseRow.RowVersion, childAccountBaseRow.AccountBaseId);
            }
            for (int index = 0; (index < securityRow.GetAllocationRowsBySecurityAllocationSecurityId().Length); index = (index + 1))
            {
                ServerMarketData.AllocationRow childAllocationRow = securityRow.GetAllocationRowsBySecurityAllocationSecurityId()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < securityRow.GetAllocationRowsBySecurityAllocationSettlementId().Length); index = (index + 1))
            {
                ServerMarketData.AllocationRow childAllocationRow = securityRow.GetAllocationRowsBySecurityAllocationSettlementId()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < securityRow.GetCurrencyRows().Length); index = (index + 1))
            {
                ServerMarketData.CurrencyRow childCurrencyRow = securityRow.GetCurrencyRows()[index];
                Currency.ArchiveChildren(adoTransaction, sqlTransaction, childCurrencyRow.RowVersion, childCurrencyRow.CurrencyId);
            }
            for (int index = 0; (index < securityRow.GetDebtRowsBySecurityDebtDebtId().Length); index = (index + 1))
            {
                ServerMarketData.DebtRow childDebtRow = securityRow.GetDebtRowsBySecurityDebtDebtId()[index];
                Debt.ArchiveChildren(adoTransaction, sqlTransaction, childDebtRow.RowVersion, childDebtRow.DebtId);
            }
            for (int index = 0; (index < securityRow.GetDebtRowsBySecurityDebtSettlementId().Length); index = (index + 1))
            {
                ServerMarketData.DebtRow childDebtRow = securityRow.GetDebtRowsBySecurityDebtSettlementId()[index];
                Debt.ArchiveChildren(adoTransaction, sqlTransaction, childDebtRow.RowVersion, childDebtRow.DebtId);
            }
            for (int index = 0; (index < securityRow.GetEquityRowsBySecurityEquityEquityId().Length); index = (index + 1))
            {
                ServerMarketData.EquityRow childEquityRow = securityRow.GetEquityRowsBySecurityEquityEquityId()[index];
                Equity.ArchiveChildren(adoTransaction, sqlTransaction, childEquityRow.RowVersion, childEquityRow.EquityId);
            }
            for (int index = 0; (index < securityRow.GetEquityRowsBySecurityEquitySettlementId().Length); index = (index + 1))
            {
                ServerMarketData.EquityRow childEquityRow = securityRow.GetEquityRowsBySecurityEquitySettlementId()[index];
                Equity.ArchiveChildren(adoTransaction, sqlTransaction, childEquityRow.RowVersion, childEquityRow.EquityId);
            }
            for (int index = 0; (index < securityRow.GetPositionRows().Length); index = (index + 1))
            {
                ServerMarketData.PositionRow childPositionRow = securityRow.GetPositionRows()[index];
                Position.Archive(adoTransaction, sqlTransaction, childPositionRow.RowVersion, childPositionRow.AccountId, childPositionRow.SecurityId, childPositionRow.PositionTypeCode);
            }
            for (int index = 0; (index < securityRow.GetPriceRows().Length); index = (index + 1))
            {
                ServerMarketData.PriceRow childPriceRow = securityRow.GetPriceRows()[index];
                Price.Archive(adoTransaction, sqlTransaction, childPriceRow.RowVersion, childPriceRow.SecurityId);
            }
            for (int index = 0; (index < securityRow.GetSourceOrderRowsBySecuritySourceOrderSecurityId().Length); index = (index + 1))
            {
                ServerMarketData.SourceOrderRow childSourceOrderRow = securityRow.GetSourceOrderRowsBySecuritySourceOrderSecurityId()[index];
                SourceOrder.Archive(adoTransaction, sqlTransaction, childSourceOrderRow.RowVersion, childSourceOrderRow.SourceOrderId);
            }
            for (int index = 0; (index < securityRow.GetSourceOrderRowsBySecuritySourceOrderSettlementId().Length); index = (index + 1))
            {
                ServerMarketData.SourceOrderRow childSourceOrderRow = securityRow.GetSourceOrderRowsBySecuritySourceOrderSettlementId()[index];
                SourceOrder.Archive(adoTransaction, sqlTransaction, childSourceOrderRow.RowVersion, childSourceOrderRow.SourceOrderId);
            }
            for (int index = 0; (index < securityRow.GetTaxLotRows().Length); index = (index + 1))
            {
                ServerMarketData.TaxLotRow childTaxLotRow = securityRow.GetTaxLotRows()[index];
                TaxLot.Archive(adoTransaction, sqlTransaction, childTaxLotRow.RowVersion, childTaxLotRow.TaxLotId);
            }
            for (int index = 0; (index < securityRow.GetWorkingOrderRowsBySecurityWorkingOrderSecurityId().Length); index = (index + 1))
            {
                ServerMarketData.WorkingOrderRow childWorkingOrderRow = securityRow.GetWorkingOrderRowsBySecurityWorkingOrderSecurityId()[index];
                WorkingOrder.Archive(adoTransaction, sqlTransaction, childWorkingOrderRow.RowVersion, childWorkingOrderRow.WorkingOrderId);
            }
            for (int index = 0; (index < securityRow.GetWorkingOrderRowsBySecurityWorkingOrderSettlementId().Length); index = (index + 1))
            {
                ServerMarketData.WorkingOrderRow childWorkingOrderRow = securityRow.GetWorkingOrderRowsBySecurityWorkingOrderSettlementId()[index];
                WorkingOrder.Archive(adoTransaction, sqlTransaction, childWorkingOrderRow.RowVersion, childWorkingOrderRow.WorkingOrderId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.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();
        }
Exemplo n.º 10
0
        /// <summary>ArchiveChildrens 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 ArchiveChildren(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int userId)
        {
            // Accessor for the User Table.
            ServerMarketData.UserDataTable userTable = ServerMarketData.User;
            // This record can be used to iterate through all the children.
            ServerMarketData.UserRow userRow = userTable.FindByUserId(userId);
            // Archive the child records.
            for (int index = 0; (index < userRow.GetAccountBaseRows().Length); index = (index + 1))
            {
                ServerMarketData.AccountBaseRow childAccountBaseRow = userRow.GetAccountBaseRows()[index];
                AccountBase.ArchiveChildren(adoTransaction, sqlTransaction, childAccountBaseRow.RowVersion, childAccountBaseRow.AccountBaseId);
            }
            for (int index = 0; (index < userRow.GetAllocationRowsByUserAllocationCreatedUserId().Length); index = (index + 1))
            {
                ServerMarketData.AllocationRow childAllocationRow = userRow.GetAllocationRowsByUserAllocationCreatedUserId()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < userRow.GetAllocationRowsByUserAllocationModifiedUserId().Length); index = (index + 1))
            {
                ServerMarketData.AllocationRow childAllocationRow = userRow.GetAllocationRowsByUserAllocationModifiedUserId()[index];
                Allocation.Archive(adoTransaction, sqlTransaction, childAllocationRow.RowVersion, childAllocationRow.AllocationId);
            }
            for (int index = 0; (index < userRow.GetComplianceOfficerRows().Length); index = (index + 1))
            {
                ServerMarketData.ComplianceOfficerRow childComplianceOfficerRow = userRow.GetComplianceOfficerRows()[index];
                ComplianceOfficer.ArchiveChildren(adoTransaction, sqlTransaction, childComplianceOfficerRow.RowVersion, childComplianceOfficerRow.ComplianceOfficerId);
            }
            for (int index = 0; (index < userRow.GetExecutionRowsByUserExecutionCreatedUserId().Length); index = (index + 1))
            {
                ServerMarketData.ExecutionRow childExecutionRow = userRow.GetExecutionRowsByUserExecutionCreatedUserId()[index];
                Execution.Archive(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
            }
            for (int index = 0; (index < userRow.GetExecutionRowsByUserExecutionModifiedUserId().Length); index = (index + 1))
            {
                ServerMarketData.ExecutionRow childExecutionRow = userRow.GetExecutionRowsByUserExecutionModifiedUserId()[index];
                Execution.Archive(adoTransaction, sqlTransaction, childExecutionRow.RowVersion, childExecutionRow.ExecutionId);
            }
            for (int index = 0; (index < userRow.GetSourceOrderRowsByUserSourceOrderCreatedUserId().Length); index = (index + 1))
            {
                ServerMarketData.SourceOrderRow childSourceOrderRow = userRow.GetSourceOrderRowsByUserSourceOrderCreatedUserId()[index];
                SourceOrder.Archive(adoTransaction, sqlTransaction, childSourceOrderRow.RowVersion, childSourceOrderRow.SourceOrderId);
            }
            for (int index = 0; (index < userRow.GetSourceOrderRowsByUserSourceOrderModifiedUserId().Length); index = (index + 1))
            {
                ServerMarketData.SourceOrderRow childSourceOrderRow = userRow.GetSourceOrderRowsByUserSourceOrderModifiedUserId()[index];
                SourceOrder.Archive(adoTransaction, sqlTransaction, childSourceOrderRow.RowVersion, childSourceOrderRow.SourceOrderId);
            }
            for (int index = 0; (index < userRow.GetTraderRows().Length); index = (index + 1))
            {
                ServerMarketData.TraderRow childTraderRow = userRow.GetTraderRows()[index];
                Trader.ArchiveChildren(adoTransaction, sqlTransaction, childTraderRow.RowVersion, childTraderRow.TraderId);
            }
            for (int index = 0; (index < userRow.GetWorkingOrderRowsByUserWorkingOrderCreatedUserId().Length); index = (index + 1))
            {
                ServerMarketData.WorkingOrderRow childWorkingOrderRow = userRow.GetWorkingOrderRowsByUserWorkingOrderCreatedUserId()[index];
                WorkingOrder.Archive(adoTransaction, sqlTransaction, childWorkingOrderRow.RowVersion, childWorkingOrderRow.WorkingOrderId);
            }
            for (int index = 0; (index < userRow.GetWorkingOrderRowsByUserWorkingOrderModifiedUserId().Length); index = (index + 1))
            {
                ServerMarketData.WorkingOrderRow childWorkingOrderRow = userRow.GetWorkingOrderRowsByUserWorkingOrderModifiedUserId()[index];
                WorkingOrder.Archive(adoTransaction, sqlTransaction, childWorkingOrderRow.RowVersion, childWorkingOrderRow.WorkingOrderId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            userRow[userTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(userRow);
            userRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"User\" set \"IsArchived\" = 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();
        }