Exemple #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.CurrencyLock);
     AccountBase.ArchiveChildren(adoTransaction);
     Price.Archive(adoTransaction);
 }
Exemple #2
0
        /// <summary>Archives a Province 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="provinceId">The value for the ProvinceId 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 provinceId)
        {
            // Accessor for the Province Table.
            ServerMarketData.ProvinceDataTable provinceTable = ServerMarketData.Province;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.ProvinceRow provinceRow = provinceTable.FindByProvinceId(provinceId);
            if ((provinceRow == null))
            {
                throw new Exception(string.Format("The Province table does not have an element identified by {0}", provinceId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((provinceRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < provinceRow.GetAccountBaseRows().Length); index = (index + 1))
            {
                ServerMarketData.AccountBaseRow childAccountBaseRow = provinceRow.GetAccountBaseRows()[index];
                AccountBase.ArchiveChildren(adoTransaction, sqlTransaction, childAccountBaseRow.RowVersion, childAccountBaseRow.AccountBaseId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            provinceRow[provinceTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(provinceRow);
            provinceRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Province\" set \"IsArchived\" = 1 where \"ProvinceId\"=@provinceId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@provinceId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, provinceId));
            sqlCommand.ExecuteNonQuery();
        }
Exemple #3
0
        /// <summary>ArchiveChildrens a Currency 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="currencyId">The value for the CurrencyId 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 currencyId)
        {
            // Accessor for the Currency Table.
            ServerMarketData.CurrencyDataTable currencyTable = ServerMarketData.Currency;
            // This record can be used to iterate through all the children.
            ServerMarketData.CurrencyRow currencyRow = currencyTable.FindByCurrencyId(currencyId);
            // Archive the child records.
            for (int index = 0; (index < currencyRow.GetAccountBaseRows().Length); index = (index + 1))
            {
                ServerMarketData.AccountBaseRow childAccountBaseRow = currencyRow.GetAccountBaseRows()[index];
                AccountBase.ArchiveChildren(adoTransaction, sqlTransaction, childAccountBaseRow.RowVersion, childAccountBaseRow.AccountBaseId);
            }
            for (int index = 0; (index < currencyRow.GetPriceRows().Length); index = (index + 1))
            {
                ServerMarketData.PriceRow childPriceRow = currencyRow.GetPriceRows()[index];
                Price.Archive(adoTransaction, sqlTransaction, childPriceRow.RowVersion, childPriceRow.SecurityId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            currencyRow[currencyTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(currencyRow);
            currencyRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Currency\" set \"IsArchived\" = 1 where \"CurrencyId\"=@currencyId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@currencyId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, currencyId));
            sqlCommand.ExecuteNonQuery();
        }
Exemple #4
0
 /// <summary>Collects the table lock request(s) for an Insert operation</summary>
 /// <param name="adoTransaction">A list of locks required for this operation.</param>
 public new static void Insert(AdoTransaction adoTransaction)
 {
     // Lock the tables at the base level of the object hierarchy.
     AccountBase.Insert(adoTransaction);
     // These table lock(s) are required for the 'Insert' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.AccountGroupLock);
 }
Exemple #5
0
 /// <summary>Collects the table lock request(s) for an Update operation</summary>
 /// <param name="adoTransaction">A list of locks required for this operation.</param>
 public static void Archive(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Archive' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.CountryLock);
     AccountBase.ArchiveChildren(adoTransaction);
     Holiday.Archive(adoTransaction);
     Province.Archive(adoTransaction);
     Security.ArchiveChildren(adoTransaction);
 }
Exemple #6
0
        /// <summary>Inserts a AccountBase record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public new static void Archive(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction = parameters["adoTransaction"];
            SqlTransaction sqlTransaction = parameters["sqlTransaction"];
            long           rowVersion     = parameters["rowVersion"];
            int            accountBaseId  = parameters["accountBaseId"];

            // Call the internal method to complete the operation.
            AccountBase.Archive(adoTransaction, sqlTransaction, rowVersion, accountBaseId);
        }
Exemple #7
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.ObjectLock);
     AccountBase.ArchiveChildren(adoTransaction);
     Blotter.ArchiveChildren(adoTransaction);
     Folder.ArchiveChildren(adoTransaction);
     Issuer.ArchiveChildren(adoTransaction);
     ObjectTree.Archive(adoTransaction);
     Security.ArchiveChildren(adoTransaction);
     User.ArchiveChildren(adoTransaction);
 }
Exemple #8
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);
 }
Exemple #9
0
        /// <summary>Deletes a Country 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="countryId">The value for the CountryId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        public static void Delete(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int countryId)
        {
            // Accessor for the Country Table.
            ServerMarketData.CountryDataTable countryTable = ServerMarketData.Country;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.CountryRow countryRow = countryTable.FindByCountryId(countryId);
            if ((countryRow == null))
            {
                throw new Exception(string.Format("The Country table does not have an element identified by {0}", countryId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((countryRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Delete the child records.
            for (int index = 0; (index < countryRow.GetAccountBaseRows().Length); index = (index + 1))
            {
                ServerMarketData.AccountBaseRow childAccountBaseRow = countryRow.GetAccountBaseRows()[index];
                AccountBase.DeleteChildren(adoTransaction, sqlTransaction, childAccountBaseRow.RowVersion, childAccountBaseRow.AccountBaseId);
            }
            for (int index = 0; (index < countryRow.GetHolidayRows().Length); index = (index + 1))
            {
                ServerMarketData.HolidayRow childHolidayRow = countryRow.GetHolidayRows()[index];
                Holiday.Delete(adoTransaction, sqlTransaction, childHolidayRow.RowVersion, childHolidayRow.HolidayId);
            }
            for (int index = 0; (index < countryRow.GetProvinceRows().Length); index = (index + 1))
            {
                ServerMarketData.ProvinceRow childProvinceRow = countryRow.GetProvinceRows()[index];
                Province.Delete(adoTransaction, sqlTransaction, childProvinceRow.RowVersion, childProvinceRow.ProvinceId);
            }
            for (int index = 0; (index < countryRow.GetSecurityRows().Length); index = (index + 1))
            {
                ServerMarketData.SecurityRow childSecurityRow = countryRow.GetSecurityRows()[index];
                Security.DeleteChildren(adoTransaction, sqlTransaction, childSecurityRow.RowVersion, childSecurityRow.SecurityId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            countryRow[countryTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(countryRow);
            countryRow.Delete();
            // Delete the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Country\" set \"IsDeleted\" = 1 where \"CountryId\"=@countryId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@countryId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, countryId));
            sqlCommand.ExecuteNonQuery();
        }
Exemple #10
0
        /// <summary>Inserts a AccountBase record using Metadata Parameters.</summary>
        /// <param name="parameters">Contains the metadata parameters.</param>
        public new static void Insert(ParameterList parameters)
        {
            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction  = parameters["adoTransaction"];
            SqlTransaction sqlTransaction  = parameters["sqlTransaction"];
            object         description     = parameters["description"].Value;
            object         externalId0     = parameters["externalId0"].Value;
            object         externalId1     = parameters["externalId1"].Value;
            object         externalId2     = parameters["externalId2"].Value;
            object         externalId3     = parameters["externalId3"].Value;
            object         externalId4     = parameters["externalId4"].Value;
            object         externalId5     = parameters["externalId5"].Value;
            object         externalId6     = parameters["externalId6"].Value;
            object         externalId7     = parameters["externalId7"].Value;
            object         groupPermission = parameters["groupPermission"].Value;
            object         hidden          = parameters["hidden"].Value;
            string         name            = parameters["name"];
            object         owner           = parameters["owner"].Value;
            object         ownerPermission = parameters["ownerPermission"].Value;
            object         readOnly        = parameters["readOnly"].Value;
            object         worldPermission = parameters["worldPermission"].Value;
            object         address0        = parameters["address0"].Value;
            object         address1        = parameters["address1"].Value;
            object         address2        = parameters["address2"].Value;
            object         city            = parameters["city"].Value;
            object         countryId       = parameters["countryId"].Value;
            int            currencyId      = parameters["currencyId"];
            object         mnemonic        = parameters["mnemonic"].Value;
            object         postalCode      = parameters["postalCode"].Value;
            object         provinceId      = parameters["provinceId"].Value;
            object         typeCode        = parameters["typeCode"].Value;
            int            userId          = parameters["userId"];
            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 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 accountBaseId = AccountBase.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);

            // Return values.
            parameters["rowVersion"] = rowVersion;
            parameters.Return        = accountBaseId;
        }
Exemple #11
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);
 }
Exemple #12
0
        /// <summary>Archives a AccountGroup 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="accountGroupId">The value for the AccountGroupId column.</param>
        /// <param name="archive">true to archive the object, false to unarchive it.</param>
        public new static void Archive(AdoTransaction adoTransaction, SqlTransaction sqlTransaction, long rowVersion, int accountGroupId)
        {
            // Accessor for the AccountGroup Table.
            ServerMarketData.AccountGroupDataTable accountGroupTable = ServerMarketData.AccountGroup;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.AccountGroupRow accountGroupRow = accountGroupTable.FindByAccountGroupId(accountGroupId);
            if ((accountGroupRow == null))
            {
                throw new Exception(string.Format("The AccountGroup table does not have an element identified by {0}", accountGroupId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((accountGroupRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Delete the base class record.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = accountGroupRow.AccountBaseRow.RowVersion;

            AccountBase.Archive(adoTransaction, sqlTransaction, baseRowVersion, accountGroupId);
        }
Exemple #13
0
        /// <summary>Updates 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 the row</param>
        /// <param name="description">The value for the Description 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="externalId4">The value for the ExternalId4 column.</param>
        /// <param name="externalId5">The value for the ExternalId5 column.</param>
        /// <param name="externalId6">The value for the ExternalId6 column.</param>
        /// <param name="externalId7">The value for the ExternalId7 column.</param>
        /// <param name="groupPermission">The value for the GroupPermission column.</param>
        /// <param name="hidden">The value for the Hidden column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="owner">The value for the Owner column.</param>
        /// <param name="ownerPermission">The value for the OwnerPermission column.</param>
        /// <param name="readOnly">The value for the ReadOnly column.</param>
        /// <param name="worldPermission">The value for the WorldPermission column.</param>
        /// <param name="address0">The value for the Address0 column.</param>
        /// <param name="address1">The value for the Address1 column.</param>
        /// <param name="address2">The value for the Address2 column.</param>
        /// <param name="city">The value for the City column.</param>
        /// <param name="countryId">The value for the CountryId column.</param>
        /// <param name="currencyId">The value for the CurrencyId column.</param>
        /// <param name="mnemonic">The value for the Mnemonic column.</param>
        /// <param name="postalCode">The value for the PostalCode column.</param>
        /// <param name="provinceId">The value for the ProvinceId column.</param>
        /// <param name="userId">The value for the UserId 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>
        /// <param name="accountId">The value for the AccountId column.</param>
        /// <param name="lotHandlingCode">The value for the LotHandlingCode column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        public static void Update(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object description,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object externalId4,
            object externalId5,
            object externalId6,
            object externalId7,
            object groupPermission,
            object hidden,
            object name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            object address0,
            object address1,
            object address2,
            object city,
            object countryId,
            object currencyId,
            object mnemonic,
            object postalCode,
            object provinceId,
            object userId,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7,
            int accountId,
            object lotHandlingCode,
            object typeCode)
        {
            // Accessor for the Account Table.
            ServerMarketData.AccountDataTable accountTable = ServerMarketData.Account;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.AccountRow accountRow = accountTable.FindByAccountId(accountId);
            if ((accountRow == null))
            {
                throw new Exception(string.Format("The Account table does not have an element identified by {0}", accountId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((accountRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((lotHandlingCode == null))
            {
                lotHandlingCode = accountRow[accountTable.LotHandlingCodeColumn];
            }
            // Insert the base members using the base class.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = accountRow.AccountBaseRow.RowVersion;

            AccountBase.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, accountId, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Update the record in the ADO database.
            accountRow[accountTable.RowVersionColumn]      = rowVersion;
            accountRow[accountTable.LotHandlingCodeColumn] = lotHandlingCode;
            adoTransaction.DataRows.Add(accountRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Account\" set \"RowVersion\"=@rowVersion,\"LotHandlingCode\"=@lotHandlingCode " +
                                                   "where \"AccountId\"=@accountId");

            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("@lotHandlingCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, lotHandlingCode));
            // Update the record in the SQL database.
            sqlCommand.ExecuteNonQuery();
        }
Exemple #14
0
        /// <summary>Archives a Object 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="objectId">The value for the ObjectId 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 objectId)
        {
            // Accessor for the Object Table.
            ServerMarketData.ObjectDataTable objectTable = ServerMarketData.Object;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.ObjectRow objectRow = objectTable.FindByObjectId(objectId);
            if ((objectRow == null))
            {
                throw new Exception(string.Format("The Object table does not have an element identified by {0}", objectId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((objectRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < objectRow.GetAccountBaseRows().Length); index = (index + 1))
            {
                ServerMarketData.AccountBaseRow childAccountBaseRow = objectRow.GetAccountBaseRows()[index];
                AccountBase.ArchiveChildren(adoTransaction, sqlTransaction, childAccountBaseRow.RowVersion, childAccountBaseRow.AccountBaseId);
            }
            for (int index = 0; (index < objectRow.GetBlotterRows().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = objectRow.GetBlotterRows()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < objectRow.GetFolderRows().Length); index = (index + 1))
            {
                ServerMarketData.FolderRow childFolderRow = objectRow.GetFolderRows()[index];
                Folder.ArchiveChildren(adoTransaction, sqlTransaction, childFolderRow.RowVersion, childFolderRow.FolderId);
            }
            for (int index = 0; (index < objectRow.GetIssuerRows().Length); index = (index + 1))
            {
                ServerMarketData.IssuerRow childIssuerRow = objectRow.GetIssuerRows()[index];
                Issuer.ArchiveChildren(adoTransaction, sqlTransaction, childIssuerRow.RowVersion, childIssuerRow.IssuerId);
            }
            for (int index = 0; (index < objectRow.GetObjectTreeRowsByObjectObjectTreeChildId().Length); index = (index + 1))
            {
                ServerMarketData.ObjectTreeRow childObjectTreeRow = objectRow.GetObjectTreeRowsByObjectObjectTreeChildId()[index];
                ObjectTree.Archive(adoTransaction, sqlTransaction, childObjectTreeRow.RowVersion, childObjectTreeRow.ObjectTreeId);
            }
            for (int index = 0; (index < objectRow.GetObjectTreeRowsByObjectObjectTreeParentId().Length); index = (index + 1))
            {
                ServerMarketData.ObjectTreeRow childObjectTreeRow = objectRow.GetObjectTreeRowsByObjectObjectTreeParentId()[index];
                ObjectTree.Archive(adoTransaction, sqlTransaction, childObjectTreeRow.RowVersion, childObjectTreeRow.ObjectTreeId);
            }
            for (int index = 0; (index < objectRow.GetSecurityRows().Length); index = (index + 1))
            {
                ServerMarketData.SecurityRow childSecurityRow = objectRow.GetSecurityRows()[index];
                Security.ArchiveChildren(adoTransaction, sqlTransaction, childSecurityRow.RowVersion, childSecurityRow.SecurityId);
            }
            for (int index = 0; (index < objectRow.GetUserRows().Length); index = (index + 1))
            {
                ServerMarketData.UserRow childUserRow = objectRow.GetUserRows()[index];
                User.ArchiveChildren(adoTransaction, sqlTransaction, childUserRow.RowVersion, childUserRow.UserId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            objectRow[objectTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(objectRow);
            objectRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Object\" set \"IsArchived\" = 1 where \"ObjectId\"=@objectId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@objectId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, objectId));
            sqlCommand.ExecuteNonQuery();
        }
Exemple #15
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 new static void Archive(AdoTransaction adoTransaction)
 {
     // Lock the tables at the base level of the object hierarchy.
     AccountBase.Archive(adoTransaction);
 }
Exemple #16
0
        /// <summary>Updates a AccountGroup 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="description">The value for the Description 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="externalId4">The value for the ExternalId4 column.</param>
        /// <param name="externalId5">The value for the ExternalId5 column.</param>
        /// <param name="externalId6">The value for the ExternalId6 column.</param>
        /// <param name="externalId7">The value for the ExternalId7 column.</param>
        /// <param name="groupPermission">The value for the GroupPermission column.</param>
        /// <param name="hidden">The value for the Hidden column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="owner">The value for the Owner column.</param>
        /// <param name="ownerPermission">The value for the OwnerPermission column.</param>
        /// <param name="readOnly">The value for the ReadOnly column.</param>
        /// <param name="worldPermission">The value for the WorldPermission column.</param>
        /// <param name="address0">The value for the Address0 column.</param>
        /// <param name="address1">The value for the Address1 column.</param>
        /// <param name="address2">The value for the Address2 column.</param>
        /// <param name="city">The value for the City column.</param>
        /// <param name="countryId">The value for the CountryId column.</param>
        /// <param name="currencyId">The value for the CurrencyId column.</param>
        /// <param name="mnemonic">The value for the Mnemonic column.</param>
        /// <param name="postalCode">The value for the PostalCode column.</param>
        /// <param name="provinceId">The value for the ProvinceId column.</param>
        /// <param name="userId">The value for the UserId 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>
        /// <param name="accountGroupId">The value for the AccountGroupId column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        public static void Update(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object description,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object externalId4,
            object externalId5,
            object externalId6,
            object externalId7,
            object groupPermission,
            object hidden,
            object name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            object address0,
            object address1,
            object address2,
            object city,
            object countryId,
            object currencyId,
            object mnemonic,
            object postalCode,
            object provinceId,
            object userId,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7,
            int accountGroupId,
            object typeCode)
        {
            // Accessor for the AccountGroup Table.
            ServerMarketData.AccountGroupDataTable accountGroupTable = ServerMarketData.AccountGroup;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.AccountGroupRow accountGroupRow = accountGroupTable.FindByAccountGroupId(accountGroupId);
            if ((accountGroupRow == null))
            {
                throw new Exception(string.Format("The AccountGroup table does not have an element identified by {0}", accountGroupId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((accountGroupRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            // Insert the base members using the base class.  Note that optimistic concurrency is only used
            // by the top level type in the hierarchy, it is bypassed after you pass the first test.
            long baseRowVersion = accountGroupRow.AccountBaseRow.RowVersion;

            AccountBase.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, accountGroupId, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Update the record in the ADO database.
            accountGroupRow[accountGroupTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(accountGroupRow);
            // Update the record in the SQL database.
        }
Exemple #17
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 Delete(AdoTransaction adoTransaction)
 {
     // These table lock(s) are required for the 'Delete' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.ProvinceLock);
     AccountBase.ArchiveChildren(adoTransaction);
 }
Exemple #18
0
        /// <summary>Inserts a AccountGroup 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="description">The value for the Description 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="externalId4">The value for the ExternalId4 column.</param>
        /// <param name="externalId5">The value for the ExternalId5 column.</param>
        /// <param name="externalId6">The value for the ExternalId6 column.</param>
        /// <param name="externalId7">The value for the ExternalId7 column.</param>
        /// <param name="groupPermission">The value for the GroupPermission column.</param>
        /// <param name="hidden">The value for the Hidden column.</param>
        /// <param name="name">The value for the Name column.</param>
        /// <param name="owner">The value for the Owner column.</param>
        /// <param name="ownerPermission">The value for the OwnerPermission column.</param>
        /// <param name="readOnly">The value for the ReadOnly column.</param>
        /// <param name="worldPermission">The value for the WorldPermission column.</param>
        /// <param name="address0">The value for the Address0 column.</param>
        /// <param name="address1">The value for the Address1 column.</param>
        /// <param name="address2">The value for the Address2 column.</param>
        /// <param name="city">The value for the City column.</param>
        /// <param name="countryId">The value for the CountryId column.</param>
        /// <param name="currencyId">The value for the CurrencyId column.</param>
        /// <param name="mnemonic">The value for the Mnemonic column.</param>
        /// <param name="postalCode">The value for the PostalCode column.</param>
        /// <param name="provinceId">The value for the ProvinceId column.</param>
        /// <param name="userId">The value for the UserId 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>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        public static int Insert(
            AdoTransaction adoTransaction,
            SqlTransaction sqlTransaction,
            ref long rowVersion,
            object description,
            object externalId0,
            object externalId1,
            object externalId2,
            object externalId3,
            object externalId4,
            object externalId5,
            object externalId6,
            object externalId7,
            object groupPermission,
            object hidden,
            string name,
            object owner,
            object ownerPermission,
            object readOnly,
            object worldPermission,
            object address0,
            object address1,
            object address2,
            object city,
            object countryId,
            int currencyId,
            object mnemonic,
            object postalCode,
            object provinceId,
            int userId,
            object userData0,
            object userData1,
            object userData2,
            object userData3,
            object userData4,
            object userData5,
            object userData6,
            object userData7,
            object typeCode)
        {
            // Accessor for the AccountGroup Table.
            ServerMarketData.AccountGroupDataTable accountGroupTable = ServerMarketData.AccountGroup;
            // Apply Defaults
            if ((typeCode == null))
            {
                typeCode = "Account Group";
            }
            // Insert the base members using the base class.
            int accountGroupId = AccountBase.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, address0, address1, address2, city, countryId, currencyId, mnemonic, postalCode, provinceId, typeCode, userId, userData0, userData1, userData2, userData3, userData4, userData5, userData6, userData7);

            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerMarketData.AccountGroupRow accountGroupRow = accountGroupTable.NewAccountGroupRow();
            accountGroupRow[accountGroupTable.RowVersionColumn]     = rowVersion;
            accountGroupRow[accountGroupTable.AccountGroupIdColumn] = accountGroupId;
            accountGroupTable.AddAccountGroupRow(accountGroupRow);
            adoTransaction.DataRows.Add(accountGroupRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand("insert \"AccountGroup\" (\"rowVersion\",AccountGroupId) values (@rowVersion,@accountG" +
                                                   "roupId)");

            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("@accountGroupId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, accountGroupId));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(accountGroupRow.AccountGroupId);
        }
Exemple #19
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();
        }
Exemple #20
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();
        }