Beispiel #1
0
        public void initialize()
        {
            List<string> allStocks = new List<string>();
            allStocks.AddRange(getStocksList(@"../../Stocks/nyse.csv"));
            allStocks.AddRange(getStocksList(@"../../Stocks/nasdaq.csv"));
            allStocks.AddRange(getStocksList(@"../../Stocks/amex.csv"));
            string[] lines = allStocks.ToArray();
            String[] columns = null;
            Company theCompany = new Company(null, null, null, null, null, 0);
            foreach (String line in lines)
            {

                columns = line.Replace("\"", "").Split(',');

                theCompany.Name = columns[1];
                theCompany.Symbol = columns[0];
                theCompany.Sector = columns[6];
                theCompany.Industry = columns[7];
                theCompany.IPOyear = columns[5];

                stocks.Add(theCompany);
                theCompany = new Company(null, null, null, null, null, 0);
            }
        }
Beispiel #2
0
 public bool CompanyInWatchList(Company company)
 {
     foreach (Company watchListCompany in WatchList)
     {
         if (company.Symbol == watchListCompany.Symbol)
         {
             return true;
         }
     }
     return false;
 }
Beispiel #3
0
        /// <summary>
        /// Add a company to the user's watchlist.
        /// </summary>
        /// <param name="company"></param>
        public void AddToWatchList(Company company)
        {
            if (!CompanyInWatchList(company))
            {
                WatchList.Add(company);
                MessageBox.Show("Company added to watchlist.");

            }
            else
            {
                MessageBox.Show("Company already in watchlist.");
            }
        }