Beispiel #1
0
 /// <summary>Updates a TimeInForce record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public static void Update(ParameterList parameters)
 {
     // Accessor for the TimeInForce Table.
     ServerDataModel.TimeInForceDataTable timeInForceTable = ServerDataModel.TimeInForce;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     string externalTimeInForceCode = parameters["timeInForceCode"];
     object mnemonic = parameters["mnemonic"].Value;
     object description = parameters["description"].Value;
     // The row versioning is largely disabled for external operations.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     int timeInForceCode = TimeInForce.FindRequiredKey(configurationId, "timeInForceCode", externalTimeInForceCode);
     // This will bypass the internal optimistic concurrency checking by providing the current rowVersion to the 
     // internal method.
     ServerDataModel.TimeInForceRow timeInForceRow = timeInForceTable.FindByTimeInForceCode(timeInForceCode);
     rowVersion = ((long)(timeInForceRow[timeInForceTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Quasar.Core.TimeInForce.Update(adoTransaction, sqlTransaction, ref rowVersion, timeInForceCode, mnemonic, description, null, null, null, null);
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
Beispiel #2
0
 /// <summary>Loads a Order record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public static void Load(ParameterList parameters)
 {
     // Accessor for the Order Table.
     ServerDataModel.OrderDataTable orderTable = ServerDataModel.Order;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object externalOrderId = parameters["orderId"].Value;
     string externalBlockOrderId = parameters["blockOrderId"];
     string externalAccountId = parameters["accountId"];
     string externalSecurityId = parameters["securityId"];
     string externalSettlementId = parameters["settlementId"];
     object brokerId = parameters["brokerId"].Value;
     int positionTypeCode = parameters["positionTypeCode"];
     string externalTransactionTypeCode = parameters["transactionTypeCode"];
     string externalTimeInForceCode = parameters["timeInForceCode"];
     string externalOrderTypeCode = parameters["orderTypeCode"];
     object conditionCode = parameters["conditionCode"].Value;
     object isDeleted = parameters["isDeleted"].Value;
     object isAgency = parameters["isAgency"].Value;
     decimal quantity = parameters["quantity"];
     object price1 = parameters["price1"].Value;
     object price2 = parameters["price2"].Value;
     object note = parameters["note"].Value;
     System.DateTime createdTime = parameters["createdTime"];
     int createdUserId = parameters["createdUserId"];
     System.DateTime modifiedTime = parameters["modifiedTime"];
     int modifiedUserId = parameters["modifiedUserId"];
     // 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 accountId = Account.FindRequiredKey(configurationId, "accountId", externalAccountId);
     int securityId = Security.FindRequiredKey(configurationId, "securityId", externalSecurityId);
     int settlementId = Security.FindRequiredKey(configurationId, "settlementId", externalSettlementId);
     int transactionTypeCode = TransactionType.FindRequiredKey(configurationId, "transactionTypeCode", externalTransactionTypeCode);
     int timeInForceCode = TimeInForce.FindRequiredKey(configurationId, "timeInForceCode", externalTimeInForceCode);
     int orderTypeCode = OrderType.FindRequiredKey(configurationId, "orderTypeCode", externalOrderTypeCode);
     // 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 ((orderId == int.MinValue))
     {
         // 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 = Order.GetExternalKeyIndex(configurationId, "orderId");
         object[] externalIdArray = new object[0];
         externalIdArray[externalKeyIndex] = externalOrderId;
         // Call the internal method to complete the operation.
         MarkThree.Quasar.Core.Order.Insert(adoTransaction, sqlTransaction, ref rowVersion, blockOrderId, accountId, securityId, settlementId, brokerId, positionTypeCode, transactionTypeCode, timeInForceCode, orderTypeCode, conditionCode, isDeleted, isAgency, quantity, price1, price2, note, createdTime, createdUserId, modifiedTime, modifiedUserId);
     }
     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.
         ServerDataModel.OrderRow orderRow = orderTable.FindByOrderId(orderId);
         rowVersion = ((long)(orderRow[orderTable.RowVersionColumn]));
         // Call the internal method to complete the operation.
         MarkThree.Quasar.Core.Order.Update(adoTransaction, sqlTransaction, ref rowVersion, orderId, blockOrderId, accountId, securityId, settlementId, brokerId, positionTypeCode, transactionTypeCode, timeInForceCode, orderTypeCode, conditionCode, isDeleted, isAgency, quantity, price1, price2, note, createdTime, createdUserId, modifiedTime, modifiedUserId);
     }
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }