Esempio n. 1
0
        public List <Message> GetMessagesByDate(TimePeriod TimePeriod)
        {
            _logger.LogDebug($"Get messages by period: {TimePeriod.Start} || {TimePeriod.End}");
            var msgs = _MessageData.GetMessagesByDate(TimePeriod);

            _logger.LogDebug($"Count of messages by period {TimePeriod.Start} || {TimePeriod.End} is {msgs.Count}");
            return(msgs);
        }
Esempio n. 2
0
        public async Task GetLast1MinMessages(string connectionId)
        {
            DateTime Start, End = DateTime.Now;

            Start = End - TimeSpan.FromSeconds(60);

            var messages = _MessageData.GetMessagesByDate(Start, End);

            var messages2 = messages.Select(el => new
            {
                el.Text,
                el.Id,
                el.Order,
                ServerDateTime = el.ServerDateTime.ToString("yyyy-MM-dd HH:mm:ss")
            }).ToArray();
            await _HubContext.Clients.Client(connectionId).SendAsync("Receive", messages2);
        }
Esempio n. 3
0
 /// <summary>
 /// Get messages from database in period
 /// </summary>
 /// <param name="Start">Begin of period</param>
 /// <param name="End">End of peri</param>
 /// <returns>List of messages with in period</returns>
 public List <Message> GetMessagesByDate(DateTime Start, DateTime End = default)
 {
     return(_MessageData.GetMessagesByDate(new TimePeriod {
         Start = Start, End = End
     }));
 }