Beispiel #1
0
 /// <summary>Initializes the static elements of an Object.</summary>
 static WorkingOrder()
 {
     // The table must be locked before the indices can be read into an accelerator array.
     ServerMarketData.WorkingOrderLock.AcquireReaderLock(System.Threading.Timeout.Infinite);
     // Accessor for the WorkingOrder Table.
     ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;
     // This does an indirect lookup operation using the views created for the ExternalId columns.  Take the index of the user
     // identifier column calcualted above and use it to find a record containing the external identifier.
     WorkingOrder.externalKeyArray = new DataView[] {
             workingOrderTable.KeyWorkingOrderExternalId0};
     // The table must be released after the array is constructed.
     ServerMarketData.WorkingOrderLock.ReleaseReaderLock();
 }
Beispiel #2
0
 /// <summary>Finds a a WorkingOrder record using a configuration and an external identifier.</summary>
 /// <param name="configurationId">Specified which mappings (user id columns) to use when looking up external identifiers.</param>
 /// <param name="parameterId">The name of the parameter as specified in the configuration table.</param>
 /// <param name="externalId">The external (user supplied) identifier for the record.</param>
 public static int FindKey(object configurationId, string parameterId, object externalId)
 {
     // A missing key will never match a column.
     if ((externalId == null))
     {
         return int.MinValue;
     }
     // Accessor for the WorkingOrder Table.
     ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;
     // Look for the record using the external identifier.  The configuration selected the key to use, which effectively
     // selected the external id column to use for the search.  If a record is found in the view, a translation still needs
     // to be made back to the original table before an index to the record can be returned to the caller.
     int externalKeyIndex = WorkingOrder.GetExternalKeyIndex(configurationId, parameterId);
     System.Data.DataView externalKeyView = WorkingOrder.externalKeyArray[externalKeyIndex];
     int recordIndex = externalKeyView.Find(new object[] {
                 externalId});
     if ((recordIndex == -1))
     {
         return int.MinValue;
     }
     return ((int)(externalKeyView[recordIndex].Row[workingOrderTable.WorkingOrderIdColumn]));
 }
Beispiel #3
0
 /// <summary>Archives a WorkingOrder record using Metadata Parameters.</summary>
 /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
 public static void Archive(ParameterList parameters)
 {
     // Accessor for the WorkingOrder Table.
     ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     string externalWorkingOrderId = parameters["workingOrderId"];
     // The row versioning is largely disabled for external operations.
     long rowVersion = long.MinValue;
     // Find the internal identifier using the primar key elements.
     // identifier is used to determine if a record exists with the same key.
     int workingOrderId = WorkingOrder.FindRequiredKey(configurationId, "workingOrderId", externalWorkingOrderId);
     // 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.
     ServerMarketData.WorkingOrderRow workingOrderRow = workingOrderTable.FindByWorkingOrderId(workingOrderId);
     rowVersion = ((long)(workingOrderRow[workingOrderTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Guardian.Core.WorkingOrder.Archive(adoTransaction, sqlTransaction, rowVersion, workingOrderId);
 }
Beispiel #4
0
        /// <summary>Inserts a SourceOrder record using Metadata Parameters.</summary>
        /// <param name="transaction">Commits or rejects a set of commands as a unit.</param>
        /// <param name="remoteMethod">Contains the metadata parameters and exceptions for this command.</param>
        public static void InsertFile(ParameterList parameters)
        {
            // Accessor for the WorkingOrder Table.
            ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;

            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction             = parameters["adoTransaction"];
            SqlTransaction sqlTransaction             = parameters["sqlTransaction"];
            object         configurationId            = parameters["configurationId"].Value;
            string         externalBlotterId          = parameters["blotterId"];
            object         externalDestinationId      = parameters["destinationId"].Value;
            string         externalWorkingOrderId     = parameters["workingOrderId"];
            string         externalOrderTypeCode      = parameters["orderTypeCode"];
            string         externalPriceTypeCode      = parameters["priceTypeCode"];
            string         externalSecurityId         = parameters["securityId"];
            object         externalSettlementId       = parameters["settlementId"].Value;
            object         externalSubmissionTypeCode = parameters["submissionTypeCode"].Value;
            object         submittedQuantity          = parameters["submittedQuantity"].Value;
            object         submittedTime           = parameters["submittedTime"].Value;
            string         externalTimeInForceCode = parameters["timeInForceCode"];
            object         uploadedTime            = parameters["uploadedTime"].Value;
            object         externalId0             = parameters["externalId0"].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          = External.Blotter.FindRequiredKey(configurationId, "blotterId", externalBlotterId);
            int    workingOrderId     = External.WorkingOrder.FindKey(configurationId, "workingOrderId", externalWorkingOrderId);
            object destinationId      = External.Destination.FindOptionalKey(configurationId, "destinationId", externalDestinationId);
            int    orderTypeCode      = External.OrderType.FindRequiredKey(configurationId, "orderTypeCode", externalOrderTypeCode);
            int    priceTypeCode      = External.PriceType.FindRequiredKey(configurationId, "priceTypeCode", externalPriceTypeCode);
            int    securityId         = External.Security.FindRequiredKey(configurationId, "securityId", externalSecurityId);
            object submissionTypeCode = External.SubmissionType.FindOptionalKey(configurationId, "submissionTypeCode", externalSubmissionTypeCode);
            object settlementId       = External.Security.FindOptionalKey(configurationId, "settlementId", externalSettlementId);
            int    timeInForceCode    = External.TimeInForce.FindRequiredKey(configurationId, "timeInForceCode", externalTimeInForceCode);

            // Convert the parameters into binary values.
            object isAgencyMatch = parameters["isAgencyMatch"] is MissingParameter ? (object)null :
                                   Convert.ToBoolean(parameters["isAgencyMatch"].Value);
            object isBrokerMatch = parameters["isBrokerMatch"] is MissingParameter ? (object)null :
                                   Convert.ToBoolean(parameters["isBrokerMatch"].Value);
            object isHedgeMatch = parameters["isHedgeMatch"] is MissingParameter ? (object)null :
                                  Convert.ToBoolean(parameters["isHedgeMatch"].Value);
            object isHeld = parameters["isHeld"] is MissingParameter ? (object)null :
                            Convert.ToBoolean(parameters["isHeld"].Value);
            object isInstitutionMatch = parameters["isInstitutionMatch"] is MissingParameter ? (object)null :
                                        Convert.ToBoolean(parameters["isInstitutionMatch"].Value);
            object limitPrice = parameters["limitPrice"] is MissingParameter ? (object)null :
                                Convert.ToDecimal(parameters["limitPrice"].Value);
            object maximumVolatility = parameters["maximumVolatility"] is MissingParameter ? (object)null :
                                       Convert.ToDecimal(parameters["maximumVolatility"].Value);
            object startTime = parameters["startTime"] is MissingParameter ? (object)null :
                               Convert.ToDateTime(parameters["startTime"].Value);
            object stopPrice = parameters["stopPrice"] is MissingParameter ? (object)null :
                               Convert.ToDecimal(parameters["stopPrice"].Value);
            object stopTime = parameters["stopTime"] is MissingParameter ? (object)null :
                              Convert.ToDateTime(parameters["stopTime"].Value);
            object newsFreeTime = parameters["newsFreeTime"] is MissingParameter ? (object)null :
                                  Convert.ToInt32(parameters["newsFreeTime"].Value);

            // Defaults
            int      createdUserId  = ServerMarketData.UserId;
            DateTime createdTime    = DateTime.Now;
            int      modifiedUserId = ServerMarketData.UserId;
            DateTime modifiedTime   = createdTime;
            DateTime timeReceived   = createdTime;
            int      statusCode     = Status.New;

            // Provide a default for the submission type code.
            if (submissionTypeCode == null)
            {
                submissionTypeCode = SubmissionType.NeverMatch;
            }

            // The Trader table contains additional defaults for incoming orders.
            int traderId = ServerMarketData.UserId;

            ServerMarketData.TraderRow traderRow = ServerMarketData.Trader.FindByTraderId(traderId);
            if (isAgencyMatch == null)
            {
                isAgencyMatch = traderRow.IsAgencyMatch;
            }
            if (isBrokerMatch == null)
            {
                isBrokerMatch = traderRow.IsBrokerMatch;
            }
            if (isHedgeMatch == null)
            {
                isHedgeMatch = traderRow.IsHedgeMatch;
            }
            if (isInstitutionMatch == null)
            {
                isInstitutionMatch = traderRow.IsInstitutionMatch;
            }
            if (maximumVolatility == null && !traderRow.IsMaximumVolatilityDefaultNull())
            {
                maximumVolatility = traderRow.MaximumVolatilityDefault;
            }
            if (startTime == null && !traderRow.IsStartTimeDefaultNull())
            {
                startTime = traderRow.StartTimeDefault;
            }
            if (stopTime == null && !traderRow.IsStopTimeDefaultNull())
            {
                stopTime = traderRow.StopTimeDefault;
            }
            if (newsFreeTime == null && !traderRow.IsNewsFreeTimeDefaultNull())
            {
                newsFreeTime = traderRow.NewsFreeTimeDefault;
            }

            // 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 ((workingOrderId == 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 = External.WorkingOrder.GetExternalKeyIndex(configurationId, "workingOrderId");
                object[] externalIdArray  = new object[1];
                externalIdArray[externalKeyIndex] = externalWorkingOrderId;
                externalId0 = externalIdArray[0];

                // Create a timer for this working order for sleeping while in the matching box.
                long timerRowVersion = long.MinValue;
                int  timerId         = Core.Timer.Insert(adoTransaction, sqlTransaction, ref timerRowVersion, DateTime.MinValue, null, false, DateTime.MinValue, 0);

                // Call the internal method to complete the operation.
                MarkThree.Guardian.Core.WorkingOrder.Insert(adoTransaction, sqlTransaction, ref rowVersion, null, blotterId, createdTime,
                                                            createdUserId, destinationId, externalId0, isAgencyMatch, null, null, isBrokerMatch, isHedgeMatch, isInstitutionMatch, limitPrice,
                                                            maximumVolatility, modifiedTime, modifiedUserId, newsFreeTime, orderTypeCode, priceTypeCode, securityId,
                                                            settlementId, startTime, statusCode, stopPrice, stopTime, (int)submissionTypeCode, submittedQuantity,
                                                            submittedTime, timeInForceCode, timerId, uploadedTime);
            }
            else
            {
                throw new Exception(string.Format("There is already a working order with the identifier {0}", externalWorkingOrderId));
            }

            // Return values.
            parameters["rowVersion"] = rowVersion;
        }
Beispiel #5
0
        /// <summary>Updates a WorkingOrder record using Metadata Parameters.</summary>
        /// <param name="transaction">Contains the parameters and exceptions for this command.</param>
        public static void UpdateFile(ParameterList parameters)
        {
            // Accessor for the WorkingOrder Table.
            ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;

            // Extract the parameters from the command batch.
            AdoTransaction adoTransaction             = parameters["adoTransaction"];
            SqlTransaction sqlTransaction             = parameters["sqlTransaction"];
            object         configurationId            = parameters["configurationId"].Value;
            object         externalBlotterId          = parameters["blotterId"].Value;
            string         externalWorkingOrderId     = ((string)(parameters["workingOrderId"]));
            object         externalDestinationId      = parameters["destinationId"].Value;
            object         externalOrderTypeCode      = parameters["orderTypeCode"].Value;
            object         externalPriceTypeCode      = parameters["priceTypeCode"].Value;
            object         externalSecurityId         = parameters["securityId"].Value;
            object         externalSubmissionTypeCode = parameters["submissionTypeCode"].Value;
            object         externalSettlementId       = parameters["settlementId"].Value;
            object         submittedQuantity          = parameters["submittedQuantity"].Value;
            object         submittedTime           = parameters["submittedTime"].Value;
            object         externalTimeInForceCode = parameters["timeInForceCode"].Value;
            object         uploadedTime            = parameters["uploadedTime"].Value;

            // The row versioning is largely disabled for external operations.
            long rowVersion = long.MinValue;

            // Resolve External Identifiers
            object blotterId          = External.Blotter.FindOptionalKey(configurationId, "blotterId", externalBlotterId);
            object destinationId      = External.Destination.FindOptionalKey(configurationId, "destinationId", externalDestinationId);
            object orderTypeCode      = External.OrderType.FindOptionalKey(configurationId, "orderTypeCode", externalOrderTypeCode);
            object priceTypeCode      = External.PriceType.FindOptionalKey(configurationId, "priceTypeCode", externalPriceTypeCode);
            object securityId         = External.Security.FindOptionalKey(configurationId, "securityId", externalSecurityId);
            object settlementId       = External.Security.FindOptionalKey(configurationId, "settlementId", externalSettlementId);
            object timeInForceCode    = External.TimeInForce.FindOptionalKey(configurationId, "timeInForceCode", externalTimeInForceCode);
            object submissionTypeCode = External.SubmissionType.FindOptionalKey(configurationId, "submissionTypeCode", externalSubmissionTypeCode);
            int    workingOrderId     = External.WorkingOrder.FindRequiredKey(configurationId, "workingOrderId", externalWorkingOrderId);

            // Convert the parameters into binary values.
            object isAgencyMatch = parameters["isAgencyMatch"] is MissingParameter ? (object)null :
                                   Convert.ToBoolean(parameters["isAgencyMatch"].Value);
            object isBrokerMatch = parameters["isBrokerMatch"] is MissingParameter ? (object)null :
                                   Convert.ToBoolean(parameters["isBrokerMatch"].Value);
            object isHedgeMatch = parameters["isHedgeMatch"] is MissingParameter ? (object)null :
                                  Convert.ToBoolean(parameters["isHedgeMatch"].Value);
            object isInstitutionMatch = parameters["isInstitutionMatch"] is MissingParameter ? (object)null :
                                        Convert.ToBoolean(parameters["isInstitutionMatch"].Value);
            object limitPrice = parameters["limitPrice"] is MissingParameter ? (object)null :
                                Convert.ToDecimal(parameters["limitPrice"].Value);
            object maximumVolatility = parameters["maximumVolatility"] is MissingParameter ? (object)null :
                                       Convert.ToDecimal(parameters["maximumVolatility"].Value);
            object startTime = parameters["startTime"] is MissingParameter ? (object)null :
                               Convert.ToDateTime(parameters["startTime"].Value);
            object stopPrice = parameters["stopPrice"] is MissingParameter ? (object)null :
                               Convert.ToDecimal(parameters["stopPrice"].Value);
            object stopTime = parameters["stopTime"] is MissingParameter ? (object)null :
                              Convert.ToDateTime(parameters["stopTime"].Value);
            object newsFreeTime = parameters["newsFreeTime"] is MissingParameter ? (object)null :
                                  Convert.ToInt32(parameters["newsFreeTime"].Value);

            // Defaults
            int      statusCode     = Status.New;
            int      modifiedUserId = ServerMarketData.UserId;
            DateTime modifiedTime   = DateTime.Now;
            DateTime timeReceived   = modifiedTime;

            // Provide a default for the submission type code.
            if (submissionTypeCode == null)
            {
                submissionTypeCode = SubmissionType.NeverMatch;
            }

            // 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.
            ServerMarketData.WorkingOrderRow workingOrderRow = workingOrderTable.FindByWorkingOrderId(workingOrderId);
            rowVersion = ((long)(workingOrderRow[workingOrderTable.RowVersionColumn]));

            // Call the internal method to complete the operation.
            MarkThree.Guardian.Core.WorkingOrder.Update(adoTransaction, sqlTransaction, ref rowVersion, null, blotterId, null, null, destinationId,
                                                        null, isAgencyMatch, null, null, isBrokerMatch, isHedgeMatch, isInstitutionMatch, limitPrice, maximumVolatility, newsFreeTime, modifiedUserId,
                                                        modifiedTime, orderTypeCode, priceTypeCode, securityId, settlementId, startTime, statusCode, stopPrice, stopTime, null,
                                                        submittedQuantity, submittedTime, timeInForceCode, null, uploadedTime, workingOrderId);

            // Return values.
            parameters["rowVersion"] = rowVersion;
        }
Beispiel #6
0
 /// <summary>Updates a WorkingOrder 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 WorkingOrder Table.
     ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object automaticQuantity = parameters["automaticQuantity"].Value;
     object externalBlotterId = parameters["blotterId"].Value;
     object createdTime = parameters["createdTime"].Value;
     object externalCreatedUserId = parameters["createdUserId"].Value;
     object externalDestinationId = parameters["destinationId"].Value;
     object isAgencyMatch = parameters["isAgencyMatch"].Value;
     object isAutomatic = parameters["isAutomatic"].Value;
     object isAwake = parameters["isAwake"].Value;
     object isBrokerMatch = parameters["isBrokerMatch"].Value;
     object isHedgeMatch = parameters["isHedgeMatch"].Value;
     object isInstitutionMatch = parameters["isInstitutionMatch"].Value;
     object limitPrice = parameters["limitPrice"].Value;
     object maximumVolatility = parameters["maximumVolatility"].Value;
     object modifiedTime = parameters["modifiedTime"].Value;
     object externalModifiedUserId = parameters["modifiedUserId"].Value;
     object newsFreeTime = parameters["newsFreeTime"].Value;
     object externalOrderTypeCode = parameters["orderTypeCode"].Value;
     object externalPriceTypeCode = parameters["priceTypeCode"].Value;
     object externalSecurityId = parameters["securityId"].Value;
     object externalSettlementId = parameters["settlementId"].Value;
     object startTime = parameters["startTime"].Value;
     object externalStatusCode = parameters["statusCode"].Value;
     object stopPrice = parameters["stopPrice"].Value;
     object stopTime = parameters["stopTime"].Value;
     object externalSubmissionTypeCode = parameters["submissionTypeCode"].Value;
     object submittedQuantity = parameters["submittedQuantity"].Value;
     object submittedTime = parameters["submittedTime"].Value;
     object externalTimeInForceCode = parameters["timeInForceCode"].Value;
     object externalTimerId = parameters["timerId"].Value;
     object uploadedTime = parameters["uploadedTime"].Value;
     string externalWorkingOrderId = ((string)(parameters["workingOrderId"]));
     // The row versioning is largely disabled for external operations.
     long rowVersion = long.MinValue;
     // Resolve External Identifiers
     object blotterId = Blotter.FindOptionalKey(configurationId, "blotterId", externalBlotterId);
     object createdUserId = User.FindOptionalKey(configurationId, "createdUserId", externalCreatedUserId);
     object destinationId = Destination.FindOptionalKey(configurationId, "destinationId", externalDestinationId);
     object modifiedUserId = User.FindOptionalKey(configurationId, "modifiedUserId", externalModifiedUserId);
     object orderTypeCode = OrderType.FindOptionalKey(configurationId, "orderTypeCode", externalOrderTypeCode);
     object priceTypeCode = PriceType.FindOptionalKey(configurationId, "priceTypeCode", externalPriceTypeCode);
     object securityId = Security.FindOptionalKey(configurationId, "securityId", externalSecurityId);
     object settlementId = Security.FindOptionalKey(configurationId, "settlementId", externalSettlementId);
     object statusCode = Status.FindOptionalKey(configurationId, "statusCode", externalStatusCode);
     object submissionTypeCode = SubmissionType.FindOptionalKey(configurationId, "submissionTypeCode", externalSubmissionTypeCode);
     object timeInForceCode = TimeInForce.FindOptionalKey(configurationId, "timeInForceCode", externalTimeInForceCode);
     object timerId = Timer.FindOptionalKey(configurationId, "timerId", externalTimerId);
     int workingOrderId = WorkingOrder.FindRequiredKey(configurationId, "workingOrderId", externalWorkingOrderId);
     // 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.
     ServerMarketData.WorkingOrderRow workingOrderRow = workingOrderTable.FindByWorkingOrderId(workingOrderId);
     rowVersion = ((long)(workingOrderRow[workingOrderTable.RowVersionColumn]));
     // Call the internal method to complete the operation.
     MarkThree.Guardian.Core.WorkingOrder.Update(adoTransaction, sqlTransaction, ref rowVersion, automaticQuantity, blotterId, createdTime, createdUserId, destinationId, null, isAgencyMatch, isAutomatic, isAwake, isBrokerMatch, isHedgeMatch, isInstitutionMatch, limitPrice, maximumVolatility, modifiedTime, modifiedUserId, newsFreeTime, orderTypeCode, priceTypeCode, securityId, settlementId, startTime, statusCode, stopPrice, stopTime, submissionTypeCode, submittedQuantity, submittedTime, timeInForceCode, timerId, uploadedTime, workingOrderId);
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }
Beispiel #7
0
 /// <summary>Loads a WorkingOrder 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 WorkingOrder Table.
     ServerMarketData.WorkingOrderDataTable workingOrderTable = ServerMarketData.WorkingOrder;
     // Extract the parameters from the command batch.
     AdoTransaction adoTransaction = parameters["adoTransaction"];
     SqlTransaction sqlTransaction = parameters["sqlTransaction"];
     object configurationId = parameters["configurationId"].Value;
     object automaticQuantity = parameters["automaticQuantity"].Value;
     string externalBlotterId = parameters["blotterId"];
     System.DateTime createdTime = parameters["createdTime"];
     string externalCreatedUserId = parameters["createdUserId"];
     object externalDestinationId = parameters["destinationId"].Value;
     object externalId0 = parameters["externalId0"].Value;
     object isAgencyMatch = parameters["isAgencyMatch"].Value;
     object isAutomatic = parameters["isAutomatic"].Value;
     object isAwake = parameters["isAwake"].Value;
     object isBrokerMatch = parameters["isBrokerMatch"].Value;
     object isHedgeMatch = parameters["isHedgeMatch"].Value;
     object isInstitutionMatch = parameters["isInstitutionMatch"].Value;
     object limitPrice = parameters["limitPrice"].Value;
     object maximumVolatility = parameters["maximumVolatility"].Value;
     System.DateTime modifiedTime = parameters["modifiedTime"];
     string externalModifiedUserId = parameters["modifiedUserId"];
     object newsFreeTime = parameters["newsFreeTime"].Value;
     string externalOrderTypeCode = parameters["orderTypeCode"];
     string externalPriceTypeCode = parameters["priceTypeCode"];
     string externalSecurityId = parameters["securityId"];
     object externalSettlementId = parameters["settlementId"].Value;
     object startTime = parameters["startTime"].Value;
     string externalStatusCode = parameters["statusCode"];
     object stopPrice = parameters["stopPrice"].Value;
     object stopTime = parameters["stopTime"].Value;
     string externalSubmissionTypeCode = parameters["submissionTypeCode"];
     object submittedQuantity = parameters["submittedQuantity"].Value;
     object submittedTime = parameters["submittedTime"].Value;
     string externalTimeInForceCode = parameters["timeInForceCode"];
     object externalTimerId = parameters["timerId"].Value;
     object uploadedTime = parameters["uploadedTime"].Value;
     object externalWorkingOrderId = parameters["workingOrderId"].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 = Blotter.FindRequiredKey(configurationId, "blotterId", externalBlotterId);
     int createdUserId = User.FindRequiredKey(configurationId, "createdUserId", externalCreatedUserId);
     object destinationId = Destination.FindOptionalKey(configurationId, "destinationId", externalDestinationId);
     int modifiedUserId = User.FindRequiredKey(configurationId, "modifiedUserId", externalModifiedUserId);
     int orderTypeCode = OrderType.FindRequiredKey(configurationId, "orderTypeCode", externalOrderTypeCode);
     int priceTypeCode = PriceType.FindRequiredKey(configurationId, "priceTypeCode", externalPriceTypeCode);
     int securityId = Security.FindRequiredKey(configurationId, "securityId", externalSecurityId);
     object settlementId = Security.FindOptionalKey(configurationId, "settlementId", externalSettlementId);
     int statusCode = Status.FindRequiredKey(configurationId, "statusCode", externalStatusCode);
     int submissionTypeCode = SubmissionType.FindRequiredKey(configurationId, "submissionTypeCode", externalSubmissionTypeCode);
     int timeInForceCode = TimeInForce.FindRequiredKey(configurationId, "timeInForceCode", externalTimeInForceCode);
     object timerId = Timer.FindOptionalKey(configurationId, "timerId", externalTimerId);
     int workingOrderId = WorkingOrder.FindKey(configurationId, "workingOrderId", externalWorkingOrderId);
     // 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 ((workingOrderId == 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 = WorkingOrder.GetExternalKeyIndex(configurationId, "workingOrderId");
         object[] externalIdArray = new object[1];
         externalIdArray[externalKeyIndex] = externalWorkingOrderId;
         externalId0 = externalIdArray[0];
         // Call the internal method to complete the operation.
         MarkThree.Guardian.Core.WorkingOrder.Insert(adoTransaction, sqlTransaction, ref rowVersion, automaticQuantity, blotterId, createdTime, createdUserId, destinationId, externalId0, isAgencyMatch, isAutomatic, isAwake, isBrokerMatch, isHedgeMatch, isInstitutionMatch, limitPrice, maximumVolatility, modifiedTime, modifiedUserId, newsFreeTime, orderTypeCode, priceTypeCode, securityId, settlementId, startTime, statusCode, stopPrice, stopTime, submissionTypeCode, submittedQuantity, submittedTime, timeInForceCode, timerId, uploadedTime);
     }
     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.
         ServerMarketData.WorkingOrderRow workingOrderRow = workingOrderTable.FindByWorkingOrderId(workingOrderId);
         rowVersion = ((long)(workingOrderRow[workingOrderTable.RowVersionColumn]));
         // Call the internal method to complete the operation.
         MarkThree.Guardian.Core.WorkingOrder.Update(adoTransaction, sqlTransaction, ref rowVersion, automaticQuantity, blotterId, createdTime, createdUserId, destinationId, externalId0, isAgencyMatch, isAutomatic, isAwake, isBrokerMatch, isHedgeMatch, isInstitutionMatch, limitPrice, maximumVolatility, modifiedTime, modifiedUserId, newsFreeTime, orderTypeCode, priceTypeCode, securityId, settlementId, startTime, statusCode, stopPrice, stopTime, submissionTypeCode, submittedQuantity, submittedTime, timeInForceCode, timerId, uploadedTime, workingOrderId);
     }
     // Return values.
     parameters["rowVersion"] = rowVersion;
 }