private void button1_Click(object sender, EventArgs e) { Quotes = new ObservableCollection<Quote>(); db = new DBAccess(); //Some example tickers Quotes.Add(new Quote(textBox1.Text.ToUpper())); //get the data YahooStockEngine.Fetch(Quotes); try { db.insert_stock(textBox1.Text.ToUpper(), Quotes[0].LastUpdate, Quotes[0].DividendShare, Quotes[0].Name, Quotes[0].StockExchange, Quotes[0].ChangeInPercent, Quotes[0].LastTradePrice, Quotes[0].Volume, Quotes[0].YearlyHigh, Quotes[0].YearlyLow, Quotes[0].DailyHigh, Quotes[0].DailyLow, Quotes[0].PeRatio); db.insert_stockhistory(DateTime.Now, "BUY", decimal.Parse(textBox2.Text), acct, db.select_stock(textBox1.Text.ToUpper())); } catch { Console.WriteLine("error"); } this.Close(); }
private void button1_Click_1(object sender, EventArgs e) { Quotes = new ObservableCollection <Quote>(); db = new DBAccess(); //Some example tickers Quotes.Add(new Quote(textBox1.Text.ToUpper())); //get the data YahooStockEngine.Fetch(Quotes); try { db.insert_stock(textBox1.Text.ToUpper(), Quotes[0].LastUpdate, Quotes[0].DividendShare, Quotes[0].Name, Quotes[0].StockExchange, Quotes[0].ChangeInPercent, Quotes[0].LastTradePrice, Quotes[0].Volume, Quotes[0].YearlyHigh, Quotes[0].YearlyLow, Quotes[0].DailyHigh, Quotes[0].DailyLow, Quotes[0].PeRatio); db.insert_stockhistory(DateTime.Now, "SELL", decimal.Parse(textBox2.Text), acct, db.select_stock(textBox1.Text.ToUpper())); } catch { Console.WriteLine("error"); } this.Close(); }