Example #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");
                }
            }
        }
Example #2
0
        public static ServerResponse getAllMail(long userid)
        {
            string[] stocks;

            stocks = SqliteHandler.getAllMail(userid);
            if (stocks.Length != 0)
            {
                return(new ServerResponse(true, "retrieved mail list successfully", stocks));
            }
            else
            {
                return(new ServerResponse(false, "There are no subscriptions currently.", null));
            }
        }