Exemple #1
0
        public List <Airport> ProccessFile(string pathToFile, List <TimeZoneInformation> timeZoneAirports, ref int rowsIgnored)
        {
            List <Airport> result = new List <Airport>();

            foreach (var line in fileParser.GetAllLinesFromFile(pathToFile))
            {
                try
                {
                    string[] items = service.SplitLine(line);

                    int    currentId   = items[0].ToInt();
                    string airportName = items[1];

                    var timeZone = GetAirportsTimeZone(timeZoneAirports, currentId);

                    if (!service.IsValid(items, timeZone))
                    {
                        logger.LogInfo($"Invalid row: {currentId} - {airportName}");
                        rowsIgnored++;

                        continue;
                    }

                    Airport airport = TransformLineToAirportObject(items, timeZone);

                    result.Add(airport);
                }
                catch (Exception ex)
                {
                    logger.LogError(ex.Message);
                }
            }

            return(result);
        }
 public static void LogInfo(string messageFormat, params object[] args)
 {
     if (Logger != null)
     {
         Logger.LogInfo(messageFormat, args);
     }
 }
Exemple #3
0
 public static void LogInfo(string messageFormat, params object[] args)
 {
     if (Logger != null)
     {
         Logger.LogInfo(messageFormat, args);
     }
     else
     {
         Console.WriteLine(messageFormat, args);
     }
 }
 public async Task <IEnumerable <TodoItem> > GetTodoItems()
 {
     _logger.LogInfo("get all to do items api called.");
     return(await _todoRepository.ListAllAsync());
 }