Beispiel #1
0
        static public Llegada ellegadaAllegada(ELlegada el)
        {
            Llegada ll = new Llegada();

            ll.idParada = el.idParada;
            ll.idViaje  = el.idViaje;
            ll.hora     = el.hora;
            ll.fecha    = el.fecha;
            return(ll);
        }
Beispiel #2
0
        static public ELlegada llegadaAEllegada(Llegada ll)
        {
            ELlegada el = new ELlegada();

            el.idParada = ll.idParada;
            el.idViaje  = ll.idViaje;
            el.hora     = ll.hora;
            el.fecha    = ll.fecha;
            return(el);
        }
Beispiel #3
0
        private EParada ultimaParada(int idViaje)
        {
            EViaje          ev       = iViaje.getViaje(idViaje);
            List <ELlegada> llegadas = ev.Llegada.ToList();

            llegadas.OrderBy(d => d.fecha);
            DateTime        ultimaF      = llegadas.Last().fecha;
            List <ELlegada> ultllegadasF = new List <ELlegada>();

            foreach (var item in llegadas)
            {
                if (item.fecha == ultimaF)
                {
                    ultllegadasF.Add(item);
                }
            }
            ultllegadasF.OrderBy(d => d.hora);
            ELlegada ultimaLLeg = ultllegadasF.Last();

            return(iParada.getParada(ultimaLLeg.idParada));
        }
Beispiel #4
0
 public ELlegada getLlegada(int idParada, int idViaje)
 {
     try
     {
         using (uybusEntities db = new uybusEntities())
         {
             Llegada l = db.Llegada.Find(idParada, idViaje);
             if (l == null)
             {
                 return(null);
             }
             ELlegada el = new ELlegada();
             el = Converter.llegadaAEllegada(l);
             return(el);
         }
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Beispiel #5
0
 public List <ELlegada> getAllLlegadas()
 {
     try
     {
         using (uybusEntities db = new uybusEntities())
         {
             List <ELlegada> lstEl    = new List <ELlegada>();
             var             llegadas = db.Llegada;
             foreach (var l in llegadas)
             {
                 ELlegada el = new ELlegada();
                 el = Converter.llegadaAEllegada(l);
                 lstEl.Add(el);
             }
             return(lstEl);
         }
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
Beispiel #6
0
        public ELlegada addLlegada(int idParada, int idViaje, TimeSpan hora, DateTime fecha)
        {
            try
            {
                using (uybusEntities db = new uybusEntities())
                {
                    Llegada ll = new Llegada();
                    ll.idParada = idParada;
                    ll.idViaje  = idViaje;
                    ll.hora     = hora;
                    ll.fecha    = fecha;
                    db.Llegada.Add(ll);
                    db.SaveChanges();

                    ELlegada el = new ELlegada();
                    el = Converter.llegadaAEllegada(ll);
                    return(el);
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }