private void ParseCommon(AddTransactionCommandBase command) { var dataRowTran = command.DataRowTran; var constructParams = command.ConstructParams; constructParams.OperationType = Framework.OperationType.None; constructParams.Id = (Guid)dataRowTran["TransactionID"]; var accountId = (Guid)dataRowTran["AccountID"]; Debug.Assert(command.Account != null); constructParams.InstrumentId = (Guid)dataRowTran["InstrumentID"]; constructParams.Code = (string)dataRowTran["TransactionCode"]; constructParams.Type = (TransactionType)(byte)dataRowTran["TransactionType"]; constructParams.SubType = (TransactionSubType)(byte)dataRowTran["TransactionSubType"]; constructParams.Phase = (TransactionPhase)(byte)dataRowTran["Phase"]; constructParams.OrderType = (OrderType)(int)dataRowTran["OrderTypeID"]; constructParams.ConstractSize = (decimal)dataRowTran["ContractSize"]; constructParams.BeginTime = (DateTime)dataRowTran["BeginTime"]; constructParams.EndTime = (DateTime)dataRowTran["EndTime"]; constructParams.ExpireType = (ExpireType)(int)dataRowTran["ExpireType"]; constructParams.SubmitTime = (DateTime)dataRowTran["SubmitTime"]; if (dataRowTran["ExecuteTime"] != DBNull.Value) { constructParams.ExecuteTime = (DateTime)dataRowTran["ExecuteTime"]; } constructParams.SubmitorId = (Guid)dataRowTran["SubmitorID"]; if (dataRowTran["ApproverID"] != DBNull.Value) { constructParams.ApproveId = (Guid)dataRowTran["ApproverID"]; } constructParams.SourceOrderId = dataRowTran.GetColumn <Guid?>("AssigningOrderID"); }
private void ParseTransactionCommon(AddTransactionCommandBase command) { this.ParseCommon(command); var tran = command.CreateTransaction(); command.Result = tran; }
private void ParseTransaction(AddTransactionCommandBase command) { this.ParseCommon(command); var tran = command.CreateTransaction(); command.Result = tran; this.CreateOrders(command); if (tran.SubType == TransactionSubType.IfDone) { IfDoneTransactionParser.Default.FillDoneTrans(tran, command.TransactionData); } else if (tran.SubType == TransactionSubType.Amend && this.IsChangeToIfDone(command.TransactionData)) { IfDoneTransactionParser.Default.FillDoneTrans(tran, command.TransactionData); tran.SubType = TransactionSubType.IfDone; } TransactionCodeGenerater.Default.FillTranAndOrderCode(tran); }
private void CreateOrders(AddTransactionCommandBase command) { var tranData = command.TransactionData; if (tranData.Orders == null || tranData.Orders.Count == 0) { return; } var tran = command.Result; foreach (var eachOrder in tranData.Orders) { var addOrderCommand = command.AddOrderCommandFactory.CreateByCommunication(tran, new AddCommunicationOrderParameter(eachOrder, tranData.TradeDay)); addOrderCommand.Execute(); } if (command.PlaceByRiskMonitor) { this.SetOrderWhenPlaceByRiskMonitor(tran); } }
private void ParseCommon(AddTransactionCommandBase command) { TransactionConstructParams constructParams = command.ConstructParams; constructParams.OperationType = Framework.OperationType.AsNewRecord; var transactionData = command.TransactionData; constructParams.Id = transactionData.Id; constructParams.Code = transactionData.Code; constructParams.InstrumentId = transactionData.InstrumentId; constructParams.Type = transactionData.Type; constructParams.SubType = transactionData.SubType; constructParams.Phase = TransactionPhase.Placing; constructParams.OrderType = transactionData.OrderType; constructParams.FreePlacingPreCheck = transactionData.FreePlacingPreCheck; constructParams.FreeLmtVariationCheck = transactionData.FreeLmtVariationCheck; constructParams.BeginTime = transactionData.BeginTime; constructParams.EndTime = transactionData.EndTime; constructParams.ExpireType = transactionData.ExpireType; constructParams.SubmitorId = transactionData.SubmitorId; constructParams.SubmitTime = transactionData.SubmitTime; constructParams.SourceOrderId = transactionData.SourceOrderId; }