示例#1
0
        public static void emailAll()
        {
            long[] ids = SqliteHandler.getAllUserIds();
            for (int i = 0; i < ids.Length; i++)
            {
                string[] stocks   = SqliteHandler.getAllMail(ids[i]);
                string   contents = "";
                for (int j = 0; j < stocks.Length; j++)
                {
                    string[]       fields = { "*" };
                    ServerResponse sr     = StockUtilities.getQuote(stocks[j], fields);

                    if (sr.payload != null)
                    {
                        contents += sr.payload.ToString();
                    }
                }

                UserModel user = SqliteHandler.getUser(ids[i]);

                if (stocks.Length != 0)
                {
                    sendEmail(user.email, "Stock Update", contents);
                }
                else
                {
                    Console.WriteLine(user.email + " was skipped as they had no subscriptions");
                }
            }
        }