Beispiel #1
0
        public static void New(string UserId, string User, string OperationName, string Comment, string Errors, bool Start = true)
        {
            NpgsqlContext db = new NpgsqlContext();

            SystemLog systemlog = new SystemLog()
            {
                Action    = Start ? Properties.Settings.Default.SystemLogActionStart : Properties.Settings.Default.SystemLogActionFinish,
                DateTime  = DateTime.Now,
                Operation = OperationName,
                User      = User,
                UserId    = UserId,
                Comment   = Comment,
                Errors    = Errors
            };

            db.SystemLogs.Add(systemlog);
            db.SaveChanges();
        }
Beispiel #2
0
        public static void New(string OperationName, bool Start = true)
        {
            NpgsqlContext db = new NpgsqlContext();

            ApplicationDbContext = new ApplicationDbContext();
            UserManager          = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(ApplicationDbContext));
            ApplicationUser user = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().FindById(HttpContext.Current.User.Identity.GetUserId());

            SystemLog systemlog = new SystemLog()
            {
                Action    = Start ? Properties.Settings.Default.SystemLogActionStart : Properties.Settings.Default.SystemLogActionFinish,
                DateTime  = DateTime.Now,
                Operation = OperationName,
                User      = user.Email,
                UserId    = user.Id
            };

            db.SystemLogs.Add(systemlog);
            db.SaveChanges();
        }