Beispiel #1
0
        public List <MedidorTrafico> GetAll()
        {
            List <MedidorTrafico> traficos = new List <MedidorTrafico>();

            try
            {
                using (StreamReader reader = new StreamReader(registroTraficos))
                {
                    string texto3 = null;
                    do
                    {
                        texto3 = reader.ReadLine();
                        if (texto3 != null)
                        {
                            string[]       textoArray3 = texto3.Split('|');
                            MedidorTrafico mt          = new MedidorTrafico()
                            {
                                Id           = textoArray3[0],
                                Date         = textoArray3[1],
                                CantidadVehi = textoArray3[2]
                            };
                            traficos.Add(mt);
                        }
                    } while (texto3 != null);
                }
            }catch (IOException ex)
            {
            }
            return(traficos);
        }
Beispiel #2
0
 public void Save(MedidorTrafico mt)
 {
     try
     {
         using (StreamWriter writer = new StreamWriter(registroTraficos, true))
         {
             writer.WriteLine(mt);
             writer.Flush();
         }
     }
     catch (IOException ex)
     {
     }
 }