Пример #1
0
        public PaginatedItems <Alarm> GetAll(IMongoFilter <Device, Alarm> filter, int rowsPerPage, int pageNumber)
        {
            DeviceAlarmFilter alarmFilter = new DeviceAlarmFilter
            {
                Context   = (filter as AlarmFilter).Context,
                AlarmType = (filter as AlarmFilter).AlarmType,
                Gravity   = (filter as AlarmFilter).Gravity,
                DeviceId  = string.Empty,
                IsRead    = (filter as AlarmFilter).IsRead,
                IsActive  = (filter as AlarmFilter).IsActive
            };

            var totalCount = alarmRepository.Count(alarmFilter);
            var pageCount  = rowsPerPage == 0 ? 1 : (int)Math.Ceiling((double)totalCount / rowsPerPage);

            return(new PaginatedItems <Alarm>
            {
                PageCount = pageCount,
                TotalItemsCount = totalCount,
                Items = alarmRepository.Get(alarmFilter, rowsPerPage, pageNumber)
            });
        }
Пример #2
0
 public int GetCounts(int eNodebId, DateTime begin, DateTime end)
 {
     return(_repository.Count(begin, end, eNodebId));
 }