private void cargar_cabinas_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(nombreID.Text)) { MessageBox.Show("Debe completar todos los campos", "Error"); } else { try { this.guardarCrucero(); this.updatePasajeYCab(); string query = "SELECT * FROM ZAFFA_TEAM.Cabina WHERE crucero_id LIKE '" + cruID + "'"; correrCrucero(ClaseConexion.ResolverConsulta(query)); MessageBox.Show("Se actualizaron viajes con el nuevo crucero en base de datos", "Volver al menú"); } catch (SqlException) { MessageBox.Show("Error al actualizar viajes", "Error"); } Crucero cru = new Crucero(rolSeleccionado); cru.Visible = true; this.Dispose(false); } }
private void Llenar_ComboBox1() { if (indiceNroRecorrido == 1) { string query = "select NOMBRE_PUERTO from ZAFFA_TEAM.Puerto"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { string puerto = reader.GetString(0).Trim(); puertoDesde.Items.Add(puerto); } reader.Close(); } else { idRecorrido.Text = codRecorridoActualizado; string query2 = "select NOMBRE_PUERTO from ZAFFA_TEAM.Puerto where NOMBRE_PUERTO = '" + puertoDActualizado + "'"; SqlDataReader reader2 = ClaseConexion.ResolverConsulta(query2); while (reader2.Read()) { string puerto2 = reader2.GetString(0).Trim(); puertoDesde.Items.Add(puerto2); } reader2.Close(); } }
private void buscar_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(nombreC.Text) || String.IsNullOrWhiteSpace(funcionalidadesC.Text)) { MessageBox.Show("Debe completar todos los campos", "Error"); } else { try { this.guardarRol(); string query = "SELECT FUNCIONALIDAD FROM ZAFFA_TEAM.Funcionalidad WHERE descripcion_func LIKE '%" + funcionalidadesC.Text + "%'"; obtenerIdFunc(ClaseConexion.ResolverConsulta(query)); try { this.guardarFuncxRol(); MessageBox.Show("Rol guardado correctamente", "Ok"); FinRol fin = new FinRol(); fin.Visible = true; this.Dispose(false); } catch (SqlException) { MessageBox.Show("Error al guardar la funcionalidad del rol", "Ok"); } } catch (SqlException) { MessageBox.Show("Error al guardar el rol", "Error"); } } }
public ModificarRol(string v1, string v2, string unRol) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; nom = v1; funcionalidad = v2; rolSeleccionado = unRol; funcionalidades.Add("AbmRol"); funcionalidades.Add("AbmCrucero"); funcionalidades.Add("AbmPuerto"); funcionalidades.Add("AbmRecorrido"); funcionalidades.Add("CompraReservaPasaje"); funcionalidades.Add("GeneracionViaje"); funcionalidades.Add("ListadoEstadistico"); funcionalidades.Add("PagoReserva"); //DataGridViewColumnSortMode.Programmatic; //Listadoxfunc.MultiSelect = true; //Listadoxfunc.SelectionMode = DataGridViewSelectionMode.FullColumnSelect; Listadoxfunc.Rows.Clear(); listadoAgregar.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.[Funcionalidad x Rol] WHERE nombre_rol LIKE '" + nom + "'"; cargarFuncionalidad(ClaseConexion.ResolverConsulta(query)); string query2 = "SELECT FUNCIONALIDAD FROM ZAFFA_TEAM.Funcionalidad EXCEPT SELECT fr.FUNCIONALIDAD FROM ZAFFA_TEAM.[Funcionalidad x Rol] fr JOIN ZAFFA_TEAM.Funcionalidad f ON fr.FUNCIONALIDAD = f.FUNCIONALIDAD where NOMBRE_ROL LIKE '" + nom + "'"; cargarFuncionalidadAgregar(ClaseConexion.ResolverConsulta(query2)); }
private void modificarCruc_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(fabricanteModif.Text)) { MessageBox.Show("Debe elegir el nuevo fabricante", "Error"); } else { try { string query = "SELECT CRUCERO_MARCA_ID FROM ZAFFA_TEAM.Marca WHERE crucero_fabricante LIKE '%" + fabricanteModif.Text + "%'"; obtenerIdFab(ClaseConexion.ResolverConsulta(query)); this.updateFabricante(); MessageBox.Show("Fabricante actualizado", "Volver al inicio"); Crucero cru = new Crucero(rolSeleccionado); cru.Visible = true; this.Dispose(false); } catch (SqlException) { MessageBox.Show("El fabricante elegido es el actual", "Ok"); } } }
private void button2_Click_1(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(nuevoNombre.Text)) { MessageBox.Show("Debe completar el nuevo nombre", "Error"); } else { try { this.modificarNombre(); MessageBox.Show("Se ha modificado el nombre del rol", "Ok"); nom = nuevoNombre.Text; Listadoxfunc.Rows.Clear(); listadoAgregar.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.[Funcionalidad x Rol] WHERE nombre_rol LIKE '" + nom + "'"; cargarFuncionalidad(ClaseConexion.ResolverConsulta(query)); string query2 = "SELECT FUNCIONALIDAD FROM ZAFFA_TEAM.Funcionalidad EXCEPT SELECT fr.FUNCIONALIDAD FROM ZAFFA_TEAM.[Funcionalidad x Rol] fr JOIN ZAFFA_TEAM.Funcionalidad f ON fr.FUNCIONALIDAD = f.FUNCIONALIDAD where NOMBRE_ROL LIKE '" + nom + "'"; cargarFuncionalidadAgregar(ClaseConexion.ResolverConsulta(query2)); } catch (SqlException) { MessageBox.Show("Error al tratar de cambiar el nombre", "Ok"); } } }
private void button2_Click(object sender, EventArgs e) { try { String query = "select coalesce(ESTADO_RECORRIDO,'A') from ZAFFA_TEAM.Recorrido_Unico where RECORRIDO_CODIGO = " + Decimal.Parse(codRecorrido).ToString(); SqlDataReader reader = ClaseConexion.ResolverConsulta(query); reader.Read(); if (String.Compare(reader.GetString(0), "I") == 0) { MessageBox.Show("Ya se encuentra inhabilitado"); reader.Close(); return; } reader.Close(); this.darDeBajaRecorrido(); MessageBox.Show("Se dio de baja corretamente"); AbmRecorrido abmRecorrido = new AbmRecorrido(rolSeleccionado); abmRecorrido.Visible = true; this.Dispose(false); } catch (SqlException) { MessageBox.Show("Volver a intentar", "Error"); } }
private void Llenar_ComboBox1() { if (contAct == 1) { string query = "select NOMBRE_PUERTO from ZAFFA_TEAM.Puerto"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { string puerto = reader.GetString(0).Trim(); puertoDesdeBox.Items.Add(puerto); } reader.Close(); } else { string query2 = "select NOMBRE_PUERTO from ZAFFA_TEAM.Puerto WHERE NOMBRE_PUERTO = '" + puertoHastaID + "'"; SqlDataReader reader2 = ClaseConexion.ResolverConsulta(query2); while (reader2.Read()) { string puerto = reader2.GetString(0).Trim(); puertoDesdeBox.Items.Add(puerto); } reader2.Close(); } }
private void generarCompra() { if (CODIGO_RESERVA != "") { int numRegs = ClaseConexion.ResolverNonQuery("delete from ZAFFA_TEAM.Reserva where RESERVA_CODIGO = " + CODIGO_RESERVA); SqlCommand cmd = new SqlCommand("ZAFFA_TEAM.sp_generarPasaje", ClaseConexion.conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@precio", this.precio); cmd.Parameters.AddWithValue("@cliente_id", this.cli_id); cmd.Parameters.AddWithValue("@viaje_id", this.viajeID); cmd.Parameters.AddWithValue("@crucero_id", this.crucero_id); cmd.Parameters.AddWithValue("@cabina_nro", this.cabina_nro); cmd.Parameters.AddWithValue("@cabina_piso", this.cabina_piso); cmd.Parameters.AddWithValue("@medio_pago", MEDIOS_DE_PAGO.Text + " - " + TIPO_TARJETA.Text); cmd.ExecuteReader().Close(); } else { SqlCommand cmd = new SqlCommand("ZAFFA_TEAM.sp_generarPasaje", ClaseConexion.conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@precio", this.precio); cmd.Parameters.AddWithValue("@cliente_id", this.cli_id); cmd.Parameters.AddWithValue("@viaje_id", this.viajeID); cmd.Parameters.AddWithValue("@crucero_id", this.crucero_id); cmd.Parameters.AddWithValue("@cabina_nro", this.cabina_nro); cmd.Parameters.AddWithValue("@cabina_piso", this.cabina_piso); cmd.Parameters.AddWithValue("@medio_pago", MEDIOS_DE_PAGO.Text + " - " + TIPO_TARJETA.Text); cmd.ExecuteReader().Close(); } }
private void buscarListadoRol_Click(object sender, EventArgs e) { listadoRoles.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.Rol WHERE nombre_rol LIKE '%" + rolTipo.Text + "%'"; cargarRoles(ClaseConexion.ResolverConsulta(query)); }
private void button1_Click(object sender, EventArgs e) { listadoCruceros.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.Crucero "; cargarCruceros(ClaseConexion.ResolverConsulta(query)); }
private void button6_Click(object sender, EventArgs e) { Listadoxfunc.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.[Funcionalidad x Rol] WHERE nombre_rol LIKE '%" + nom + "%'"; cargarFuncionalidad(ClaseConexion.ResolverConsulta(query)); }
private void button2_Click(object sender, EventArgs e) { listadoPuertos.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.Puerto WHERE PUERTO_ID LIKE '%" + seleccionarID.Text + "%'" + "and NOMBRE_PUERTO LIKE '%" + seleccionarNombre.Text + "%'"; cargarPuertos(ClaseConexion.ResolverConsulta(query)); }
private void button1_Click(object sender, EventArgs e) { listaBaja.Rows.Clear(); string query = "SELECT RECORRIDO_CODIGO, ESTADO_RECORRIDO FROM ZAFFA_TEAM.Recorrido_unico WHERE RECORRIDO_CODIGO LIKE '" + idRecorrido.Text + "%'"; cargarRecorridos(ClaseConexion.ResolverConsulta(query)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //MessageBox.Show("Se intenta realizar la conexion."); ClaseConexion.Conectar(); Application.Run(new PantallaPrincipal()); }
private void button5_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow row in listadoAgregar.SelectedRows) { nombr = row.Cells[0].Value.ToString(); func = row.Cells[1].Value.ToString(); nombre_func = row.Cells[2].Value.ToString(); try { try { string query = "SELECT FUNCIONALIDAD FROM ZAFFA_TEAM.Funcionalidad WHERE descripcion_func LIKE '%" + nombre_func + "%'"; obtenerIdFunc(ClaseConexion.ResolverConsulta(query)); this.guardarFuncxRol(); } catch (SqlException) { MessageBox.Show("Error al guardar la funcionalidad " + nombre_func + " del rol pues ya existe", "Ok"); } listadoAgregar.Rows.Clear(); string query2 = "SELECT FUNCIONALIDAD FROM ZAFFA_TEAM.Funcionalidad EXCEPT SELECT fr.FUNCIONALIDAD FROM ZAFFA_TEAM.[Funcionalidad x Rol] fr JOIN ZAFFA_TEAM.Funcionalidad f ON fr.FUNCIONALIDAD = f.FUNCIONALIDAD where NOMBRE_ROL LIKE '" + nom + "'"; cargarFuncionalidadAgregar(ClaseConexion.ResolverConsulta(query2)); listadoAgregar.Rows.Clear(); Listadoxfunc.Rows.Clear(); string query3 = "SELECT FUNCIONALIDAD FROM ZAFFA_TEAM.Funcionalidad EXCEPT SELECT fr.FUNCIONALIDAD FROM ZAFFA_TEAM.[Funcionalidad x Rol] fr JOIN ZAFFA_TEAM.Funcionalidad f ON fr.FUNCIONALIDAD = f.FUNCIONALIDAD where NOMBRE_ROL LIKE '" + nom + "'"; cargarFuncionalidadAgregar(ClaseConexion.ResolverConsulta(query3)); string query4 = "SELECT * FROM ZAFFA_TEAM.[Funcionalidad x Rol] WHERE nombre_rol LIKE '" + nom + "'"; cargarFuncionalidad(ClaseConexion.ResolverConsulta(query4)); } catch (SqlException) { MessageBox.Show("Error al tratar de agregar el rol", "Ok"); } } try { listadoAgregar.CurrentCell.RowIndex.ToString(); } catch (NullReferenceException) { MessageBox.Show("Por favor seleccione alguna fila", "Ok"); } } catch (NullReferenceException) { MessageBox.Show("Por favor seleccione alguna fila válida", "Ok"); } }
private void Llenar_ComboBox2() { string query = "select NOMBRE_PUERTO from ZAFFA_TEAM.Puerto"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { string puerto = reader.GetString(0).Trim(); puertoHasta.Items.Add(puerto); } reader.Close(); }
private void Llenar_ComboBox_Funcionalidades() { string query = "select b.DESCRIPCION_FUNC from ZAFFA_TEAM.[Funcionalidad x Rol] a JOIN ZAFFA_TEAM.Funcionalidad b ON a.FUNCIONALIDAD = b.FUNCIONALIDAD where NOMBRE_ROL = '" + this.rolSeleccionado + "'"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { string a = reader.GetString(0); selectorFunc.Items.Add(a); } reader.Close(); }
private void Llenar_ComboBox_Tramos() { string query = "select * from ZAFFA_TEAM.Recorrido_Unico WHERE ESTADO_RECORRIDO = 'A'"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { decimal tramo = reader.GetDecimal(0); tramos.Items.Add(tramo); } reader.Close(); }
private void Llenar_ComboBox_Roles() { string query = "select NOMBRE_ROL from ZAFFA_TEAM.Rol where ESTADO_ROL = 'A'"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { string a = reader.GetString(0); selectorRol.Items.Add(a); } reader.Close(); }
private void modificarListadoRol_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow row in listadoRoles.SelectedRows) { nombr = row.Cells[0].Value.ToString(); estado = row.Cells[1].Value.ToString(); if (unListado) { ModificarRol modificar = new ModificarRol(nombr, estado, rolSeleccionado); modificar.Visible = true; this.Dispose(false); } else { if (string.Compare(estado, "A") == 0) { //doy de baja logica try { this.guardarInhab(nombr); listadoRoles.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.Rol WHERE nombre_rol LIKE '%" + rolTipo.Text + "%'"; cargarRoles(ClaseConexion.ResolverConsulta(query)); MessageBox.Show("Rol dado de baja", "Ok"); } catch (SqlException) { MessageBox.Show("Error al tratar de inhabilitar el rol", "Ok"); } } else { MessageBox.Show("Dicho rol ya se encuentra inhabilitado", "Ok"); } } } try { listadoRoles.CurrentCell.RowIndex.ToString(); } catch (NullReferenceException) { MessageBox.Show("Por favor seleccione alguna fila", "Ok"); } } catch (NullReferenceException) { MessageBox.Show("Por favor seleccione alguna fila válida", "Ok"); } }
private void ingresar_Click(object sender, EventArgs e) { string query = "SELECT USERNAME FROM ZAFFA_TEAM.Administrativo WHERE USERNAME = '******' AND ESTADO_ADMIN != 'I'"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); // while (reader.Read()) // { if (reader.Read()) { reader.Close(); SqlCommand cmd = new SqlCommand("ZAFFA_TEAM.sp_login", ClaseConexion.conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@usuario", usuario.Text); cmd.Parameters.AddWithValue("@password", contraseña.Text); cmd.ExecuteReader().Close(); string query2 = "SELECT ESTADO_ADMIN,INTENTOS_FALLIDOS FROM ZAFFA_TEAM.Administrativo WHERE USERNAME = '******'"; SqlDataReader reader2 = ClaseConexion.ResolverConsulta(query2); reader2.Read(); string ESTADO = reader2.GetString(0); string INTENTOS_FALLIDOS = reader2.GetSqlInt16(1).ToString(); reader2.Close(); if (ESTADO == "I") { MessageBox.Show("Ha ingresado la contraseña incorrecta 3 veces, usted ha sido inhabilitado "); usuario.ResetText(); contraseña.ResetText(); } else if (INTENTOS_FALLIDOS != "0") { MessageBox.Show("Ha ingresado la contraseña incorrecta"); usuario.ResetText(); contraseña.ResetText(); } else { MessageBox.Show("Bienvenido " + usuario.Text); Funcionalidades func = new Funcionalidades("Administrador General"); func.Visible = true; this.Dispose(false); this.Close(); } } else { reader.Close(); MessageBox.Show("El usuario ingresado no se encuentra registrado o habilitado"); usuario.ResetText(); contraseña.ResetText(); } }
private int ContadorDeTramos() { string query3 = "select count(RECORRIDO_CODIGO) nroRecorridos from ZAFFA_TEAM.Tramo where RECORRIDO_CODIGO =" + codRecorrido; SqlDataReader reader = ClaseConexion.ResolverConsulta(query3); reader.Read(); String cuantosRecorridos = reader.GetInt32(0).ToString(); reader.Close(); return(int.Parse(cuantosRecorridos)); }
private void BTN_TRAMOS_Click(object sender, EventArgs e) { String query = "select c.NOMBRE_PUERTO, d.NOMBRE_PUERTO from ZAFFA_TEAM.Viaje a join ZAFFA_TEAM.Tramo b on a.RECORRIDO_CODIGO = b.RECORRIDO_CODIGO join ZAFFA_TEAM.Puerto c on b.PUERTO_DESDE_ID = c.PUERTO_ID join ZAFFA_TEAM.Puerto d on b.PUERTO_HASTA_ID = d.PUERTO_ID WHERE VIAJE_ID=" + viajeID; SqlDataReader reader3 = ClaseConexion.ResolverConsulta(query); string tramos = ""; while (reader3.Read()) { tramos = tramos + " > " + reader3.GetString(0) + " - " + reader3.GetString(1) + " \n"; } reader3.Close(); MessageBox.Show("Los tramos del viaje seleccionado son: \n" + tramos); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4 && dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString() != "") { dataGridView1.CurrentRow.Selected = true; String viaje_Id = dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString(); String crucero_Id = dataGridView1.Rows[e.RowIndex].Cells[1].FormattedValue.ToString(); string query = "select FECHA_SALIDA,FECHA_LLEGADA from ZAFFA_TEAM.Viaje where VIAJE_ID = " + viaje_Id; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); reader.Read(); fecha_salida = reader.GetDateTime(0).ToString(); fecha_llegada = reader.GetDateTime(1).ToString(); reader.Close(); CabinasDisponibles cabi = new CabinasDisponibles(viaje_Id, fecha_salida, fecha_llegada, crucero_Id, this.rolSeleccionado); cabi.Visible = true; this.Dispose(false); this.Close(); } if (e.ColumnIndex == 2 && dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString() != "") { dataGridView1.CurrentRow.Selected = true; String viaje_Id = dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString(); string query3 = "select c.NOMBRE_PUERTO, d.NOMBRE_PUERTO from ZAFFA_TEAM.Viaje a join ZAFFA_TEAM.Tramo b on a.RECORRIDO_CODIGO = b.RECORRIDO_CODIGO join ZAFFA_TEAM.Puerto c on b.PUERTO_DESDE_ID = c.PUERTO_ID join ZAFFA_TEAM.Puerto d on b.PUERTO_HASTA_ID = d.PUERTO_ID WHERE VIAJE_ID=" + viaje_Id; SqlDataReader reader3 = ClaseConexion.ResolverConsulta(query3); string tramos = ""; while (reader3.Read()) { tramos = tramos + " > " + reader3.GetString(0) + " - " + reader3.GetString(1) + " \n"; } reader3.Close(); MessageBox.Show("Los tramos del viaje seleccionado son: \n" + tramos); dataGridView1.CurrentRow.Selected = false; } if (e.ColumnIndex == 3 && dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString() != "") { dataGridView1.CurrentRow.Selected = true; String viaje_Id = dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString(); string query3 = "SELECT FECHA_SALIDA, FECHA_LLEGADA FROM ZAFFA_TEAM.Viaje WHERE VIAJE_ID = " + viaje_Id; SqlDataReader reader3 = ClaseConexion.ResolverConsulta(query3); string fechas_viaje = ""; reader3.Read(); fechas_viaje = "El viaje posee las siguientes fechas: \n" + " > FECHA SALIDA: " + reader3.GetDateTime(0).ToString("yyyy-MM-dd") + " \n" + " > FECHA LLEGADA: " + reader3.GetDateTime(1).ToString("yyyy-MM-dd"); reader3.Close(); MessageBox.Show(fechas_viaje); dataGridView1.CurrentRow.Selected = false; } }
private void buscarListado_Click(object sender, EventArgs e) { listadoCruceros.Rows.Clear(); string query = "SELECT * FROM ZAFFA_TEAM.Crucero WHERE crucero_id LIKE '%" + seleccionarID.Text + "%'" + "and crucero_modelo LIKE '%" + seleccionarModelo.Text + "%'"; if (string.Compare(seleccionarFabricante.Text, "") != 0) { string query2 = "SELECT CRUCERO_MARCA_ID FROM ZAFFA_TEAM.Marca WHERE crucero_fabricante LIKE '%" + seleccionarFabricante.Text + "%'"; obtenerIdFab(ClaseConexion.ResolverConsulta(query2)); query += " and crucero_marca_id LIKE '%" + id + "%'"; //para evitar un NullPointerExc } cargarCruceros(ClaseConexion.ResolverConsulta(query)); }
private void button2_Click(object sender, EventArgs e) { if (dataGridView1.Rows[0].Cells[0].FormattedValue.ToString() != "") { string query3 = "select c.NOMBRE_PUERTO, d.NOMBRE_PUERTO from ZAFFA_TEAM.Viaje a join ZAFFA_TEAM.Tramo b on a.RECORRIDO_CODIGO = b.RECORRIDO_CODIGO join ZAFFA_TEAM.Puerto c on b.PUERTO_DESDE_ID = c.PUERTO_ID join ZAFFA_TEAM.Puerto d on b.PUERTO_HASTA_ID = d.PUERTO_ID WHERE VIAJE_ID=" + viajeID; SqlDataReader reader3 = ClaseConexion.ResolverConsulta(query3); string tramos = ""; while (reader3.Read()) { tramos = tramos + " > " + reader3.GetString(0) + " - " + reader3.GetString(1) + " \n"; } reader3.Close(); MessageBox.Show("Los tramos del viaje seleccionado son: \n" + tramos); } }
private void button1_Click(object sender, EventArgs e) { listaRecorrido.Rows.Clear(); if (idRecorrido.Text == "" && puerto.Text == "" && precio.Text == "") { string query = "select t.RECORRIDO_CODIGO, ORDEN_TRAMOS, p.NOMBRE_PUERTO, p2.NOMBRE_PUERTO, RECORRIDO_PRECIO_BASE, ESTADO_RECORRIDO from ZAFFA_TEAM.Tramo t JOIN ZAFFA_TEAM.Puerto p ON (t.PUERTO_DESDE_ID = p.PUERTO_ID) JOIN ZAFFA_TEAM.Puerto p2 ON (t.PUERTO_HASTA_ID = p2.PUERTO_ID) JOIN ZAFFA_TEAM.Recorrido_Unico ru ON (t.RECORRIDO_CODIGO = ru.RECORRIDO_CODIGO) WHERE t.RECORRIDO_CODIGO LIKE '" + idRecorrido.Text + "%'" + " and (p.NOMBRE_PUERTO like" + "'%" + puerto.Text + "%'" + " or p2.NOMBRE_PUERTO LIKE '%" + puerto.Text + "%'" + ") and RECORRIDO_PRECIO_BASE LIKE '" + precio.Text + "%'"; cargarRecorridos(ClaseConexion.ResolverConsulta(query)); } else { string query2 = "select t.RECORRIDO_CODIGO, ORDEN_TRAMOS, p.NOMBRE_PUERTO, p2.NOMBRE_PUERTO, RECORRIDO_PRECIO_BASE, ESTADO_RECORRIDO from ZAFFA_TEAM.Tramo t JOIN ZAFFA_TEAM.Puerto p ON (t.PUERTO_DESDE_ID = p.PUERTO_ID) JOIN ZAFFA_TEAM.Puerto p2 ON (t.PUERTO_HASTA_ID = p2.PUERTO_ID) JOIN ZAFFA_TEAM.Recorrido_Unico ru ON (t.RECORRIDO_CODIGO = ru.RECORRIDO_CODIGO) WHERE t.RECORRIDO_CODIGO LIKE '" + idRecorrido.Text + "%'" + " and (p.NOMBRE_PUERTO like" + "'" + puerto.Text + "%'" + " or p2.NOMBRE_PUERTO LIKE '" + puerto.Text + "%'" + ") and RECORRIDO_PRECIO_BASE LIKE '" + precio.Text + "%'"; cargarRecorridos(ClaseConexion.ResolverConsulta(query2)); } }
private void agregarCabinasLibres(String viaje_id, String crucero_id) { int contador = 0; string a = "select CABINA_NRO,CABINA_PISO,b.CABINA_TIPO_DESCRIPCION from ZAFFA_TEAM.Cabina a JOIN ZAFFA_TEAM.Tipo_Cabina b on a.CABINA_TIPO_ID = b.CABINA_TIPO_ID where CRUCERO_ID = '" + crucero_id + "'"; string b = "select a.CABINA_NRO,a.CABINA_PISO,d.CABINA_TIPO_DESCRIPCION from ZAFFA_TEAM.Pasaje a join ZAFFA_TEAM.Cabina c on a.CRUCERO_ID = c.CRUCERO_ID and a.CABINA_NRO = c.CABINA_NRO and a.CABINA_PISO = c.CABINA_PISO join ZAFFA_TEAM.Tipo_Cabina d on c.CABINA_TIPO_ID = d.CABINA_TIPO_ID where a.CRUCERO_ID = '" + crucero_id + "' and a.VIAJE_ID= " + viaje_id; string c = "select a.CABINA_NRO,a.CABINA_PISO,d.CABINA_TIPO_DESCRIPCION from ZAFFA_TEAM.Reserva a join ZAFFA_TEAM.Cabina c on a.CRUCERO_ID = c.CRUCERO_ID and a.CABINA_NRO = c.CABINA_NRO and a.CABINA_PISO = c.CABINA_PISO join ZAFFA_TEAM.Tipo_Cabina d on c.CABINA_TIPO_ID = d.CABINA_TIPO_ID where a.CRUCERO_ID = '" + crucero_id + "' and a.VIAJE_ID= " + viaje_id; string query = a + " EXCEPT " + b + " EXCEPT " + c; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); while (reader.Read()) { dataGridView1.Rows.Add(reader.GetDecimal(0).ToString(), reader.GetDecimal(1).ToString(), reader.GetString(2)); contador++; } reader.Close(); textBox1.Text = contador.ToString(); }
private void init() { textBox2.Text = viajeID; textBox3.Text = fecha_salida; textBox4.Text = fecha_llegada; textBox5.Text = cli_apellido + ", " + cli_nombre; textBox6.Text = cli_dni; textBox7.Text = crucero_id; textBox8.Text = cabina_nro; textBox9.Text = cabina_piso; textBox11.Text = precio.ToString(); String fechaProceso = ConfigurationManager.AppSettings["current_date"].ToString().TrimEnd(); DateTime date = DateTime.ParseExact(fechaProceso, "dd-MM-yyyy", null); String fecha_actual = date.ToString("yyyy-MM-dd"); //label18.Text = "FECHA ACTUAL: " + date.ToString().Substring(0, 10); SqlCommand cmd = new SqlCommand("ZAFFA_TEAM.sp_crearReserva", ClaseConexion.conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CLI_ID", this.cli_id); cmd.Parameters.AddWithValue("@VIAJE_ID", this.viajeID); cmd.Parameters.AddWithValue("@CRUCERO_ID", this.crucero_id); cmd.Parameters.AddWithValue("@CABINA_NRO", this.cabina_nro); cmd.Parameters.AddWithValue("@CABINA_PISO", this.cabina_piso); cmd.Parameters.AddWithValue("@FECHA_ACTUAL", fecha_actual); cmd.ExecuteReader().Close(); string query = "select max(RESERVA_CODIGO) from ZAFFA_TEAM.Reserva"; SqlDataReader reader = ClaseConexion.ResolverConsulta(query); reader.Read(); textBox1.Text = reader.GetDecimal(0).ToString(); reader.Close(); query = "select cabina_tipo_descripcion from ZAFFA_TEAM.Cabina a join ZAFFA_TEAM.Tipo_Cabina b on a.CABINA_TIPO_ID = b.CABINA_TIPO_ID where CABINA_NRO = " + this.cabina_nro + " and CABINA_PISO = " + this.cabina_piso + " and CRUCERO_ID = '" + this.crucero_id + "'"; SqlDataReader reader2 = ClaseConexion.ResolverConsulta(query); reader2.Read(); textBox10.Text = reader2.GetString(0); reader2.Close(); }