Beispiel #1
0
        public static void sendShoppingEmail(int userID, string reminder)
        {
            Database myDatabase = new Database();
            myDatabase.ReturnConnection();
            string command = "SELECT * FROM UserTable Where ID=" + userID + ";";
            var reader = myDatabase.ExcuteQuery(command);
            reader.Read();

            User userObj = new User();
            userObj.Name = reader["Name"].ToString();
            userObj.Email = reader["Email"].ToString();

            string message = "Hi, " + userObj.Name + " this is a reminder for you when go shop for food" + System.Environment.NewLine + System.Environment.NewLine + reminder;

            Email.SendEmail("*****@*****.**", "FoodnStuff@support", userObj.Email, userObj.Name, "Shopping food reminder", message);

            myDatabase.CloseConnection();
        }
Beispiel #2
0
        public static void sendRemindEmail(int userID)
        {
            Database myDatabase = new Database();
            myDatabase.ReturnConnection();
            string command = "SELECT * FROM UserTable Where ID=" + userID + ";";
            var reader = myDatabase.ExcuteQuery(command);
            reader.Read();

            User userObj = new User();
            userObj.Name = reader["Name"].ToString();
            userObj.Email = reader["Email"].ToString();

            List<Ingredient> expiredIngredientList = Model.StorageManagement.GetExpiredIngredient(userID);

            string message = "Hi, " + userObj.Name + " you have some food will expired today. Take a look" + System.Environment.NewLine + System.Environment.NewLine;
            foreach (Ingredient ing in expiredIngredientList) {
                message += ing.Amount + " " + ing.Unit + " " + ing.Name + " Expired day " + ing.ExpiredDay + System.Environment.NewLine;
            }

            Email.SendEmail("*****@*****.**", "FoodnStuff@support", userObj.Email, userObj.Name, "Expired food reminder", message);

            myDatabase.CloseConnection();
        }