Example #1
0
        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;
            }
        }
Example #2
0
        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;
            }
        }
Example #3
0
        private void FireBeforeCellEdit(object source, GTLEmbeddedControlEventArgs args)
        {
            args.Cancel = true;
            GTLTreeNode node = args.TreeNode;
            GTLSubItem  sub  = node.SubItems[args.Column];

            if (node.SubItems[args.Column].Text != null &&
                node.SubItems[args.Column].Text != "")
            {
                args.Cancel = false;
            }
        }
Example #4
0
        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();
            }
        }
Example #5
0
 public BlueColorSubItem(Color final, GTLSubItem item, object tag)
 {
     this.item   = item;
     this.tag    = tag;
     this.colors = new Color [] { O1, O2, O3, O4, O5, O6, O7, final };
 }
Example #6
0
 public RedColorSubItem(Color final, GTLSubItem item, object tag)
 {
     this.item   = item;
     this.tag    = tag;
     this.colors = new Color [] { R1, R2, R3, R4, R5, R6, R7, final };
 }
Example #7
0
 public GreenColorSubItem(Color final, GTLSubItem item, object tag)
 {
     this.item   = item;
     this.tag    = tag;
     this.colors = new Color [] { G1, G2, G3, G4, G5, G6, G7, final };
 }