private void dgvLista_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            switch (tipoSeleccionado)
            {
            case 1:     //Para el nombre de la categoria
                CategoriaWS.categoria dataCate = dgvLista.Rows[e.RowIndex].DataBoundItem as CategoriaWS.categoria;

                dgvLista.Rows[e.RowIndex].Cells["Id"].Value     = dataCate.categoriaId;
                dgvLista.Rows[e.RowIndex].Cells["Nombre"].Value = dataCate.nombre;
                break;

            case 2:     //Para el nombre de la urgencia
                UrgenciaWS.urgencia dataUrge = dgvLista.Rows[e.RowIndex].DataBoundItem as UrgenciaWS.urgencia;

                dgvLista.Rows[e.RowIndex].Cells["Id"].Value     = dataUrge.urgenciaId;
                dgvLista.Rows[e.RowIndex].Cells["Nombre"].Value = dataUrge.nombre;
                break;

            case 3:     //Para el nombre de la agente
                AgenteWS.agente dataAgen = dgvLista.Rows[e.RowIndex].DataBoundItem as AgenteWS.agente;

                dgvLista.Rows[e.RowIndex].Cells["Id"].Value     = dataAgen.agenteId;
                dgvLista.Rows[e.RowIndex].Cells["Nombre"].Value = dataAgen.nombre + " " + dataAgen.apellidoPaterno + " " + dataAgen.apellidoMaterno;
                break;

            case 4:     //Para el nombre de la equipo
                EquipoWS.equipo dataEqui = dgvLista.Rows[e.RowIndex].DataBoundItem as EquipoWS.equipo;

                dgvLista.Rows[e.RowIndex].Cells["Id"].Value     = dataEqui.equipoId;
                dgvLista.Rows[e.RowIndex].Cells["Nombre"].Value = dataEqui.nombre;
                break;
            }
        }
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            try
            {
                ReporteWS.ReporteWSClient daoReporte = new ReporteWS.ReporteWSClient();
                byte[] arreglo;
                switch (tipoSeleccionado)
                {
                case 1:     //Para el nombre de la categoria
                    sfdReporte.ShowDialog();
                    categoria = (CategoriaWS.categoria)dgvLista.CurrentRow.DataBoundItem;
                    ReporteWS.categoria cate = new ReporteWS.categoria();
                    cate.categoriaId = categoria.categoriaId;
                    cate.nombre      = categoria.nombre;
                    cate.descripcion = categoria.descripcion;
                    cate.activo      = categoria.activo;
                    arreglo          = daoReporte.generarReporteTicketCategoria(cate, dtpFechaInicio.Value.Date, dtpFechaFin.Value.Date.AddHours(23).AddMinutes(59));
                    File.WriteAllBytes(sfdReporte.FileName + ".pdf", arreglo);
                    MessageBox.Show("Se ha guardado con exito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;

                case 2:     //Para el nombre de la urgencia
                    sfdReporte.ShowDialog();
                    urgencia = (UrgenciaWS.urgencia)dgvLista.CurrentRow.DataBoundItem;
                    ReporteWS.urgencia urge = new ReporteWS.urgencia();
                    urge.urgenciaId  = urgencia.urgenciaId;
                    urge.nombre      = urgencia.nombre;
                    urge.plazoMaximo = urgencia.plazoMaximo;
                    urge.activo      = urgencia.activo;
                    arreglo          = daoReporte.generarReporteTicketUrgencia(urge, dtpFechaInicio.Value.Date, dtpFechaFin.Value.Date.AddHours(23).AddMinutes(59));
                    File.WriteAllBytes(sfdReporte.FileName + ".pdf", arreglo);
                    MessageBox.Show("Se ha guardado con exito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;

                case 3:     //Para el nombre de la agente
                    sfdReporte.ShowDialog();
                    agente = (AgenteWS.agente)dgvLista.CurrentRow.DataBoundItem;
                    ReporteWS.agente age = new ReporteWS.agente();
                    age.agenteId        = agente.agenteId;
                    age.nombre          = agente.nombre;
                    age.apellidoPaterno = agente.apellidoPaterno;
                    age.apellidoMaterno = agente.apellidoMaterno;
                    age.codigo          = agente.codigo;
                    age.activo          = agente.activo;
                    arreglo             = daoReporte.generarReporteTicketAgente(age, dtpFechaInicio.Value.Date, dtpFechaFin.Value.Date.AddHours(23).AddMinutes(59));
                    File.WriteAllBytes(sfdReporte.FileName + ".pdf", arreglo);
                    MessageBox.Show("Se ha guardado con exito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;

                case 4:     //Para el nombre de la equipo
                    sfdReporte.ShowDialog();
                    equipo = (EquipoWS.equipo)dgvLista.CurrentRow.DataBoundItem;
                    ReporteWS.equipo equi = new ReporteWS.equipo();
                    equi.equipoId    = equipo.equipoId;
                    equi.nombre      = equipo.nombre;
                    equi.descripcion = equipo.descripcion;
                    arreglo          = daoReporte.generarReporteTicketEquipo(equi, dtpFechaInicio.Value.Date, dtpFechaFin.Value.Date.AddHours(23).AddMinutes(59));
                    File.WriteAllBytes(sfdReporte.FileName + ".pdf", arreglo);
                    MessageBox.Show("Se ha guardado con exito", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error", "Mensaje: " + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }