Ejemplo n.º 1
0
 public void WorkWithResults(ObservableCollection <Answer> answers)
 {
     answers = GenerateResults();
     _logger.InfoReader($"Finish reading, get answers {answers.Count.ToString()}");
     try
     {
         foreach (var answ in answers)
         {
             /////////
             _logger.InfoReader("Start check answers");
             var receiver = _receivers.Where(r => r.Email.Equals(answ.Email)).FirstOrDefault();
             if (receiver != null)
             {
                 receiver.StatusSend = AnswerStatus;
                 _dbService.SaveReceiver(receiver);
                 _notification.AnswerGetMessage($"{answ.Email}\n {answ.Subject}");
             }
             _reporter.AddToReport(Path.Combine(_settings.ReportFolder_1, $"{_account.Server}.xlsx"), answ, receiver);
             _reporter.AddToReport(Path.Combine(_settings.ReportFolder_2, $"{_account.Server}.xlsx"), answ, receiver);
             _logger.InfoReader($"Add to report!{answ.Email}");
         }
     }
     catch (Exception ex)
     {
         _logger.ErrorReader($"Report error: {ex.Message}");
     }
 }