示例#1
0
        private static void GenerateNewEmails()
        {
            // get all templates that are enabled and not real time
            var templates = NotificationTemplates.GetAll().Where(x => x.Enabled == true && x.Frequency != "Real Time").ToList();

            foreach (NotificationTemplates template in templates)
            {
                // Check for next run date
                if ((template.NextRunDate ?? DateTime.MaxValue) <= DateTime.UtcNow)
                {
                    GenerateEmailsFromTemplate(template);
                }
            }
        }
        public IHttpActionResult Get()
        {
            try
            {
                var identity = HttpContext.Current.User.Identity as ClaimsIdentity;
                OGE450User = UserInfo.GetUser(identity);

                if (OGE450User.IsAdmin)
                {
                    var templates = NotificationTemplates.GetAll();

                    return(Json(templates.OrderBy(x => x.Title), CamelCase));
                }
                else
                {
                    return(Unauthorized());
                }
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }
        }