Пример #1
0
        private void button1_Click(object sender, EventArgs e)//submit button clicked
        {
            //get the input values
            string company       = comboBox1.Text;
            string num_of_shares = textBox1.Text;
            string money         = textBox2.Text;

            int   shareSize = Convert.ToInt32(num_of_shares);
            float price     = Convert.ToSingle(money);

            //make new sell order
            SellOrder sellorder = new SellOrder(shareSize, price, company);

            //get all the companies in the list
            foreach (Company value in realdata._company)
            {
                //find the right company for the sell order
                if (value.compName == company)
                {
                    value.Sellorder.Add(sellorder); //add the sell order to the company
                    value.BidSellMatch();           //check for match with bid orders
                    Console.Write("sell order added");
                    // realdata._stock[0].Update(realdata);
                    //  realdata._stock[1].Update(realdata);
                    realdata.Notify();
                }
            }
        }
Пример #2
0
        private void stockStateSummaryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StateSummary StockStateSummary = new StateSummary(this.RTD);

            // Set the parent form of the child window.
            StockStateSummary.MdiParent = this;
            // Display the new form.

            RTD.Register(StockStateSummary);
            RTD.Notify();
            StockStateSummary.Show();
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string company       = comboBox1.Text; //strings from the box
            string num_of_shares = textBox1.Text;
            string money         = textBox2.Text;

            int   shareSize = Convert.ToInt32(num_of_shares); //make string data into ints
            float price     = Convert.ToSingle(money);

            BuyOrder buyorder = new BuyOrder(shareSize, price, company);

            foreach (Company value in realdata._company) //go through all companies
            {
                if (value.compName == company)
                {
                    value.Buyorder.Add(buyorder); //add the order to the list of orders in company
                    value.BidSellMatch();         //check for transaction
                    realdata.Notify();            //update all views
                }
            }
        }