/// <summary>Inserts a ComplianceOfficer 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 preferences = parameters["preferences"].Value; object systemFolderId = parameters["systemFolderId"].Value; string userName = parameters["userName"]; object typeCode = parameters["typeCode"].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 complianceOfficerId = ComplianceOfficer.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, preferences, systemFolderId, userName, typeCode); // Return values. parameters["rowVersion"] = rowVersion; parameters.Return = complianceOfficerId; }
/// <summary>Inserts a ComplianceOfficer record using Metadata Parameters.</summary> /// <param name="parameters">Contains the metadata parameters.</param> public new static void Update(ParameterList parameters) { // Extract the parameters from the command batch. AdoTransaction adoTransaction = parameters["adoTransaction"]; SqlTransaction sqlTransaction = parameters["sqlTransaction"]; long rowVersion = parameters["rowVersion"]; 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; object name = parameters["name"].Value; object owner = parameters["owner"].Value; object ownerPermission = parameters["ownerPermission"].Value; object readOnly = parameters["readOnly"].Value; object worldPermission = parameters["worldPermission"].Value; object preferences = parameters["preferences"].Value; object systemFolderId = parameters["systemFolderId"].Value; object userName = parameters["userName"].Value; int complianceOfficerId = parameters["complianceOfficerId"]; object typeCode = parameters["typeCode"].Value; // Call the internal method to complete the operation. ComplianceOfficer.Update(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, preferences, systemFolderId, userName, complianceOfficerId, typeCode); // Return values. parameters["rowVersion"] = rowVersion; }
/// <summary>Inserts a ComplianceOfficer 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 complianceOfficerId = parameters["complianceOfficerId"]; // Call the internal method to complete the operation. ComplianceOfficer.Archive(adoTransaction, sqlTransaction, rowVersion, complianceOfficerId); }
/// <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); }
/// <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(); }