private void FireExecutionAdded(object o, DealingEventArgs e) { Execution execution = (Execution)e.Data; GTLTreeNode executionNode = CreateExecutionNode(execution); data.BeginUpdate(); data.BeginNodeListChange(); if (null != executionNode) { data.Nodes.Add(executionNode); } SortData(data.Columns[DatabaseObject.EXECUTION_ID]); data.EndNodeListChange(); data.EndUpdate(); for (int i = 0; i < executionNode.SubItems.Count; i++) { GTLSubItem sub = executionNode.SubItems[i]; ColorSubItem csi = new BlueColorSubItem( Color.White, executionNode.SubItems[i], executionNode.Tag + data.Columns[i].Text); colorNodes[csi.Tag] = csi; } }
private void FireReleaseAdded(object o, DealingEventArgs e) { Release release = (Release)e.Data; GTLTreeNode releaseNode = CreateReleaseNode(release); data.BeginUpdate(); data.BeginNodeListChange(); if (null != releaseNode) { data.Nodes.Add(releaseNode); } SortData(data.Columns[DatabaseObject.RELEASE_ID]); data.EndNodeListChange(); data.EndUpdate(); for (int i = 0; i < releaseNode.SubItems.Count; i++) { GTLSubItem sub = releaseNode.SubItems[i]; ColorSubItem csi = new BlueColorSubItem( Color.White, releaseNode.SubItems[i], releaseNode.Tag + data.Columns[i].Text); colorNodes[csi.Tag] = csi; } }
private void FireAfterCellEdit(object source, GTLEmbeddedControlEventArgs args) { args.Cancel = true; ColorSubItem csi = null; GTLTreeNode node = args.TreeNode; GTLColumn col = data.Columns[args.Column]; GTLSubItem sub = node.SubItems[args.Column]; if (col.Name.Equals(DatabaseObject.MAX_OPEN_LONG_QTY) || col.Name.Equals(DatabaseObject.MAX_OPEN_SHORT_QTY) || col.Name.Equals(DatabaseObject.MAX_RELEASE_QTY)) { TextBox tb = (TextBox)args.Control; // // Ensure that the text box value is an integer greater // than or equal to zero. // try { int qty = Int32.Parse(tb.Text); if (qty < 0) { MessageBox.Show( " Invalid Quantity: " + tb.Text, "UPDATE Account Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); data.ClearSelection(); csi = new RedColorSubItem(Color.White, node.SubItems[args.Column], node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; return; } } catch (Exception) { MessageBox.Show( " Invalid Quantity: " + tb.Text, "UPDATE Account Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); data.ClearSelection(); csi = new RedColorSubItem(Color.White, node.SubItems[args.Column], node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; return; } // // Update the account limit // string account_id, symbol, security_exchange, fix_session_id, max_open_long_qty, max_open_short_qty, max_release_qty; account_id = node.SubItems[DatabaseObject.ACCOUNT_ID].Text; symbol = node.SubItems[DatabaseObject.SYMBOL].Text; security_exchange = node.SubItems[DatabaseObject.SECURITY_EXCHANGE].Text; fix_session_id = node.SubItems[DatabaseObject.SESSION_ID].Text; if (col.Name.Equals(DatabaseObject.MAX_OPEN_LONG_QTY)) { max_open_long_qty = tb.Text; max_open_short_qty = node.SubItems[DatabaseObject.MAX_OPEN_SHORT_QTY].Text; max_release_qty = node.SubItems[DatabaseObject.MAX_RELEASE_QTY].Text; } else if (col.Name.Equals(DatabaseObject.MAX_OPEN_SHORT_QTY)) { max_open_long_qty = node.SubItems[DatabaseObject.MAX_OPEN_LONG_QTY].Text; max_open_short_qty = tb.Text; max_release_qty = node.SubItems[DatabaseObject.MAX_RELEASE_QTY].Text; } else { max_open_long_qty = node.SubItems[DatabaseObject.MAX_OPEN_LONG_QTY].Text; max_open_short_qty = node.SubItems[DatabaseObject.MAX_OPEN_SHORT_QTY].Text; max_release_qty = tb.Text; } ClientAdapterResponse response = controller.SendRpc(new UpdateAccountLimit( account_id, symbol, security_exchange, fix_session_id, max_open_long_qty, max_open_short_qty, max_release_qty, "1")); response = controller.SendRpc(new ReloadStaticData( )); csi = new BlueColorSubItem(Color.White, sub, node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; args.Cancel = false; data.ClearSelection(); } if (col.Name.Equals(DatabaseObject.SESSION_ID)) { TextBox tb = (TextBox)args.Control; if ("".Equals(tb.Text)) { MessageBox.Show( " Invalid FIX Session ID", "UPDATE Account Limit Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); data.ClearSelection(); csi = new RedColorSubItem(Color.White, node.SubItems[args.Column], node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; return; } // // Update the account limit // ClientAdapterResponse response = controller.SendRpc(new UpdateAccountLimit( node.SubItems[DatabaseObject.ACCOUNT_ID].Text, node.SubItems[DatabaseObject.SYMBOL].Text, node.SubItems[DatabaseObject.SECURITY_EXCHANGE].Text, tb.Text, node.SubItems[DatabaseObject.MAX_OPEN_LONG_QTY].Text, node.SubItems[DatabaseObject.MAX_OPEN_SHORT_QTY].Text, node.SubItems[DatabaseObject.MAX_RELEASE_QTY].Text, "1")); response = controller.SendRpc(new ReloadStaticData( )); csi = new BlueColorSubItem(Color.White, sub, node.Tag + data.Columns[args.Column].Text); colorNodes[csi.Tag] = csi; args.Cancel = false; data.ClearSelection(); } }