예제 #1
0
        //submit button clicked
        private void button1_Click(object sender, EventArgs e)
        {
            //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();
                }
            }
        }