예제 #1
0
        private void Log()
        {
            using (var db = new DbLogsContext())
            {
                try
                {
                    var log = db.CreateDefaultLog();
                    log.data           = dateTime;
                    log.procedure_name = name;
                    log.ip             = info;

                    db.DbLogs.Add(log);
                    db.SaveChanges();
                }
                catch { }
            }
        }
예제 #2
0
        public int GetActivitiesCountOfLastTenMinutes()
        {
            using (var db = new DbLogsContext())
            {
                try
                {
                    var list         = db.DbLogs.ToList();
                    var logCountList = from log in list
                                       where (log.data + TimeSpan.FromMinutes(10)).CompareTo(dateTime) == 1 && log.ip.Trim() == info
                                       select log;

                    return(logCountList.Count());
                }
                catch
                {
                    return(-1);
                }
            }
        }