Ejemplo n.º 1
0
        public List <SearchCallLogResult> Search(SearchCallLogCriteria cr)
        {
            if (!cr.CanSearch())
            {
                return(null);
            }

            using (var ctx = new NovaAlertContext())
            {
                var query = BuildCallLogSearchQuery(cr, ctx);
                var list  = new List <SearchCallLogResult>();

                List <CallLogDb> dbList;
                if (cr.NumOfRecords > 0)
                {
                    dbList = query.OrderByDescending(det => det.StartTime).Skip(cr.StartIndex).Take(cr.NumOfRecords).ToList();
                }
                else
                {
                    dbList = query.ToList();
                }

                foreach (var call in dbList)
                {
                    var result = new SearchCallLogResult();
                    Mapper.Map <CallLogDb, SearchCallLogResult>(call, result);
                    list.Add(result);
                }

                return(list);
            }
        }
Ejemplo n.º 2
0
        public uint Count(SearchCallLogCriteria cr)
        {
            if (!cr.CanSearch())
            {
                return(0);
            }

            using (var ctx = new NovaAlertContext())
            {
                var query = BuildCallLogSearchQuery(cr, ctx);

                return((uint)query.Count());
            }
        }