Exemplo n.º 1
0
 /// <summary>Updates a Blotter record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public new static void Update(ParameterList parameters)
 {
     // Accessor for the Blotter Table.
     ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object description = parameters["description"].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;
     string externalBlotterId = ((string)(parameters["blotterId"]));
     object externalBlockOrderStylesheetId = parameters["blockOrderStylesheetId"].Value;
     object externalPlacementStylesheetId = parameters["placementStylesheetId"].Value;
     object externalExecutionStylesheetId = parameters["executionStylesheetId"].Value;
     object externalTicketStylesheetId = parameters["ticketStylesheetId"].Value;
     object externalAlgorithmId = parameters["algorithmId"].Value;
     object externalTypeCode = parameters["typeCode"].Value;
     object externalBlotterTypeCode = parameters["blotterTypeCode"].Value;
     object defaultBlotter = parameters["defaultBlotter"].Value;
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     int blotterId = Object.FindRequiredKey(configurationId, "blotterId", externalBlotterId);
     object blockOrderStylesheetId = Stylesheet.FindOptionalKey(configurationId, "blockOrderStylesheetId", externalBlockOrderStylesheetId);
     object placementStylesheetId = Stylesheet.FindOptionalKey(configurationId, "placementStylesheetId", externalPlacementStylesheetId);
     object executionStylesheetId = Stylesheet.FindOptionalKey(configurationId, "executionStylesheetId", externalExecutionStylesheetId);
     object ticketStylesheetId = Stylesheet.FindOptionalKey(configurationId, "ticketStylesheetId", externalTicketStylesheetId);
     object algorithmId = Algorithm.FindOptionalKey(configurationId, "algorithmId", externalAlgorithmId);
     object typeCode = Type.FindOptionalKey(configurationId, "typeCode", externalTypeCode);
     object blotterTypeCode = BlotterType.FindOptionalKey(configurationId, "blotterTypeCode", externalBlotterTypeCode);
     // This disables the concurrency checking logic by finding the current row version and passing it to the
     // internal method.
     ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
     rowVersion = ((long)(blotterRow[blotterTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Quasar.Core.Blotter.Update(adoTransaction, sqlTransaction, ref rowVersion, description, null, null, null, null, null, null, null, null, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, blotterId, blockOrderStylesheetId, placementStylesheetId, executionStylesheetId, ticketStylesheetId, algorithmId, typeCode, blotterTypeCode, defaultBlotter);
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
Exemplo n.º 2
0
        /// <summary>Archives a Blotter 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="blotterId">The value for the BlotterId 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 blotterId)
        {
            // Accessor for the Blotter Table.
            ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
            if ((blotterRow == null))
            {
                throw new Exception(string.Format("The Blotter table does not have an element identified by {0}", blotterId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((blotterRow.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 = blotterRow.ObjectRow.RowVersion;

            Object.Archive(adoTransaction, sqlTransaction, baseRowVersion, blotterId);
        }
Exemplo n.º 3
0
 /// <summary>Archives a Blotter record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public new static void Archive(ParameterList parameters)
 {
     // Accessor for the Blotter Table.
     ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     string externalBlotterId = parameters["blotterId"];
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Find the internal identifier using the primary key elements.
     // identifier is used to determine if a record exists with the same key.
     int blotterId = Blotter.FindRequiredKey(configurationId, "blotterId", externalBlotterId);
     // This disables the concurrency checking logic by finding the current row version and passing it to the
     // internal method.
     ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
     rowVersion = ((long)(blotterRow[blotterTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Quasar.Core.Blotter.Archive(adoTransaction, sqlTransaction, rowVersion, blotterId);
 }
Exemplo n.º 4
0
        /// <summary>ArchiveChildrens a Blotter 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="blotterId">The value for the BlotterId 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 blotterId)
        {
            // Accessor for the Blotter Table.
            ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
            // This record can be used to iterate through all the children.
            ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
            // Archive the child records.
            for (int index = 0; (index < blotterRow.GetAccountRows().Length); index = (index + 1))
            {
                ServerDataModel.AccountRow childAccountRow = blotterRow.GetAccountRows()[index];
                Account.ArchiveChildren(adoTransaction, sqlTransaction, childAccountRow.RowVersion, childAccountRow.AccountId);
            }
            for (int index = 0; (index < blotterRow.GetBlotterMapRows().Length); index = (index + 1))
            {
                ServerDataModel.BlotterMapRow childBlotterMapRow = blotterRow.GetBlotterMapRows()[index];
                BlotterMap.Archive(adoTransaction, sqlTransaction, childBlotterMapRow.RowVersion, childBlotterMapRow.BlotterMapId);
            }
            for (int index = 0; (index < blotterRow.GetBlockOrderRows().Length); index = (index + 1))
            {
                ServerDataModel.BlockOrderRow childBlockOrderRow = blotterRow.GetBlockOrderRows()[index];
                BlockOrder.Archive(adoTransaction, sqlTransaction, childBlockOrderRow.RowVersion, childBlockOrderRow.BlockOrderId);
            }
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Delete the record in the ADO database.
            blotterRow[blotterTable.RowVersionColumn] = rowVersion;
            adoTransaction.DataRows.Add(blotterRow);
            blotterRow.Delete();
            // Archive the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand("update \"Blotter\" set \"IsArchived\" = 1 where \"BlotterId\"=@blotterId");

            sqlCommand.Connection  = sqlTransaction.Connection;
            sqlCommand.Transaction = sqlTransaction;
            sqlCommand.Parameters.Add(new SqlParameter("@blotterId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterId));
            sqlCommand.ExecuteNonQuery();
        }
Exemplo n.º 5
0
        /// <summary>Updates a Blotter 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="blotterId">The value for the BlotterId column.</param>
        /// <param name="blockOrderStylesheetId">The value for the BlockOrderStylesheetId column.</param>
        /// <param name="placementStylesheetId">The value for the PlacementStylesheetId column.</param>
        /// <param name="executionStylesheetId">The value for the ExecutionStylesheetId column.</param>
        /// <param name="ticketStylesheetId">The value for the TicketStylesheetId column.</param>
        /// <param name="algorithmId">The value for the AlgorithmId column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        /// <param name="blotterTypeCode">The value for the BlotterTypeCode column.</param>
        /// <param name="defaultBlotter">The value for the DefaultBlotter 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,
            int blotterId,
            object blockOrderStylesheetId,
            object placementStylesheetId,
            object executionStylesheetId,
            object ticketStylesheetId,
            object algorithmId,
            object typeCode,
            object blotterTypeCode,
            object defaultBlotter)
        {
            // Accessor for the Blotter Table.
            ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
            // Rule #1: Make sure the record exists before updating it.
            ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
            if ((blotterRow == null))
            {
                throw new Exception(string.Format("The Blotter table does not have an element identified by {0}", blotterId));
            }
            // Rule #2: Optimistic Concurrency Check
            if ((blotterRow.RowVersion != rowVersion))
            {
                throw new System.Exception("This record is busy.  Please try again later.");
            }
            // Apply Defaults
            if ((blockOrderStylesheetId == null))
            {
                blockOrderStylesheetId = blotterRow[blotterTable.BlockOrderStylesheetIdColumn];
            }
            if ((placementStylesheetId == null))
            {
                placementStylesheetId = blotterRow[blotterTable.PlacementStylesheetIdColumn];
            }
            if ((executionStylesheetId == null))
            {
                executionStylesheetId = blotterRow[blotterTable.ExecutionStylesheetIdColumn];
            }
            if ((ticketStylesheetId == null))
            {
                ticketStylesheetId = blotterRow[blotterTable.TicketStylesheetIdColumn];
            }
            if ((algorithmId == null))
            {
                algorithmId = blotterRow[blotterTable.AlgorithmIdColumn];
            }
            if ((blotterTypeCode == null))
            {
                blotterTypeCode = blotterRow[blotterTable.BlotterTypeCodeColumn];
            }
            if ((defaultBlotter == null))
            {
                defaultBlotter = blotterRow[blotterTable.DefaultBlotterColumn];
            }
            // 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 = blotterRow.ObjectRow.RowVersion;

            Object.Update(adoTransaction, sqlTransaction, ref baseRowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, blotterId, owner, ownerPermission, readOnly, typeCode, worldPermission);
            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Update the record in the ADO database.
            blotterRow[blotterTable.RowVersionColumn]             = rowVersion;
            blotterRow[blotterTable.BlockOrderStylesheetIdColumn] = blockOrderStylesheetId;
            blotterRow[blotterTable.PlacementStylesheetIdColumn]  = placementStylesheetId;
            blotterRow[blotterTable.ExecutionStylesheetIdColumn]  = executionStylesheetId;
            blotterRow[blotterTable.TicketStylesheetIdColumn]     = ticketStylesheetId;
            blotterRow[blotterTable.AlgorithmIdColumn]            = algorithmId;
            blotterRow[blotterTable.BlotterTypeCodeColumn]        = blotterTypeCode;
            blotterRow[blotterTable.DefaultBlotterColumn]         = defaultBlotter;
            adoTransaction.DataRows.Add(blotterRow);
            // Update the record in the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"update ""Blotter"" set ""RowVersion""=@rowVersion,""BlockOrderStylesheetId""=@blockOrderStylesheetId,""PlacementStylesheetId""=@placementStylesheetId,""ExecutionStylesheetId""=@executionStylesheetId,""TicketStylesheetId""=@ticketStylesheetId,""AlgorithmId""=@algorithmId,""BlotterTypeCode""=@blotterTypeCode,""DefaultBlotter""=@defaultBlotter where ""BlotterId""=@blotterId");

            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("@blotterId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterId));
            sqlCommand.Parameters.Add(new SqlParameter("@blockOrderStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@placementStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, placementStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@executionStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, executionStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@ticketStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, ticketStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@algorithmId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, algorithmId));
            sqlCommand.Parameters.Add(new SqlParameter("@blotterTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterTypeCode));
            sqlCommand.Parameters.Add(new SqlParameter("@defaultBlotter", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, defaultBlotter));
            // Update the record in the SQL database.
            sqlCommand.ExecuteNonQuery();
        }
Exemplo n.º 6
0
        /// <summary>Inserts a Blotter 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="blockOrderStylesheetId">The value for the BlockOrderStylesheetId column.</param>
        /// <param name="placementStylesheetId">The value for the PlacementStylesheetId column.</param>
        /// <param name="executionStylesheetId">The value for the ExecutionStylesheetId column.</param>
        /// <param name="ticketStylesheetId">The value for the TicketStylesheetId column.</param>
        /// <param name="algorithmId">The value for the AlgorithmId column.</param>
        /// <param name="typeCode">The value for the TypeCode column.</param>
        /// <param name="blotterTypeCode">The value for the BlotterTypeCode column.</param>
        /// <param name="defaultBlotter">The value for the DefaultBlotter 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 blockOrderStylesheetId,
            object placementStylesheetId,
            object executionStylesheetId,
            object ticketStylesheetId,
            object algorithmId,
            object typeCode,
            int blotterTypeCode,
            object defaultBlotter)
        {
            // Accessor for the Blotter Table.
            ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
            // Apply Defaults
            if ((blockOrderStylesheetId == null))
            {
                blockOrderStylesheetId = System.DBNull.Value;
            }
            if ((placementStylesheetId == null))
            {
                placementStylesheetId = System.DBNull.Value;
            }
            if ((executionStylesheetId == null))
            {
                executionStylesheetId = System.DBNull.Value;
            }
            if ((ticketStylesheetId == null))
            {
                ticketStylesheetId = System.DBNull.Value;
            }
            if ((algorithmId == null))
            {
                algorithmId = System.DBNull.Value;
            }
            if ((typeCode == null))
            {
                typeCode = "Blotter";
            }
            if ((defaultBlotter == null))
            {
                defaultBlotter = false;
            }
            // Insert the base members using the base class.
            int blotterId = Object.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, typeCode, worldPermission);

            // Increment the row version
            rowVersion = ServerDataModel.RowVersion.Increment();
            // Insert the record into the ADO database.
            ServerDataModel.BlotterRow blotterRow = blotterTable.NewBlotterRow();
            blotterRow[blotterTable.RowVersionColumn]             = rowVersion;
            blotterRow[blotterTable.BlotterIdColumn]              = blotterId;
            blotterRow[blotterTable.BlockOrderStylesheetIdColumn] = blockOrderStylesheetId;
            blotterRow[blotterTable.PlacementStylesheetIdColumn]  = placementStylesheetId;
            blotterRow[blotterTable.ExecutionStylesheetIdColumn]  = executionStylesheetId;
            blotterRow[blotterTable.TicketStylesheetIdColumn]     = ticketStylesheetId;
            blotterRow[blotterTable.AlgorithmIdColumn]            = algorithmId;
            blotterRow[blotterTable.BlotterTypeCodeColumn]        = blotterTypeCode;
            blotterRow[blotterTable.DefaultBlotterColumn]         = defaultBlotter;
            blotterTable.AddBlotterRow(blotterRow);
            adoTransaction.DataRows.Add(blotterRow);
            // Insert the record into the SQL database.
            SqlCommand sqlCommand = new SqlCommand(@"insert ""Blotter"" (""rowVersion"",BlotterId,BlockOrderStylesheetId,PlacementStylesheetId,ExecutionStylesheetId,TicketStylesheetId,AlgorithmId,BlotterTypeCode,DefaultBlotter) values (@rowVersion,@blotterId,@blockOrderStylesheetId,@placementStylesheetId,@executionStylesheetId,@ticketStylesheetId,@algorithmId,@blotterTypeCode,@defaultBlotter)");

            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("@blotterId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterId));
            sqlCommand.Parameters.Add(new SqlParameter("@blockOrderStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blockOrderStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@placementStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, placementStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@executionStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, executionStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@ticketStylesheetId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, ticketStylesheetId));
            sqlCommand.Parameters.Add(new SqlParameter("@algorithmId", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, algorithmId));
            sqlCommand.Parameters.Add(new SqlParameter("@blotterTypeCode", SqlDbType.Int, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, blotterTypeCode));
            sqlCommand.Parameters.Add(new SqlParameter("@defaultBlotter", SqlDbType.Bit, 0, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, defaultBlotter));
            sqlCommand.ExecuteNonQuery();
            // Return Statements
            return(blotterRow.BlotterId);
        }
Exemplo n.º 7
0
 /// <summary>Loads a Blotter record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public new static void Load(ParameterList parameters)
 {
     // Accessor for the Blotter Table.
     ServerDataModel.BlotterDataTable blotterTable = ServerDataModel.Blotter;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object description = parameters["description"].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;
     string externalBlotterId = parameters["blotterId"];
     object externalBlockOrderStylesheetId = parameters["blockOrderStylesheetId"].Value;
     object externalPlacementStylesheetId = parameters["placementStylesheetId"].Value;
     object externalExecutionStylesheetId = parameters["executionStylesheetId"].Value;
     object externalTicketStylesheetId = parameters["ticketStylesheetId"].Value;
     object externalAlgorithmId = parameters["algorithmId"].Value;
     object externalTypeCode = parameters["typeCode"].Value;
     string externalBlotterTypeCode = parameters["blotterTypeCode"];
     object defaultBlotter = parameters["defaultBlotter"].Value;
     // The row versioning is largely disabled for external operations.  The value is returned to the caller in the
     // event it's needed for operations within the batch.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     int blotterId = Object.FindKey(configurationId, "blotterId", externalBlotterId);
     object blockOrderStylesheetId = Stylesheet.FindOptionalKey(configurationId, "blockOrderStylesheetId", externalBlockOrderStylesheetId);
     object placementStylesheetId = Stylesheet.FindOptionalKey(configurationId, "placementStylesheetId", externalPlacementStylesheetId);
     object executionStylesheetId = Stylesheet.FindOptionalKey(configurationId, "executionStylesheetId", externalExecutionStylesheetId);
     object ticketStylesheetId = Stylesheet.FindOptionalKey(configurationId, "ticketStylesheetId", externalTicketStylesheetId);
     object algorithmId = Algorithm.FindOptionalKey(configurationId, "algorithmId", externalAlgorithmId);
     object typeCode = Type.FindOptionalKey(configurationId, "typeCode", externalTypeCode);
     int blotterTypeCode = BlotterType.FindRequiredKey(configurationId, "blotterTypeCode", externalBlotterTypeCode);
     ServerDataModel.BlotterRow blotterRow = blotterTable.FindByBlotterId(blotterId);
     // The load operation will create a record if it doesn't exist, or update an existing record.  The external
     // identifier is used to determine if a record exists with the same key.
     if ((blotterRow == null))
     {
         // Populate the 'externalId' varaibles so that the external identifier can be used to find the row when an
         // external method is called with the same 'configurationId' parameter.
         int externalKeyIndex = Blotter.GetExternalKeyIndex(configurationId, "blotterId");
         object[] externalIdArray = new object[8];
         externalIdArray[externalKeyIndex] = externalBlotterId;
         object externalId0 = externalIdArray[0];
         object externalId1 = externalIdArray[1];
         object externalId2 = externalIdArray[2];
         object externalId3 = externalIdArray[3];
         object externalId4 = externalIdArray[4];
         object externalId5 = externalIdArray[5];
         object externalId6 = externalIdArray[6];
         object externalId7 = externalIdArray[7];
         // Call the internal method to complete the operation.
         MarkThree.Quasar.Core.Blotter.Insert(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, blockOrderStylesheetId, placementStylesheetId, executionStylesheetId, ticketStylesheetId, algorithmId, typeCode, blotterTypeCode, defaultBlotter);
     }
     else
     {
         // While the optimistic concurrency checking is disabled for the external methods, the internal methods
         // still need to perform the check.  This ncurrency checking logic by finding the current row version to be
         // will bypass the coused when the internal method is called.
         rowVersion = ((long)(blotterRow[blotterTable.RowVersionColumn]));
         // Call the internal method to complete the operation.
         MarkThree.Quasar.Core.Blotter.Update(adoTransaction, sqlTransaction, ref rowVersion, description, null, null, null, null, null, null, null, null, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, blotterId, blockOrderStylesheetId, placementStylesheetId, executionStylesheetId, ticketStylesheetId, algorithmId, typeCode, blotterTypeCode, defaultBlotter);
     }
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }