Esempio n. 1
0
 public static void Import(this AlarmHourDistribution distribution, IEnumerable <AlarmHourInfo> infos)
 {
     foreach (AlarmHourInfo info in infos)
     {
         string descrition = info.AlarmType.GetAlarmTypeDescription();
         if (!distribution.AlarmRecords.ContainsKey(descrition))
         {
             distribution.AlarmRecords.Add(descrition, new int[24]);
             for (int i = 0; i < 24; i++)
             {
                 distribution.AlarmRecords[descrition][i] = 0;
             }
         }
         distribution.AlarmRecords[descrition][info.Hour] += info.Alarms;
     }
 }
 public AlarmHourDistribution GenerateAlarmHourDistribution()
 {
     var stats = _dailyStatRepository.Stats.Select(x =>
         new
         {
             Stat = x,
             Alarm = x.AlarmHourInfos
         });
     var stat = stats.FirstOrDefault(x =>
         x.Stat.StatTime == _statDate && x.Stat.CellId == _cellId && x.Stat.SectorId == _sectorId
                    && x.Stat.Frequency == _frequency);
     AlarmHourDistribution distribution = new AlarmHourDistribution();
     if (stat != null)
         distribution.Import(stat.Alarm);
     return distribution;
 }
 public void SetUp()
 {
     distribution = new AlarmHourDistribution();
 }