protected void Application_Start() { this.LogDebug("Application Initializing"); GrowlHelper.SimpleGrowl("Application Initializing"); AppPaths.SetCurrent(new AppPaths.PathsInstance( new DirectoryInfo(Server.MapPath("~")), new DirectoryInfo(Path.Combine(Path.GetTempPath(), "Web")) )); AppDeployment.Instance.Modules().ForEach(i => this.LogInfo("Integrating with {0} at {1}", i.Name, i.Uri)); var options = new Options() .EnableRequestAdditionalParameters() .EnableResponseAdditionalParameters(); var binder = new ModelBinder { ParseAdditionalParameters = Parser }; GlobalConfiguration.Configuration.RegisterDataTables(options); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configuration.Filters.Add(new System.Web.Http.AuthorizeAttribute()); GlobalConfiguration.Configuration.Filters.Add(new AppExceptionFilterAttribute()); GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.Initialize(); Seeder.Initialize(); }
public static void SeedLogs() { GrowlHelper.SimpleGrowl("Seeding Legacy Logs"); var lines = File.ReadAllLines(Path.Combine(AppPaths.Instance.GetMigrationDataFolder(), "legacy_logs.csv")).Select(a => a.Split(';')); var repo = new LogRepository(); foreach (var l in lines) { var x = new Log(); x.DateCreated = DateTime.Parse(l.First().Split(',')[0].Trimmed()); x.DateModified = AppTime.Now(); x.LogId = l.First().Split(',')[2].Trimmed(); x.Name = l.First().Split(',')[3].Trimmed(); x.UserId = l.First().Split(',')[4].Trimmed(); x.ShortName = l.First().Split(',')[5].Trimmed(); x.WidgetColor = l.First().Split(',')[6].Trimmed(); var existing = repo.FindByLogId(x.LogId); if (!existing.Any()) { repo.Add(x); } } }
public static void Seed() { GrowlHelper.SimpleGrowl("Seeding Colors"); var repo = new ColorRepository(); repo.DeleteAll(); var lines = File.ReadAllLines(Path.Combine(AppPaths.Instance.GetMigrationDataFolder(), "dbo_Colors.csv")).Select(a => a.Split(';')); foreach (var x in lines) { var c = new Color(); c.Name = x.First().Split(',')[0].Trimmed(); repo.Insert(c); } }
public static void Seed() { GrowlHelper.SimpleGrowl("Seeding Roles"); var repo = new RoleRepository(); string[] items = Enum.GetNames(typeof(RoleName)); foreach (var x in items) { var existing = repo.GetRoleAsync(x.ToEnum <RoleName>()); if (existing.Result == null) { var e = new Role { RoleName = x.ToEnum <RoleName>(), ApplicationName = AppDeployment.Instance.AppSetting("ApplicationName", "Monitorr") }; repo.Insert(e); } } }
public void LogVerbose(Exception ex) { if (ex == null) { return; } this.LogDebug("----------------------ERROR----------------------------------------"); this.LogDebug($"{ ControllerContext.Request.RequestUri.AbsoluteUri } {ex.Message }"); if (ex.InnerException == null) { return; } this.LogInfo(ex.InnerException.Message); if (ex.InnerException.InnerException == null) { return; } this.LogInfo(ex.InnerException.InnerException.Message); this.LogDebug("----------------------END ERROR----------------------------------------"); GrowlHelper.SimpleGrowl(ControllerContext.Request.RequestUri.AbsoluteUri, $"with message: { ex.InnerException.Message }"); }