public List <ElementoInforme> seleccionarElementos(int tipoIncidente) { List <ElementoInforme> informes = new List <ElementoInforme>(); MySqlConnection con = ConexionABD.conectar(); String consulta = "SELECT CONCAT(nombre, ' ', apellidos) As Nombre, estado, edad, sexo, fecha, horaSalida FROM paciente INNER JOIN (SELECT fecha, horaSalida, Paciente_idPaciente from reporte_incidente where tipoIncidente_idtipoIncidente = " + tipoIncidente.ToString() + ") as infomeIncidente where Paciente_idPaciente = idPaciente; "; MySqlCommand comando = new MySqlCommand(string.Format(consulta)); IDataReader data = if (data != null) { while (data.Read()) { ElementoInforme elemento = new ElementoInforme(); elemento.nombre = data.GetString(0); if (data.GetString(1) == "viva") { elemento.vivo = "X"; } else { elemento.fallecido = "X"; } elemento.edad = data.GetString(2); elemento.sexo = data.GetString(3); elemento.fecha = data.GetString(4); elemento.hora = data.GetString(5); informes.Add(elemento); } } return(informes); }
public void crearInforme(int Tipo, DateTime fechaInicio, DateTime fechaFinal) { Bombero director = new Bombero(); director.nombre = "Rene Anselmo"; director.apellido = "Perez Perez"; Bombero secretario = new Bombero(); secretario.nombre = "Juan Luis"; secretario.apellido = "Paz Paz"; string path = Directory.GetCurrentDirectory(); string ubicacion = path + "/prueba.pdf"; ElementoInforme elementoInforme = new ElementoInforme(); List <ElementoInforme> elementosInforme = elementoInforme.seleccionarElementos(10); crearPDF("Accidentes de Transito", fechaInicio, fechaFinal, elementosInforme, director, secretario, ubicacion); Process.Start(ubicacion); }