示例#1
0
 private IEnumerable <Event> FilterTime(EventSearchQuery eventSearchQuery, IEnumerable <Event> events)
 {
     if (eventSearchQuery.LastModified.HasValue)
     {
         events = events.Where(item => (item.Time >= eventSearchQuery.LastModified.Value));
     }
     return(events);
 }
示例#2
0
 private IEnumerable <Event> FilterTaskId(EventSearchQuery eventSearchQuery, IEnumerable <Event> events)
 {
     if (eventSearchQuery.TaskId.HasValue)
     {
         events = events.Where(item => (item.TaskId == eventSearchQuery.TaskId.Value));
     }
     return(events);
 }
示例#3
0
 private IEnumerable <Event> FilterRowStatus(EventSearchQuery eventSearchQuery, IEnumerable <Event> events)
 {
     if (eventSearchQuery.RowStatus.HasValue)
     {
         events = events.Where(item => (item.RowStatus == eventSearchQuery.RowStatus.Value));
     }
     return(events);
 }
示例#4
0
        // GET api/event/?userId={userId}
        public IEnumerable <Event> GetByUser(int userId)
        {
            var eventSearchQuery = new EventSearchQuery {
                UserId = userId
            };
            var result = m_eventManager.GetEvents(eventSearchQuery);

            return(result);
        }
示例#5
0
        // GET api/Event?userId={userId}&time={time}
        public IEnumerable <Event> GetByUserAndTime(int userId, string time)
        {
            var dateTime = DateTime.Parse(time);

            var eventSearchQuery = new EventSearchQuery {
                UserId = userId, LastModified = dateTime
            };
            var result = m_eventManager.GetEvents(eventSearchQuery);

            return(result);
        }
示例#6
0
        public Event[] GetEvents(EventSearchQuery eventSearchQuery)
        {
            var result = new List <Event>();

            var eventsList = QueryEvents(eventSearchQuery);

            foreach (var mongoEvent in eventsList)
            {
                var eventItem = new Event(mongoEvent);
                result.Add(eventItem);
            }

            return(result.ToArray());
        }
示例#7
0
        private IEnumerable <Event> QueryEvents(EventSearchQuery eventSearchQuery)
        {
            var eventsList = new List <Event>();

            IEnumerable <Event> eventsDataSource = m_eventDataSource.GetAll();

            eventsDataSource = FilterUserId(eventSearchQuery, eventsDataSource);

            eventsDataSource = FilterRowStatus(eventSearchQuery, eventsDataSource);

            eventsDataSource = FilterTaskId(eventSearchQuery, eventsDataSource);

            eventsDataSource = FilterTime(eventSearchQuery, eventsDataSource);
            return(eventsDataSource);
        }