Ejemplo n.º 1
0
        protected void Application_Start()
        {
            XmlConfigurator.Configure();
            var log = LogFactory.GetLog(typeof(MvcApplication));
            log.Debug("Starting edge");

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            var rc = RouteTable.Routes;

            using (var context = new WebDataContext())
            {
                context.Database.Initialize(false);
            }

            // Registers Containing Area, such as /Admin
            AreaRegistration.RegisterAllAreas();

            // Register the stock routes plus the plugin routes
            RouteConfig.RegisterRoutes(rc);

            // Add the new View Engine for our plugins to use
            ViewEngines.Engines.Add(new PluginRazorViewEngine());

            // Register new dynamic modules/shortcodes
            DynamicModules.Instance.AddDynamicModule("responsive_image", new ResponsiveImageShortcode());
            DynamicModules.Instance.AddDynamicModule("featured_events", new EventsModule());

            Mapping.SetAutomapperMappings();
        }
Ejemplo n.º 2
0
 public static void EnsureRequiredSettingsExist()
 {
     using (var context = new WebDataContext())
     {
         InitSiteSettings(context);
         InitTimeZone(context);
         context.SaveChanges();
     }
 }
Ejemplo n.º 3
0
        public static SiteSettingsViewModel LoadSiteSettings(WebDataContext context)
        {
            var model = new SiteSettingsViewModel
            {
                Settings = context.SiteSettings.FirstOrDefault(),
                RolesList = Roles.GetAllRoles().ToList()
            };

            var configs = context.Configurations;
            foreach (var config in configs)
            {
               model.ConfigSettings.Add(config.Key, config.Value);
            }

            return model;
        }
Ejemplo n.º 4
0
        private static void InitTimeZone(WebDataContext context)
        {
            var timeZone = context.Configurations.FirstOrDefault();
            if (timeZone != null)
            {
                return;
            }

            var setting = new SiteConfiguration
            {
                Key = ConfigSettings.TimeZone.ToString(),
                Value = TimeZoneInfo.Utc.Id
            };

            context.Configurations.Add(setting);
        }
Ejemplo n.º 5
0
        private static void SetLocalTimeZoneFromConfig()
        {
            try
            {
                using (var context = new WebDataContext())
                {
                    var zoneId =
                        context.Configurations.First(config => config.Key == ConfigSettings.TimeZone.ToString())
                            .Value;
                    LocalTimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(zoneId);

                    if (LocalTimeZoneInfo == null)
                    {
                        LocalTimeZoneInfo = TimeZoneInfo.Utc;
                    }
                }
            }
            catch
            {
                LocalTimeZoneInfo = TimeZoneInfo.Utc;
            }
        }
Ejemplo n.º 6
0
 public BlogLoader(WebDataContext context = null)
 {
     _context = context ?? new WebDataContext();
     _settingsUtils = new SiteSettingsUtils(_context);
 }
Ejemplo n.º 7
0
 public LatestBlogsViewModel(int blogCount = 10)
 {
     Context = new WebDataContext();
     Blogs = Context.Blogs.OrderByDescending(x => x.Date).Take(blogCount).ToList();
 }
Ejemplo n.º 8
0
 public EditContentHelper(WebDataContext context)
 {
     _context = context;
     _navigationUtils = new AdminNavigationUtils(context);
 }
Ejemplo n.º 9
0
 public ImportTools(WebDataContext context)
 {
     _context = context;
 }
Ejemplo n.º 10
0
 public WebUserUtils(WebDataContext context)
 {
     Context = context;
 }