示例#1
0
        /// <summary>Archives a PartyType 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="partyTypeCode">The value for the PartyTypeCode 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 partyTypeCode)
        {
            // Accessor for the PartyType Table.
            ServerMarketData.PartyTypeDataTable partyTypeTable = ServerMarketData.PartyType;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.PartyTypeRow partyTypeRow = partyTypeTable.FindByPartyTypeCode(partyTypeCode);
            if ((partyTypeRow == null))
            {
                throw new Exception(string.Format("The PartyType table does not have an element identified by {0}", partyTypeCode));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((partyTypeRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < partyTypeRow.GetBlotterRows().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = partyTypeRow.GetBlotterRows()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            partyTypeRow[partyTypeTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(partyTypeRow);
            partyTypeRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"PartyType\" set \"IsArchived\" = 1 where \"PartyTypeCode\"=@partyTypeCode");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@partyTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, partyTypeCode));
            sqlCommand.ExecuteNonQuery();
        }
示例#2
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.
     Blotter.Insert(adoTransaction);
     // These table lock(s) are required for the 'Insert' operation.
     adoTransaction.LockRequests.AddWriterLock(ServerMarketData.BranchLock);
 }
示例#3
0
        /// <summary>Inserts a Blotter 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            blotterId      = parameters["blotterId"];

            // Call the internal method to complete the operation.
            Blotter.Archive(adoTransaction, sqlTransaction, rowVersion, blotterId);
        }
示例#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>
 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);
 }
示例#5
0
        /// <summary>Inserts a Blotter 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         advertisementStylesheetId          = parameters["advertisementStylesheetId"].Value;
            object         destinationOrderDetailStylesheetId = parameters["destinationOrderDetailStylesheetId"].Value;
            object         destinationOrderStylesheetId       = parameters["destinationOrderStylesheetId"].Value;
            object         executionDetailStylesheetId        = parameters["executionDetailStylesheetId"].Value;
            object         executionStylesheetId              = parameters["executionStylesheetId"].Value;
            object         matchStylesheetId                  = parameters["matchStylesheetId"].Value;
            object         matchHistoryStylesheetId           = parameters["matchHistoryStylesheetId"].Value;
            int            partyTypeCode                      = parameters["partyTypeCode"];
            object         sourceOrderDetailStylesheetId      = parameters["sourceOrderDetailStylesheetId"].Value;
            object         sourceOrderStylesheetId            = parameters["sourceOrderStylesheetId"].Value;
            object         typeCode                           = parameters["typeCode"].Value;
            object         workingOrderStylesheetId           = parameters["workingOrderStylesheetId"].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 blotterId = Blotter.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, advertisementStylesheetId, destinationOrderDetailStylesheetId, destinationOrderStylesheetId, executionDetailStylesheetId, executionStylesheetId, matchStylesheetId, matchHistoryStylesheetId, partyTypeCode, sourceOrderDetailStylesheetId, sourceOrderStylesheetId, typeCode, workingOrderStylesheetId);

            // Return values.
            parameters["rowVersion"] = rowVersion;
            parameters.Return        = blotterId;
        }
示例#6
0
        /// <summary>Archives a Branch 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="branchId">The value for the BranchId 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 branchId)
        {
            // Accessor for the Branch Table.
            ServerMarketData.BranchDataTable branchTable = ServerMarketData.Branch;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.BranchRow branchRow = branchTable.FindByBranchId(branchId);
            if ((branchRow == null))
            {
                throw new Exception(string.Format("The Branch table does not have an element identified by {0}", branchId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((branchRow.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 = branchRow.BlotterRow.RowVersion;

            Blotter.Archive(adoTransaction, sqlTransaction, baseRowVersion, branchId);
        }
示例#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.PartyTypeLock);
     Blotter.ArchiveChildren(adoTransaction);
 }
示例#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>
 public new static void Archive(AdoTransaction adoTransaction)
 {
     // Lock the tables at the base level of the object hierarchy.
     Blotter.Archive(adoTransaction);
 }
示例#9
0
        /// <summary>Updates a Branch 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="advertisementStylesheetId">The value for the AdvertisementStylesheetId column.</param>
        /// <param name="destinationOrderDetailStylesheetId">The value for the DestinationOrderDetailStylesheetId column.</param>
        /// <param name="destinationOrderStylesheetId">The value for the DestinationOrderStylesheetId column.</param>
        /// <param name="executionDetailStylesheetId">The value for the ExecutionDetailStylesheetId column.</param>
        /// <param name="executionStylesheetId">The value for the ExecutionStylesheetId column.</param>
        /// <param name="matchStylesheetId">The value for the MatchStylesheetId column.</param>
        /// <param name="matchHistoryStylesheetId">The value for the MatchHistoryStylesheetId column.</param>
        /// <param name="partyTypeCode">The value for the PartyTypeCode column.</param>
        /// <param name="sourceOrderDetailStylesheetId">The value for the SourceOrderDetailStylesheetId column.</param>
        /// <param name="sourceOrderStylesheetId">The value for the SourceOrderStylesheetId column.</param>
        /// <param name="workingOrderStylesheetId">The value for the WorkingOrderStylesheetId column.</param>
        /// <param name="branchId">The value for the BranchId column.</param>
        /// <param name="shortName">The value for the ShortName 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 advertisementStylesheetId,
            object destinationOrderDetailStylesheetId,
            object destinationOrderStylesheetId,
            object executionDetailStylesheetId,
            object executionStylesheetId,
            object matchStylesheetId,
            object matchHistoryStylesheetId,
            object partyTypeCode,
            object sourceOrderDetailStylesheetId,
            object sourceOrderStylesheetId,
            object workingOrderStylesheetId,
            int branchId,
            object shortName,
            object typeCode)
        {
            // Accessor for the Branch Table.
            ServerMarketData.BranchDataTable branchTable = ServerMarketData.Branch;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.BranchRow branchRow = branchTable.FindByBranchId(branchId);
            if ((branchRow == null))
            {
                throw new Exception(string.Format("The Branch table does not have an element identified by {0}", branchId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((branchRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((shortName == null))
            {
                shortName = branchRow[branchTable.ShortNameColumn];
            }
            // 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 = branchRow.BlotterRow.RowVersion;

            Blotter.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, advertisementStylesheetId, branchId, destinationOrderDetailStylesheetId, destinationOrderStylesheetId, executionDetailStylesheetId, executionStylesheetId, matchStylesheetId, matchHistoryStylesheetId, partyTypeCode, sourceOrderDetailStylesheetId, sourceOrderStylesheetId, typeCode, workingOrderStylesheetId);
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Update the record in the ADO database.
            branchRow[branchTable.RowVersionColumn] = rowVersion;
            branchRow[branchTable.ShortNameColumn]  = shortName;
            adoTransaction.DataRows.Add(branchRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Branch\" set \"RowVersion\"=@rowVersion,\"ShortName\"=@shortName where \"Branch" +
                                                   "Id\"=@branchId");

            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("@branchId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, branchId));
            sqlCommand.Parameters.Add(new SqlParameter("@shortName", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, shortName));
            // Update the record in the SQL database.
            sqlCommand.ExecuteNonQuery();
        }
示例#10
0
        /// <summary>Inserts a Branch 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="advertisementStylesheetId">The value for the AdvertisementStylesheetId column.</param>
        /// <param name="destinationOrderDetailStylesheetId">The value for the DestinationOrderDetailStylesheetId column.</param>
        /// <param name="destinationOrderStylesheetId">The value for the DestinationOrderStylesheetId column.</param>
        /// <param name="executionDetailStylesheetId">The value for the ExecutionDetailStylesheetId column.</param>
        /// <param name="executionStylesheetId">The value for the ExecutionStylesheetId column.</param>
        /// <param name="matchStylesheetId">The value for the MatchStylesheetId column.</param>
        /// <param name="matchHistoryStylesheetId">The value for the MatchHistoryStylesheetId column.</param>
        /// <param name="partyTypeCode">The value for the PartyTypeCode column.</param>
        /// <param name="sourceOrderDetailStylesheetId">The value for the SourceOrderDetailStylesheetId column.</param>
        /// <param name="sourceOrderStylesheetId">The value for the SourceOrderStylesheetId column.</param>
        /// <param name="workingOrderStylesheetId">The value for the WorkingOrderStylesheetId column.</param>
        /// <param name="shortName">The value for the ShortName 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 advertisementStylesheetId,
            object destinationOrderDetailStylesheetId,
            object destinationOrderStylesheetId,
            object executionDetailStylesheetId,
            object executionStylesheetId,
            object matchStylesheetId,
            object matchHistoryStylesheetId,
            int partyTypeCode,
            object sourceOrderDetailStylesheetId,
            object sourceOrderStylesheetId,
            object workingOrderStylesheetId,
            string shortName,
            object typeCode)
        {
            // Accessor for the Branch Table.
            ServerMarketData.BranchDataTable branchTable = ServerMarketData.Branch;
            // Apply Defaults
            if ((typeCode == null))
            {
                typeCode = "Branch";
            }
            // Insert the base members using the base class.
            int branchId = Blotter.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, advertisementStylesheetId, destinationOrderDetailStylesheetId, destinationOrderStylesheetId, executionDetailStylesheetId, executionStylesheetId, matchStylesheetId, matchHistoryStylesheetId, partyTypeCode, sourceOrderDetailStylesheetId, sourceOrderStylesheetId, typeCode, workingOrderStylesheetId);

            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerMarketData.BranchRow branchRow = branchTable.NewBranchRow();
            branchRow[branchTable.RowVersionColumn] = rowVersion;
            branchRow[branchTable.BranchIdColumn]   = branchId;
            branchRow[branchTable.ShortNameColumn]  = shortName;
            branchTable.AddBranchRow(branchRow);
            adoTransaction.DataRows.Add(branchRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand("insert \"Branch\" (\"rowVersion\",BranchId,ShortName) values (@rowVersion,@branchId,@" +
                                                   "shortName)");

            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("@branchId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, branchId));
            sqlCommand.Parameters.Add(new SqlParameter("@shortName", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, shortName));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(branchRow.BranchId);
        }
示例#11
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();
        }
示例#12
0
        /// <summary>Archives a Stylesheet 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="stylesheetId">The value for the StylesheetId 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 stylesheetId)
        {
            // Accessor for the Stylesheet Table.
            ServerMarketData.StylesheetDataTable stylesheetTable = ServerMarketData.Stylesheet;
            // Rule #1: Make sure the record exists before updating it.
            ServerMarketData.StylesheetRow stylesheetRow = stylesheetTable.FindByStylesheetId(stylesheetId);
            if ((stylesheetRow == null))
            {
                throw new Exception(string.Format("The Stylesheet table does not have an element identified by {0}", stylesheetId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((stylesheetRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Archive the child records.
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterAdvertisementStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterAdvertisementStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterDestinationOrderDetailStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterDestinationOrderDetailStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterDestinationOrderStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterDestinationOrderStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterExecutionDetailStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterExecutionDetailStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterExecutionStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterExecutionStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterMatchStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterMatchStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterMatchHistoryStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterMatchHistoryStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterSourceOrderDetailStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterSourceOrderDetailStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterSourceOrderStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterSourceOrderStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            for (int index = 0; (index < stylesheetRow.GetBlotterRowsByStylesheetBlotterWorkingOrderStylesheetId().Length); index = (index + 1))
            {
                ServerMarketData.BlotterRow childBlotterRow = stylesheetRow.GetBlotterRowsByStylesheetBlotterWorkingOrderStylesheetId()[index];
                Blotter.ArchiveChildren(adoTransaction, sqlTransaction, childBlotterRow.RowVersion, childBlotterRow.BlotterId);
            }
            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Delete the record in the ADO database.
            stylesheetRow[stylesheetTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(stylesheetRow);
            stylesheetRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Stylesheet\" set \"IsArchived\" = 1 where \"StylesheetId\"=@stylesheetId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@stylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, stylesheetId));
            sqlCommand.ExecuteNonQuery();
        }
示例#13
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.StylesheetLock);
     Blotter.ArchiveChildren(adoTransaction);
 }
示例#14
0
        /// <summary>Inserts a Source 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="advertisementStylesheetId">The value for the AdvertisementStylesheetId column.</param>
        /// <param name="destinationOrderDetailStylesheetId">The value for the DestinationOrderDetailStylesheetId column.</param>
        /// <param name="destinationOrderStylesheetId">The value for the DestinationOrderStylesheetId column.</param>
        /// <param name="executionDetailStylesheetId">The value for the ExecutionDetailStylesheetId column.</param>
        /// <param name="executionStylesheetId">The value for the ExecutionStylesheetId column.</param>
        /// <param name="matchStylesheetId">The value for the MatchStylesheetId column.</param>
        /// <param name="matchHistoryStylesheetId">The value for the MatchHistoryStylesheetId column.</param>
        /// <param name="partyTypeCode">The value for the PartyTypeCode column.</param>
        /// <param name="sourceOrderDetailStylesheetId">The value for the SourceOrderDetailStylesheetId column.</param>
        /// <param name="sourceOrderStylesheetId">The value for the SourceOrderStylesheetId column.</param>
        /// <param name="workingOrderStylesheetId">The value for the WorkingOrderStylesheetId column.</param>
        /// <param name="buyMarketValueThreshold">The value for the BuyMarketValueThreshold column.</param>
        /// <param name="buyQuantityThreshold">The value for the BuyQuantityThreshold column.</param>
        /// <param name="sellMarketValueThreshold">The value for the SellMarketValueThreshold column.</param>
        /// <param name="sellQuantityThreshold">The value for the SellQuantityThreshold column.</param>
        /// <param name="shortName">The value for the ShortName 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 advertisementStylesheetId,
            object destinationOrderDetailStylesheetId,
            object destinationOrderStylesheetId,
            object executionDetailStylesheetId,
            object executionStylesheetId,
            object matchStylesheetId,
            object matchHistoryStylesheetId,
            int partyTypeCode,
            object sourceOrderDetailStylesheetId,
            object sourceOrderStylesheetId,
            object workingOrderStylesheetId,
            object buyMarketValueThreshold,
            object buyQuantityThreshold,
            object sellMarketValueThreshold,
            object sellQuantityThreshold,
            string shortName,
            object typeCode)
        {
            // Accessor for the Source Table.
            ServerMarketData.SourceDataTable sourceTable = ServerMarketData.Source;
            // Apply Defaults
            if ((buyMarketValueThreshold == null))
            {
                buyMarketValueThreshold = System.DBNull.Value;
            }
            if ((buyQuantityThreshold == null))
            {
                buyQuantityThreshold = System.DBNull.Value;
            }
            if ((sellMarketValueThreshold == null))
            {
                sellMarketValueThreshold = System.DBNull.Value;
            }
            if ((sellQuantityThreshold == null))
            {
                sellQuantityThreshold = System.DBNull.Value;
            }
            if ((typeCode == null))
            {
                typeCode = "Source";
            }
            // Insert the base members using the base class.
            int sourceId = Blotter.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, advertisementStylesheetId, destinationOrderDetailStylesheetId, destinationOrderStylesheetId, executionDetailStylesheetId, executionStylesheetId, matchStylesheetId, matchHistoryStylesheetId, partyTypeCode, sourceOrderDetailStylesheetId, sourceOrderStylesheetId, typeCode, workingOrderStylesheetId);

            // Increment the row version
            rowVersion = ServerMarketData.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerMarketData.SourceRow sourceRow = sourceTable.NewSourceRow();
            sourceRow[sourceTable.RowVersionColumn] = rowVersion;
            sourceRow[sourceTable.BuyMarketValueThresholdColumn]  = buyMarketValueThreshold;
            sourceRow[sourceTable.BuyQuantityThresholdColumn]     = buyQuantityThreshold;
            sourceRow[sourceTable.SellMarketValueThresholdColumn] = sellMarketValueThreshold;
            sourceRow[sourceTable.SellQuantityThresholdColumn]    = sellQuantityThreshold;
            sourceRow[sourceTable.ShortNameColumn] = shortName;
            sourceRow[sourceTable.SourceIdColumn]  = sourceId;
            sourceTable.AddSourceRow(sourceRow);
            adoTransaction.DataRows.Add(sourceRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"insert ""Source"" (""rowVersion"",BuyMarketValueThreshold,BuyQuantityThreshold,SellMarketValueThreshold,SellQuantityThreshold,ShortName,SourceId) values (@rowVersion,@buyMarketValueThreshold,@buyQuantityThreshold,@sellMarketValueThreshold,@sellQuantityThreshold,@shortName,@sourceId)");

            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("@buyMarketValueThreshold", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, buyMarketValueThreshold));
            sqlCommand.Parameters.Add(new SqlParameter("@buyQuantityThreshold", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, buyQuantityThreshold));
            sqlCommand.Parameters.Add(new SqlParameter("@sellMarketValueThreshold", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sellMarketValueThreshold));
            sqlCommand.Parameters.Add(new SqlParameter("@sellQuantityThreshold", SqlDbType.Decimal, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sellQuantityThreshold));
            sqlCommand.Parameters.Add(new SqlParameter("@shortName", SqlDbType.NVarChar, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, shortName));
            sqlCommand.Parameters.Add(new SqlParameter("@sourceId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, sourceId));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(sourceRow.SourceId);
        }