///// <summary> ///// Sobre escritura del metodo ejecutar de la clase Comando. ///// Se encarga de llamar al DAO y devolver la respuesta al controlador. ///// </summary> ///// <returns> ///// Retorna una Entidad ///// </returns> public override List <Entidad> ejecutar() { IDAOBoleto daoBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); List <Entidad> boletos = daoBoleto.ConsultarBoletos(_id); return(boletos); }
///// <summary> ///// Sobre escritura del metodo ejecutar de la clase Comando. ///// Se encarga de llamar al DAO y devolver la respuesta al controlador. ///// </summary> ///// <returns> ///// Retorna una Entidad ///// </returns> public override Entidad ejecutar() { IDAOBoleto daoBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); Entidad boleto = daoBoleto.M05MostrarReservaBD(_id); return(boleto); }
public override String ejecutar() { IDAOBoleto daoBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); int test = daoBoleto.EliminarBoleto(_id); return(test.ToString()); }
///// <summary> ///// Sobre escritura del metodo ejecutar de la clase Comando. ///// Se encarga de llamar al DAO y devolver la respuesta al controlador. ///// </summary> ///// <returns> ///// Retorna una Entidad ///// </returns> public override List <Entidad> ejecutar() { IDAOBoleto instanciarBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); List <Entidad> lista = instanciarBoleto.M05ListarVuelosIdaBD(_fechaida, _fechavuelta, _idorigen, _iddestino, _tipo); return(lista); }
///// <summary> ///// Sobre escritura del metodo ejecutar de la clase Comando. ///// Se encarga de llamar al DAO y devolver la respuesta al controlador. ///// </summary> ///// <returns> ///// Retorna una Entidad ///// </returns> public override List <Entidad> ejecutar() { IDAOBoleto daoBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); List <Entidad> resultado = daoBoleto.ConsultarBoletosPasajero(_id); return(resultado); }
public override int ejecutar() { IDAOBoleto daoBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); int resultado = daoBoleto.MBuscarIdaVuelta(_id); return(resultado); }
public override bool ejecutar() { bool disponibilidad = false; IDAOBoleto daoBoleto = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); int conteo = daoBoleto.MConteoCategoria(_codigo_vuelo, _tipo); int cap = daoBoleto.MConteoCapacidad(_codigo_vuelo, _tipo); if (conteo < cap) { disponibilidad = true; } else { disponibilidad = false; } return(disponibilidad); }
List <Entidad> IDAOBoleto.M05ListarVuelosIdaBD(string fecha_ida, string fecha_vuelta, int id_origen, int id_destino, string tipo) { List <Entidad> listavuelos = new List <Entidad>(); try { IDAOBoleto ver = (IDAOBoleto)FabricaDAO.instanciarDaoBoleto(); SqlConnection con = new SqlConnection(_connexionString); con.Open(); //Busco la capacidad del avion del vuelo, segun el tipo de boleto String sql = "SELECT v.vue_id as id,v.vue_fecha_despegue as despegue,v.vue_fecha_aterrizaje as aterrizaje,r.rut_id as id_ruta,r.rut_FK_lugar_origen as id_origen,r.rut_FK_lugar_destino as id_destino,lo.lug_nombre as nombre_origen,ld.lug_nombre as nombre_destino FROM Vuelo v, Ruta r, Lugar lo, Lugar ld WHERE v.vue_fk_ruta=r.rut_id AND r.rut_fk_lugar_origen = lo.lug_id AND r.rut_fk_lugar_destino = ld.lug_id AND r.rut_FK_lugar_origen=" + id_origen + "AND r.rut_FK_lugar_destino=" + id_destino + " AND v.vue_fecha_despegue >= '" + fecha_ida + "' AND v.vue_fecha_despegue <= DATEADD(day, 1, '" + fecha_ida + "')"; System.Diagnostics.Debug.WriteLine(sql); SqlCommand cmd = new SqlCommand(sql, con); using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Random rnd = new Random(); //Tengo que ver en cada vuelo que la cantidad de fk_vuelo en Boleto_Vuelo sea menor que la capacidad del tipo de boleto en el avion int cant_bol_vue = 0; //Cantidad de fk_vuelo en Boleto_Vuelo int cap = 0; //capacidad del tipo de boleto en el avión //Si tipo de boleto = Turista entonces busco cap turista, si es ejecutivo cap ejecutivo y si es vip cap vip //Obtengo el id del vuelo System.Diagnostics.Debug.WriteLine("METODO DE LISTAR VUELOS IDA"); int id_vuelo = Int32.Parse(reader["id"].ToString()); //Obtengo cantidad de fk_vuelo en Boleto_vuelo cant_bol_vue = BuscarCantBolVue(id_vuelo); cap = ver.MConteoCapacidad(id_vuelo, tipo); System.Diagnostics.Debug.WriteLine("Capacidad en tipo " + tipo + " : " + cap); if (cant_bol_vue < cap) { BoletoVuelo vuelo = new BoletoVuelo(Int32.Parse(reader["id"].ToString()), reader.GetDateTime(reader.GetOrdinal("despegue")), reader.GetDateTime(reader.GetOrdinal("aterrizaje")), Int32.Parse(reader["id_ruta"].ToString()), Int32.Parse(reader["id_origen"].ToString()), Int32.Parse(reader["id_destino"].ToString()), reader.GetString(reader.GetOrdinal("nombre_origen")), reader.GetString(reader.GetOrdinal("nombre_destino")), rnd.Next(300, 1001), tipo, fecha_vuelta); listavuelos.Add(vuelo); } else { System.Diagnostics.Debug.WriteLine("CAPACIDAD MAXIMA ALCANZADA EN EL AVION PARA BOLETOS DEL TIPO: " + tipo); } } } cmd.Dispose(); con.Close(); return(listavuelos); } catch (SqlException) { return(null); } }