Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        protected void Application_Error()
        {
            System.Exception exception = Server.GetLastError();
            Response.Clear();

            if (exception != null)
            {

                using (HorizonContext db = new HorizonContext())
                {
                    if (!Horizon.Web.Helpers.DatabaseHelper.IsDown(db))
                    {
                        //var notification = new Horizon.Web.Models.Notification()
                        //{
                        //    Id = Guid.NewGuid(),
                        //    Content = exception.Message,
                        //    CreateDate = DateTime.Now,
                        //    Name = string.Format("Error {0}", (exception as System.Web.HttpException).GetHttpCode()),
                        //    Read = false,
                        //    Title = string.Format("Error {0}", (exception as System.Web.HttpException).GetHttpCode()),
                        //    Users = db.User.Where(u => u.Roles.Any(r => r.Name.Contains("SuperAdmin"))).ToList(),
                        //    Priority = 0,
                        //    Status = db.NotificationStatus.Where(n => n.Name.Equals("Unread")).SingleOrDefault()
                        //};

                        //db.Notification.Add(notification);
                        //db.SaveChanges();
                    }
                }

                System.Web.HttpException httpException = exception as System.Web.HttpException;

                if (httpException != null)
                {

                    // clear error on server
                    Server.ClearError();

                    Response.Redirect(string.Format("/{0}/Error/{1}", Helpers.CultureHelper.GetCurrentCulture, httpException.GetHttpCode()), true);
                }
            }
        }
Beispiel #2
0
 public BlogManager()
 {
     db = new HorizonContext();
 }
Beispiel #3
0
 public SectionManager()
 {
     db = new HorizonContext();
 }
Beispiel #4
0
 public NotificationManager()
 {
     db = new HorizonContext();
 }
Beispiel #5
0
 public SectionManager()
 {
     db = new HorizonContext();
 }
 public NotificationManager()
 {
     db = new HorizonContext();
 }
Beispiel #7
0
 public BlogManager()
 {
     db = new HorizonContext();
 }