public override void button1_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(textBox1.Text) && !String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox5.Text) && comboBox3.SelectedIndex > -1) { MsgOCR msgOCR = new MsgOCR { Name = textBox5.Text, Account = Properties.Settings.Default.Account, ClOrdID = textBox1.Text, OrderID = textBox2.Text, Symbol = comboBox3.SelectedItem.ToString(), TransactTime = DateTime.Now }; DataContainer.Data[listBoxSelectedIndexNo] = msgOCR; this.Close(); } else { MessageBox.Show(@"Required fields not specified", @"Warning", MessageBoxButtons.OK); } }
private void SendSelectedRequest() { switch (DataContainer.Data[_listBoxSelectedIndexNo].MsgType) { case "U1000": MsgAIR requestData = (MsgAIR)DataContainer.Data[_listBoxSelectedIndexNo]; AccountInfoRequest request = new AccountInfoRequest(); request.Set(new Account(Properties.Settings.Default.Account)); request.Set(new AccReqID(requestData.AccReqID)); //testforJack //request.Set(new SubscriptionRequestType('1')); if (!initiator.IsStopped) { bool ret = Session.SendToTarget(request, conn.m_sessionID); } else { MessageBox.Show(@"Connection is not established!!", @"Warning", MessageBoxButtons.OK); } break; case "D": MsgNOSR requestData1 = (MsgNOSR)DataContainer.Data[_listBoxSelectedIndexNo]; NewOrderSingle request1 = new NewOrderSingle(); request1.Set(new Account(Properties.Settings.Default.Account)); request1.Set(new ClOrdID(requestData1.ClOrdID)); request1.Set(new OrderQty(decimal.Parse(requestData1.OrderQty))); request1.Set(new OrdType(char.Parse(requestData1.OrdType))); request1.Set(new Side(char.Parse(requestData1.Side))); request1.Set(new Symbol(requestData1.Symbol)); request1.Set(new TransactTime(DateTime.Now)); if (!initiator.IsStopped) { bool ret = Session.SendToTarget(request1, conn.m_sessionID); } else { MessageBox.Show(@"Connection is not established!!", @"Warning", MessageBoxButtons.OK); } break; case "H": MsgOSR requestData2 = (MsgOSR)DataContainer.Data[_listBoxSelectedIndexNo]; OrderStatusRequest request2 = new OrderStatusRequest(); request2.Set(new Account(Properties.Settings.Default.Account)); request2.Set(new ClOrdID(requestData2.ClOrdID)); request2.Set(new Side(char.Parse(requestData2.Side))); request2.Set(new Symbol(requestData2.Symbol)); request2.Set(new OrderID(requestData2.OrderID)); if (!initiator.IsStopped) { bool ret = Session.SendToTarget(request2, conn.m_sessionID); } else { MessageBox.Show(@"Connection is not established!!", @"Warning", MessageBoxButtons.OK); } break; case "AF2": MsgBOIR requestData3 = (MsgBOIR)DataContainer.Data[_listBoxSelectedIndexNo]; OrderMassStatusRequest request3 = new OrderMassStatusRequest(); request3.Set(new Account(Properties.Settings.Default.Account)); request3.Set(new Symbol(requestData3.Symbol)); request3.Set(new MassStatusReqID(requestData3.MassStatusReqID)); //request3.Set(new NoStatuses(int.Parse(requestData3.GroupNums))); if (!initiator.IsStopped) { bool ret = Session.SendToTarget(request3, conn.m_sessionID); } else { MessageBox.Show(@"Connection is not established!!", @"Warning", MessageBoxButtons.OK); } break; case "G": MsgOCRR requestData4 = (MsgOCRR)DataContainer.Data[_listBoxSelectedIndexNo]; OrderCancelReplaceRequest request4 = new OrderCancelReplaceRequest(); request4.Set(new Account(Properties.Settings.Default.Account)); request4.Set(new ClOrdID(requestData4.ClOrdID)); request4.Set(new OrderQty(decimal.Parse(requestData4.OrderQty))); request4.Set(new OrderID(requestData4.OrderID)); if (!initiator.IsStopped) { bool ret = Session.SendToTarget(request4, conn.m_sessionID); } else { MessageBox.Show(@"Connection is not established!!", @"Warning", MessageBoxButtons.OK); } break; case "F": MsgOCR requestData5 = (MsgOCR)DataContainer.Data[_listBoxSelectedIndexNo]; OrderCancelRequest request5 = new OrderCancelRequest(); request5.Set(new Account(Properties.Settings.Default.Account)); request5.Set(new ClOrdID(requestData5.ClOrdID)); request5.Set(new OrderID(requestData5.OrderID)); request5.Set(new Symbol(requestData5.Symbol)); request5.Set(new TransactTime(DateTime.Now)); if (!initiator.IsStopped) { bool ret = Session.SendToTarget(request5, conn.m_sessionID); } else { MessageBox.Show(@"Connection is not established!!", @"Warning", MessageBoxButtons.OK); } break; default: break; } }