Exemplo n.º 1
0
        /// <summary>
        /// Adding data to Allocated ultra grid
        /// </summary>
        private void AllocatedGrid()
        {
            try
            {
                //if (PerformOperation.StoreOrder.Rows.Count != 0)
                //{
                //    List<Orders> GridData = new List<Orders>();
                //    foreach (DataRow dr in PerformOperation.StoreOrder.Rows) // search whole table
                //    {
                //        if (dr["Account"].ToString() != "Unallocated" && dr["OrderStatus"].ToString() == "Filled")
                //        {
                //            GridData.Add(new Orders { Symbol = dr["Symbol"].ToString(), Side = dr["Side"].ToString(), Account = dr["Account"].ToString(), Quantity = dr["Quantity"].ToString(), AvgPrice = dr["AvgPrice"].ToString(), RemainingQuantity = dr["RemainingQuantity"].ToString(), OrderStatus = dr["OrderStatus"].ToString(), CLOrderID = dr["CLOrderID"].ToString(), ParentCLOrderID = dr["ParentCLOrderID"].ToString(), StaggedOrderID = dr["StaggedOrderID"].ToString(), OriginalCLOrderID = dr["OriginalCLOrderID"].ToString() });
                //        }
                //    }
                //    AllocatedUltraGrid.DataSource = GridData;
                //    AllocatedUltraGrid.DataBind();
                //}
                //else
                //{
                //    //creating column header if data is empty for UI
                //    Orders order = new Orders();
                //    AllocatedUltraGrid.DataSource = order;
                //    AllocatedUltraGrid.DataBind();
                //}

                AllocatedUltraGrid.DataSource = PerformOperation.SelectDataAllocation("Allocated");
                AllocatedUltraGrid.DataBind();
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the Load event of the Allocation control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        void Allocation_Load(object sender, EventArgs e)
        {
            AllocatedGrid();
            UnallocatedGrid();

            ultraComboEditorAccount.DataSource = PerformOperation.FillAccountAllocate();
            ultraComboEditorAccount.DataBind();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the Load event of the TradingTicket control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void TradingTicket_Load(object sender, EventArgs e)
        {
            ultraComboEditorSide.DataSource = PerformOperation.FillSide();
            ultraComboEditorSide.DataBind();

            ultraComboEditorAccount.DataSource = PerformOperation.FillAccount();
            ultraComboEditorAccount.DataBind();

            // adding the placeholder to text box
            ultraTextEditorSymbol.Text = "Enter Symbol";
        }
Exemplo n.º 4
0
 /// <summary>
 /// Orderses the grid.
 /// </summary>
 private void OrdersGrid()
 {
     //if (PerformOperation.StoreOrder.Rows.Count != 0)
     //{
     OrderUltraGrid.DataSource = PerformOperation.SelectDataBlotter();
     OrderUltraGrid.DataBind();
     //}
     //else
     //{
     //creating column header if data is empty for UI
     //Orders order = new Orders();
     //OrderUltraGrid.DataSource = order;
     //OrderUltraGrid.DataBind();
     //}
 }
Exemplo n.º 5
0
        /// <summary>
        /// Handles the Click event of the btnAllocate control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnAllocate_Click(object sender, EventArgs e)
        {
            try
            {
                if (ultraComboEditorAccount.Value.ToString() != "Select Account" && ultraComboEditorAccount.Value.ToString() != "")
                {
                    if (UnallocatedUltraGrid.Selected.Rows.Count != 0)
                    {
                        string PreviousAccount = this.UnallocatedUltraGrid.Selected.Rows[0].Cells["CLOrderID"].Value.ToString();

                        Orders order = new Orders();

                        order.Account = ultraComboEditorAccount.Value.ToString();

                        PerformOperation.UpdateAccount(order, PreviousAccount);

                        string            message = "Account allocated Successfully !!!";
                        string            title   = "Success Message";
                        MessageBoxButtons buttons = MessageBoxButtons.OK;
                        MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);

                        AllocatedGrid();
                        UnallocatedGrid();
                    }
                    else
                    {
                        string            message = "No Row Selected !!";
                        string            title   = "Failure Message";
                        MessageBoxButtons buttons = MessageBoxButtons.OK;
                        MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    string            message = "Please fill data properly !!!";
                    string            title   = "Validation Message";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
                }
            }
            catch (Exception)
            {
                string            message = "Please fill data properly !!!";
                string            title   = "Validation Message";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Handles the Click event of the Remove control for order status = new.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void toolStripRemove_Click(object sender, EventArgs e)
        {
            try
            {
                if (OrderUltraGrid.Selected.Rows.Count != 0)
                {
                    UltraGridRow row = this.OrderUltraGrid.Selected.Rows[0];

                    PerformOperation.DeleteData(row.Cells["CLOrderId"].Value.ToString());
                    OrdersGrid();
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a parameterised constructor.
        /// </summary>
        /// <param name="frm">The FRM.</param>
        /// <param name="menuStrip">The menu strip.</param>
        public TradingTicket(Form frm, string menuStrip)
        {
            try
            {
                if (frm.Text == "Blotter")
                {
                    InitializeComponent();

                    //foreach (DataRow dr in PerformOperation.StoreOrder.Rows) // search whole table
                    //{
                    List <Orders> dr = PerformOperation.InputFromBlotter(Blotter.BlotterPassTT);
                    if (dr[0].CLOrderID.ToString() == Blotter.BlotterPassTT)
                    {
                        ultraTextEditorSymbol.Text    = dr[0].Symbol.ToString();
                        ultraTextEditorSymbol.Enabled = false;
                        ultraComboEditorSide.Value    = dr[0].Side.ToString();
                        ultraComboEditorSide.Enabled  = false;
                        if (menuStrip == "toolStripCreate")
                        {
                            ultraComboEditorAccount.Value   = dr[0].Account.ToString();
                            ultraComboEditorAccount.Enabled = false;
                            ultraBtnCreateBlotter.Visible   = true;
                        }
                        else if (menuStrip == "toolStripEdit")
                        {
                            ultraComboEditorAccount.DataSource = PerformOperation.FillAccount();
                            ultraComboEditorAccount.DataBind();

                            ultraComboEditorAccount.SelectedIndex = ultraComboEditorAccount.FindString(dr[0].Account.ToString());
                            ultraBtnEditBlotter.Visible           = true;
                        }
                        ultraTextEditorQuantity.Value = dr[0].Quantity.ToString();
                        ultraTextEditorPrice.Value    = dr[0].AvgPrice.ToString();

                        ultraButtonCreateOrder.Visible = false;
                        ultraButtonDoneAway.Visible    = false;

                        //break;
                    }
                    //}
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// for validating the user to go to main page
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ultraButtonLogin_Click(object sender, EventArgs e)
        {
            bool login = PerformOperation.Login(ultraTextEditorUsername.Text, ultraTextEditorPassword.Text);

            if (login)
            {
                Nirvana nirvana = new Nirvana();
                nirvana.Show(this);
                Hide();
            }
            else
            {
                string            message = "Entered username or password is incorrect !!!";
                string            title   = "Error Message";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// create order button click event
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ultraButtonCreateOrder_Click(object sender, EventArgs e)
        {
            try
            {
                if (ultraTextEditorSymbol.Text != "" && ultraTextEditorSymbol.Text != "Enter Symbol" && ultraComboEditorSide.Value.ToString() != "Select Side" && ultraComboEditorSide.Value.ToString() != "" && ultraComboEditorAccount.Value.ToString() != "Select Account" && ultraComboEditorAccount.Value.ToString() != "" && ultraTextEditorQuantity.Value.ToString() != "" && ultraTextEditorQuantity.Value.ToString() != "0" && ultraTextEditorPrice.Value.ToString() != "" && ultraTextEditorPrice.Value.ToString() != "0")
                {
                    //idForOrder++;

                    Orders order = new Orders();
                    order.Symbol            = ultraTextEditorSymbol.Text;
                    order.Side              = ultraComboEditorSide.SelectedItem.ToString();
                    order.Account           = ultraComboEditorAccount.SelectedItem.ToString();
                    order.Quantity          = ultraTextEditorQuantity.Value.ToString();
                    order.AvgPrice          = ultraTextEditorPrice.Value.ToString();
                    order.RemainingQuantity = ultraTextEditorQuantity.Value.ToString();
                    order.OrderStatus       = "New";
                    //order.CLOrderID = "Order" + idForOrder;
                    //order.ParentCLOrderID = "Order" + idForOrder;
                    //order.StaggedOrderID = " ";
                    //order.OriginalCLOrderID = " ";

                    PerformOperation.InsertData(order, "Create");
                    string            message = "Order Placed Successfully !!!";
                    string            title   = "Success Message";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);
                }
                else
                {
                    string            message = "Please fill data properly !!!";
                    string            title   = "Validation Message";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
                }
            }
            catch (Exception)
            {
                string            message = "Please fill data properly !!!";
                string            title   = "Validation Message";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 10
0
 /// <summary>
 ///  Adding data to closing transaction ultra grid
 /// </summary>
 private void closingGrid()
 {
     //if (PerformOperation.StoreOrder.Rows.Count != 0)
     //{
     //    List<Orders> GridData = new List<Orders>();
     //    foreach (DataRow dr in PerformOperation.StoreOrder.Rows) // search whole table
     //    {
     //        if ((dr["Side"].ToString() == "Sell" || dr["Side"].ToString() == "Sell Short") && dr["OrderStatus"].ToString() == "Filled")
     //        {
     //            GridData.Add(new Orders { Symbol = dr["Symbol"].ToString(), Side = dr["Side"].ToString(), Account = dr["Account"].ToString(), Quantity = dr["Quantity"].ToString(), AvgPrice = dr["AvgPrice"].ToString(), RemainingQuantity = dr["RemainingQuantity"].ToString(), OrderStatus = dr["OrderStatus"].ToString(), CLOrderID = dr["CLOrderID"].ToString(), ParentCLOrderID = dr["ParentCLOrderID"].ToString(), StaggedOrderID = dr["StaggedOrderID"].ToString(), OriginalCLOrderID = dr["OriginalCLOrderID"].ToString() });
     //        }
     //    }
     CloseUltraGrid.DataSource = PerformOperation.SelectDataClosing("Closing");
     CloseUltraGrid.DataBind();
     //}
     //else
     //{
     //    //creating column header if data is empty for UI
     //    Orders order = new Orders();
     //    CloseUltraGrid.DataSource = order;
     //    CloseUltraGrid.DataBind();
     //}
 }
Exemplo n.º 11
0
        /// <summary>
        ///  adding rows in sub order grid after selection in order grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Orders_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
        {
            try
            {
                if (OrderUltraGrid.Selected.Rows.Count != 0)
                {
                    UltraGridRow row = this.OrderUltraGrid.Selected.Rows[0];

                    if (row.Cells["OrderStatus"].Value.ToString() == "Filled" || row.Cells["OrderStatus"].Value.ToString() == "PartiallyFilled")
                    {
                        SubOrdersUltraGrid.DataSource = PerformOperation.SelectData(row.Cells["CLOrderId"].Value.ToString());
                        SubOrdersUltraGrid.DataBind();
                    }
                    else
                    {
                        SubOrdersUltraGrid.DataSource = null;
                        SubOrdersUltraGrid.DataBind();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Edit sub order after processing from blotter.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ultraBtnEditBlotter_Click(object sender, EventArgs e)
        {
            try
            {
                if (ultraComboEditorAccount.Value.ToString() != "Select Account" && ultraComboEditorAccount.Value.ToString() != "" && ultraTextEditorQuantity.Value.ToString() != "" && ultraTextEditorQuantity.Value.ToString() != "0" && ultraTextEditorPrice.Value.ToString() != "" && ultraTextEditorPrice.Value.ToString() != "0")
                {
                    Orders order = new Orders();

                    order.Account           = ultraComboEditorAccount.Value.ToString();
                    order.Quantity          = ultraTextEditorQuantity.Value.ToString();
                    order.AvgPrice          = ultraTextEditorPrice.Value.ToString();
                    order.RemainingQuantity = (Convert.ToInt32(ultraTextEditorQuantity.Value.ToString()) - Convert.ToInt32(Blotter.BlotterPassTTQty) + Blotter.BlotterPassTTRemQty).ToString();

                    PerformOperation.UpdateData(order, Blotter.BlotterPassTT, "Edit");

                    string            message = "Order Edited Successfully !!!";
                    string            title   = "Success Message";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);
                }
                else
                {
                    string            message = "Please fill data properly !!!";
                    string            title   = "Validation Message";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
                }
            }
            catch (Exception)
            {
                string            message = "Please fill data properly !!!";
                string            title   = "Validation Message";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Creating new sub order after processing from blotter.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ultraBtnCreateBlotter_Click(object sender, EventArgs e)
        {
            try
            {
                if (ultraTextEditorQuantity.Value.ToString() != "" && ultraTextEditorQuantity.Value.ToString() != "0" && ultraTextEditorPrice.Value.ToString() != "" && ultraTextEditorPrice.Value.ToString() != "0")
                {
                    Orders order = new Orders();

                    order.Symbol   = ultraTextEditorSymbol.Value.ToString();
                    order.Side     = ultraComboEditorSide.Value.ToString();
                    order.Account  = ultraComboEditorAccount.Value.ToString();
                    order.Quantity = Blotter.BlotterPassTTQty.ToString();
                    order.AvgPrice = ultraTextEditorPrice.Value.ToString();
                    if (Blotter.BlotterPassTTRemQty > Convert.ToInt32(ultraTextEditorQuantity.Value.ToString()))
                    {
                        order.RemainingQuantity = (Blotter.BlotterPassTTRemQty - Convert.ToInt32(ultraTextEditorQuantity.Value.ToString())).ToString();
                        order.OrderStatus       = "PartiallyFilled";
                        QtyFilled = Convert.ToInt32(ultraTextEditorQuantity.Value.ToString());

                        PerformOperation.UpdateData(order, Blotter.BlotterPassTT, "Create");

                        string            message = "Order Placed Successfully !!!";
                        string            title   = "Success Message";
                        MessageBoxButtons buttons = MessageBoxButtons.OK;
                        MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);
                    }
                    else if (Blotter.BlotterPassTTRemQty == Convert.ToInt32(ultraTextEditorQuantity.Value.ToString()))
                    {
                        QtyFilled = Convert.ToInt32(ultraTextEditorQuantity.Value.ToString());
                        order.RemainingQuantity = "0";
                        order.OrderStatus       = "Filled";

                        PerformOperation.UpdateData(order, Blotter.BlotterPassTT, "Create");

                        string            message = "Order Placed Successfully !!!";
                        string            title   = "Success Message";
                        MessageBoxButtons buttons = MessageBoxButtons.OK;
                        MessageBox.Show(message, title, buttons, MessageBoxIcon.Information);
                    }
                    else
                    {
                        string            message = "Can't trade more than specified quantity !!!";
                        string            title   = "Validation Message";
                        MessageBoxButtons buttons = MessageBoxButtons.OK;
                        MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
                    }
                    this.Close();
                }
                else
                {
                    string            message = "Please fill data properly !!!";
                    string            title   = "Validation Message";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
                }
            }
            catch (Exception)
            {
                string            message = "Please fill data properly !!!";
                string            title   = "Validation Message";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(message, title, buttons, MessageBoxIcon.Warning);
            }
        }