Пример #1
0
        /// <summary>Inserts a Blotter 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         advertisementStylesheetId          = parameters["advertisementStylesheetId"].Value;
            int            blotterId                          = parameters["blotterId"];
            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;
            object         partyTypeCode                      = parameters["partyTypeCode"].Value;
            object         sourceOrderDetailStylesheetId      = parameters["sourceOrderDetailStylesheetId"].Value;
            object         sourceOrderStylesheetId            = parameters["sourceOrderStylesheetId"].Value;
            object         typeCode                           = parameters["typeCode"].Value;
            object         workingOrderStylesheetId           = parameters["workingOrderStylesheetId"].Value;

            // Call the internal method to complete the operation.
            Blotter.Update(adoTransaction, sqlTransaction, ref rowVersion, description, externalId0, externalId1, externalId2, externalId3, externalId4, externalId5, externalId6, externalId7, groupPermission, hidden, name, owner, ownerPermission, readOnly, worldPermission, advertisementStylesheetId, blotterId, destinationOrderDetailStylesheetId, destinationOrderStylesheetId, executionDetailStylesheetId, executionStylesheetId, matchStylesheetId, matchHistoryStylesheetId, partyTypeCode, sourceOrderDetailStylesheetId, sourceOrderStylesheetId, typeCode, workingOrderStylesheetId);
            // Return values.
            parameters["rowVersion"] = rowVersion;
        }
Пример #2
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();
        }
Пример #3
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 Update(AdoTransaction adoTransaction)
 {
     // Lock the tables at the base level of the object hierarchy.
     Blotter.Update(adoTransaction);
 }