Ejemplo n.º 1
0
 public void TestMethod1()
 {
     using (var ctx = new NovaAlertContext())
     {
         var list = ctx.ViewResults.Where(r => r.PhoneNumberId != null).OrderBy(r => r.Id).ToList();
     }
 }
Ejemplo n.º 2
0
        bool IsAlarmPlayed(byte alarmType, DateTime date, bool testOnly)
        {
            if (testOnly)
            {
                return(false);
            }

            using (var ctx = new NovaAlertContext())
            {
                return(ctx.AlarmLogs.Where(a => a.AlarmType == alarmType &&
                                           SqlFunctions.DateDiff("day", a.AlarmTime, date) == 0).Count() > 0);
            }
        }
Ejemplo n.º 3
0
        void AddAlarmLog(byte alarmType, DateTime date, bool testOnly)
        {
            if (testOnly)
            {
                LogService.Logger.Debug(string.Format("AddAlarm({0},{1})", alarmType, date.ToString("HH:mm:ss")));
                return;
            }

            using (var ctx = new NovaAlertContext())
            {
                var al = new AlarmLog()
                {
                    AlarmType = alarmType, AlarmTime = date
                };
                ctx.AlarmLogs.Add(al);
                ctx.SaveChanges();
            }
        }