public Reemplazar(Vuelo vuelo, BajaAeronaveD bajaD )
 {
     this.vuelo = vuelo;
     InitializeComponent();
     lstAer = new List<Aeronave>();
     this.bD = bajaD;
 }
 public Reemplazar(Vuelo vuelo, BajaFueraServicio bajaFS)
 {
     this.vuelo = vuelo;
     InitializeComponent();
     lstAer = new List<Aeronave>();
     this.bFS = bajaFS;
 }
예제 #3
0
        // POST api/Vuelo
        public HttpResponseMessage PostVuelo(Vuelo vuelo)
        {
            if (ModelState.IsValid)
            {
                db.Vueloes.AddObject(vuelo);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, vuelo);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = vuelo.NuVuelo }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
        //
        // GET: /Boletos/
        public ActionResult Index(int tipo)
        {
            if (Session["usuario"] != null)
            {

                Cliente cliente = (Cliente)Session["usuario"];
               ServicioWeb.ServicioDeComunicacionSoapClient servicio=new ServicioWeb.ServicioDeComunicacionSoapClient();
                Vuelo vuelo=new Vuelo();

                var boletoes = db.Boletos.Include(b => b.Vuelo).Where(p=>p.Cliente.Id==cliente.Id && p.tipo==tipo);
               foreach(var a in boletoes){

                   a.BoletoCargar();
               }
                return View(boletoes.ToList());

            }
            else
            {
                Session["direccion"] = Request.Url.AbsoluteUri;
                return RedirectToAction("IniciarSesion", "Clients");
            }
        }
예제 #5
0
        // PUT api/Vuelo/5
        public HttpResponseMessage PutVuelo(int id, Vuelo vuelo)
        {
            if (ModelState.IsValid && id == vuelo.NuVuelo)
            {
                db.Vueloes.Attach(vuelo);
                db.ObjectStateManager.ChangeObjectState(vuelo, EntityState.Modified);

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
 public static Vuelo CreateVuelo(int id, global::System.DateTime fechaSalida, int duracion)
 {
     Vuelo vuelo = new Vuelo();
     vuelo.Id = id;
     vuelo.FechaSalida = fechaSalida;
     vuelo.Duracion = duracion;
     return vuelo;
 }
 public void AddToVueloes(Vuelo vuelo)
 {
     base.AddObject("Vueloes", vuelo);
 }
        public ActionResult BuscarVuelo(Vuelo model)
        {
            var b = (ServicioWeb.Vuelo[])null;
            var n = (ServicioWeb.Vuelo[])null;
            List<Vuelo> vuelos = new List<Vuelo>();
            ServicioWeb.ServicioDeComunicacionSoapClient a = new ServicioWeb.ServicioDeComunicacionSoapClient();
            Session.Contents.RemoveAll();

            if (model.Modo.Equals("Ida"))
            {
                b = a.VuelosIda(Convert.ToInt32(model.Procedencia),
                    Convert.ToInt32(model.Destino), model.Salida);

                ViewBag.aeropuertos = a.Aeropuertos().ToList();

                foreach (var dato in b)
                {
                    vuelos = new List<Vuelo>();
                    Vuelo vuelo = new Vuelo();
                    string[] time = dato.HoraSalida.Split(':');
                    string[] min = time[1].Split(' ');
                    vuelo.Salida = dato.FechaSalida.AddHours(Convert.ToInt32(time[0])).AddMinutes(Convert.ToInt32(min[0]));
                    vuelo.Llegada = vuelo.Salida.AddHours(dato.Duracion);
                    vuelo.Id = dato.Id;
                    vuelo.Destino = a.Aeropuertos().ToList().Find(p => p.Id == (Int32)dato.AeropuertoReference.EntityKey.EntityKeyValues.First().Value).Lugar;
                    vuelo.Procedencia = a.Aeropuertos().ToList().Find(p => p.Id == (Int32)dato.Aeropuerto1Reference.EntityKey.EntityKeyValues.First().Value).Lugar;
                    vuelos.Add(vuelo);
                    Session["Ida"] = vuelos;
                }

                if (vuelos==null)
                {
                    TempData["error"] = "No encontramos ningun vuelo que coincida con tu busqueda";
                    return RedirectToAction("Index", "Home");
                }
            }
            else if (model.Modo.Equals("Ida y Vuelta"))
            {
                n = a.VuelosVuelta(Convert.ToInt32(model.Procedencia),
                    Convert.ToInt32(model.Destino), model.Salida, model.Llegada);

                b = a.VuelosIda(Convert.ToInt32(model.Procedencia),
                    Convert.ToInt32(model.Destino), model.Salida);

                ViewBag.aeropuertos = a.Aeropuertos().ToList();
                Session.Contents.RemoveAll();

                foreach (var dato in b)
                {

                    vuelos = new List<Vuelo>();
                    Vuelo vuelo = new Vuelo();
                    string[] time = dato.HoraSalida.Split(':');
                    string[] min = time[1].Split(' ');
                    vuelo.Salida = dato.FechaSalida.AddHours(Convert.ToInt32(time[0])).AddMinutes(Convert.ToInt32(min[0]));
                    vuelo.Llegada = vuelo.Salida.AddHours(dato.Duracion);
                    vuelo.Id = dato.Id;
                    vuelo.Destino = a.Aeropuertos().ToList().Find(p => p.Id == (Int32)dato.AeropuertoReference.EntityKey.EntityKeyValues.First().Value).Lugar;
                    vuelo.Procedencia = a.Aeropuertos().ToList().Find(p => p.Id == (Int32)dato.Aeropuerto1Reference.EntityKey.EntityKeyValues.First().Value).Lugar;
                    vuelos.Add(vuelo);
                    Session["Ida"] = vuelos;
                }

                foreach (var dato in n)
                {
                    vuelos = new List<Vuelo>();
                    Vuelo vuelo = new Vuelo();
                    string[] time = dato.HoraSalida.Split(':');
                    string[] min = time[1].Split(' ');
                    vuelo.Salida = dato.FechaSalida.AddHours(Convert.ToInt32(time[0])).AddMinutes(Convert.ToInt32(min[0]));
                    vuelo.Llegada = vuelo.Salida.AddHours(dato.Duracion);
                    vuelo.Id = dato.Id;
                    vuelo.Destino = a.Aeropuertos().ToList().Find(p => p.Id == (Int32)dato.AeropuertoReference.EntityKey.EntityKeyValues.First().Value).Lugar;
                    vuelo.Procedencia = a.Aeropuertos().ToList().Find(p => p.Id == (Int32)dato.Aeropuerto1Reference.EntityKey.EntityKeyValues.First().Value).Lugar;
                    vuelos.Add(vuelo);
                    Session["IdaVuelta"] = vuelos;
                }

                if (vuelos.Count == 0)
                {
                    TempData["error"] = "No encontramos ningun vuelo que coincida con tu busqueda";
                    return RedirectToAction("Index", "Home");
                }
            }

            return View();
        }
 public ActionResult Index(Vuelo model)
 {
     return RedirectToAction("BuscarVuelo", "Vuelo",model);
 }
예제 #10
0
        public void EliminarVuelo(string id)
        {
            Vuelo Existente = vuelosDAO.Obtener(Convert.ToInt32(id));

            vuelosDAO.Eliminar(Convert.ToInt32(id));
        }
예제 #11
0
        public Vuelo ModificarVuelo(Vuelo VuelosAModificar)
        {
            Vuelo Existente = vuelosDAO.Obtener(VuelosAModificar.Id);

            return(vuelosDAO.Modificar(VuelosAModificar));
        }
예제 #12
0
        public Vuelo CrearVuelo(Vuelo vueloACrear)
        {
            Vuelo Existente = vuelosDAO.Obtener(vueloACrear.Id);

            return(vuelosDAO.Crear(vueloACrear));
        }