private void CargarGestion()
        {
            List <gestion_laboral> ListaGestionLaboral = new List <gestion_laboral>();

            ListaGestionLaboral = Mgr_GestionLaboral.Get_GestionLaboral(Convert.ToInt32(idGestion));

            foreach (var itemGestionLaboral in ListaGestionLaboral)
            {
                int ContadorTrabajadores = 0;

                #region 1erbloque consulta
                lbEmpresa.Text = Convert.ToString(itemGestionLaboral.usuario.trabajador.puesto_trabajo.area.sucursal.empresa.nombre);

                lbFecha.Text = Convert.ToString(itemGestionLaboral.fecha);

                lbDesc.Text = itemGestionLaboral.descripcion;

                if (itemGestionLaboral.tipo_gestion == 2)
                {
                    phCapacitacion.Visible = true;
                }

                lbHoras.Text = Convert.ToString(itemGestionLaboral.cant_horas);

                lbResponsable.Text = Convert.ToString(itemGestionLaboral.usuario.login);

                hpSoporte.NavigateUrl = itemGestionLaboral.soporte;

                #endregion

                #region 2do bloque consulta
                List <trabajador_gestion> ListaTrabajadorGestion = Mgr_Trabajador.Get_TrabajadorInGestion(0, Convert.ToInt32(idGestion));

                ControlesDinamicos.CrearLiteral("<div class='row'>", pListaTrab);
                foreach (var item in ListaTrabajadorGestion)
                {
                    string ruta = item.trabajador.foto;
                    ruta = ruta.Replace("~/source", "../..");

                    ContadorTrabajadores++;
                    ControlesDinamicos.CrearLiteral("" +
                                                    "<div class='col-md-2'>" +
                                                    "<img class='img-circle' src='" + ruta + "' width='128' height='128'/>" +
                                                    "<h4 class='text-info text-left'>Trabajador " + ContadorTrabajadores + "</h4>" +
                                                    "<div class='col-md-12 text'>" +
                                                    "<h4>Nombre: </h4>" +
                                                    "</div>" +
                                                    "<div class='col-md-10 text'>" +
                                                    "" + item.trabajador.primer_nombre + " " + item.trabajador.primer_apellido + "" +
                                                    "</div>" +
                                                    "</div>", pListaTrab);
                }
                ControlesDinamicos.CrearLiteral("</div>", pListaTrab);
                #endregion
            }
        }
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals(ComandosGrid.Editar.Value))
            {
                int         RowIndex = Convert.ToInt32((e.CommandArgument).ToString());
                GridViewRow gvrow    = GridView1.Rows[RowIndex];
                string      tipo     = (gvrow.FindControl("tipo") as Label).Text;

                foreach (ListItem item in chkTrabajadores.Items)
                {
                    item.Selected = false;
                }

                if (tipo == "1")
                {
                    hdfEditEntregaID.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                    List <gestion_laboral> EditCapacitacion = new List <gestion_laboral>();
                    EditCapacitacion = Mgr_GestionLaboral.Get_GestionLaboral(Convert.ToInt32(hdfEditEntregaID.Value));

                    foreach (var item in EditCapacitacion)
                    {
                        int idEmpresa  = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.sucursal.id_empresa);
                        int idSucursal = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.id_sucursal);
                        int idUsuario  = Convert.ToInt32(item.id_usuario);
                        ddlEmpEditEnt.SelectedValue = idEmpresa.ToString();

                        Mgr_Sucursal.Lista_Sucursal(ddlSucEditEnt, idEmpresa);
                        ddlSucEditEnt.SelectedValue = idSucursal.ToString();

                        chkTrabajadores.Items.Clear();
                        Cargartrabajadores(idSucursal);
                        Mgr_Usuario.Lista_UsuarioBySucursal(ddlUsuEditEnt, idSucursal);
                        ddlUsuEditEnt.SelectedValue = idUsuario.ToString();

                        DateTime fechaGestion = Convert.ToDateTime(Convert.ToString(item.fecha));
                        txtFechaEditEntrega.Text = fechaGestion.ToString("yyyy-MM-dd");

                        txtDescEditEntrega.Text = item.descripcion;

                        List <trabajador_gestion> _listatrab = Mgr_Trabajador.Get_TrabajadorInGestion(0, Convert.ToInt32(hdfEditEntregaID.Value));

                        foreach (var trab in _listatrab)
                        {
                            if (chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()) != null)
                            {
                                chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()).Selected = true;
                            }
                        }
                    }

                    Modal.registrarModal("EditEntrega", "EditModalScript", this);
                }
                else if (tipo == "3")
                {
                    hdfEditJornadaID.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                    List <gestion_laboral> EditJornada = new List <gestion_laboral>();
                    EditJornada = Mgr_GestionLaboral.Get_GestionLaboral(Convert.ToInt32(hdfEditJornadaID.Value));

                    foreach (var item in EditJornada)
                    {
                        int idEmpresa  = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.sucursal.id_empresa);
                        int idSucursal = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.id_sucursal);
                        int idUsuario  = Convert.ToInt32(item.id_usuario);
                        ddlEmpEditJor.SelectedValue = idEmpresa.ToString();

                        Mgr_Sucursal.Lista_Sucursal(ddlSucEditJor, idEmpresa);
                        ddlSucEditJor.SelectedValue = idSucursal.ToString();

                        chkTrabajadores.Items.Clear();
                        Cargartrabajadores(idSucursal);
                        Mgr_Usuario.Lista_UsuarioBySucursal(ddlUsuEditJor, idSucursal);
                        ddlUsuEditJor.SelectedValue = idUsuario.ToString();

                        DateTime fechaGestion = Convert.ToDateTime(Convert.ToString(item.fecha));
                        txtFechaEditJornada.Text = fechaGestion.ToString("yyyy-MM-dd");

                        txtDescEditJornada.Text = item.descripcion;

                        List <trabajador_gestion> _listatrab = Mgr_Trabajador.Get_TrabajadorInGestion(0, Convert.ToInt32(hdfEditJornadaID.Value));

                        foreach (var trab in _listatrab)
                        {
                            if (chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()) != null)
                            {
                                chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()).Selected = true;
                            }
                        }
                    }

                    Modal.registrarModal("EditJornada", "EditModalScript", this);
                }
                else if (tipo == "4")
                {
                    hdfEditActividadID.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                    List <gestion_laboral> EditActividad = new List <gestion_laboral>();
                    EditActividad = Mgr_GestionLaboral.Get_GestionLaboral(Convert.ToInt32(hdfEditActividadID.Value));

                    foreach (var item in EditActividad)
                    {
                        int idEmpresa  = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.sucursal.id_empresa);
                        int idSucursal = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.id_sucursal);
                        int idUsuario  = Convert.ToInt32(item.id_usuario);
                        ddlEmpEditAct.SelectedValue = idEmpresa.ToString();

                        Mgr_Sucursal.Lista_Sucursal(ddlSucEditAct, idEmpresa);
                        ddlSucEditAct.SelectedValue = idSucursal.ToString();

                        chkTrabajadores.Items.Clear();
                        Cargartrabajadores(idSucursal);
                        Mgr_Usuario.Lista_UsuarioBySucursal(ddlUsuEditAct, idSucursal);
                        ddlUsuEditAct.SelectedValue = idUsuario.ToString();

                        DateTime fechaGestion = Convert.ToDateTime(Convert.ToString(item.fecha));
                        txtFechaEditActividad.Text = fechaGestion.ToString("yyyy-MM-dd");

                        txtDescEditActividad.Text = item.descripcion;

                        List <trabajador_gestion> _listatrab = Mgr_Trabajador.Get_TrabajadorInGestion(0, Convert.ToInt32(hdfEditActividadID.Value));

                        foreach (var trab in _listatrab)
                        {
                            if (chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()) != null)
                            {
                                chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()).Selected = true;
                            }
                        }
                    }
                    Modal.registrarModal("EditActividad", "EditModalScript", this);
                }
                else if (tipo == "2")
                {
                    hdfEditCapacitacionID.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                    Modal.registrarModal("EditCapacitacion", "EditModalScript", this);


                    List <gestion_laboral> EditCapacitacion = new List <gestion_laboral>();
                    EditCapacitacion = Mgr_GestionLaboral.Get_GestionLaboral(Convert.ToInt32(hdfEditCapacitacionID.Value));

                    foreach (var item in EditCapacitacion)
                    {
                        int idEmpresa  = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.sucursal.id_empresa);
                        int idSucursal = Convert.ToInt32(item.usuario.trabajador.puesto_trabajo.area.id_sucursal);
                        int idUsuario  = Convert.ToInt32(item.id_usuario);
                        ddlEmpEditCap.SelectedValue = idEmpresa.ToString();

                        Mgr_Sucursal.Lista_Sucursal(ddlSucEditCap, idEmpresa);
                        ddlSucEditCap.SelectedValue = idSucursal.ToString();

                        chkTrabajadores.Items.Clear();
                        Cargartrabajadores(idSucursal);
                        Mgr_Usuario.Lista_UsuarioBySucursal(ddlUsuEditCap, idSucursal);
                        ddlUsuEditCap.SelectedValue = idUsuario.ToString();

                        DateTime fechaGestion = Convert.ToDateTime(Convert.ToString(item.fecha));
                        txtFechaEditCapacitacion.Text = fechaGestion.ToString("yyyy-MM-dd");

                        txtDesCapEdit.Text            = item.descripcion;
                        txtObjCapEdit.Text            = item.objetivos;
                        txtHorasEditCapacitacion.Text = item.cant_horas.ToString();

                        List <trabajador_gestion> _listatrab = Mgr_Trabajador.Get_TrabajadorInGestion(0, Convert.ToInt32(hdfEditCapacitacionID.Value));

                        foreach (var trab in _listatrab)
                        {
                            if (chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()) != null)
                            {
                                chkTrabajadores.Items.FindByValue(trab.id_trabajador.ToString()).Selected = true;
                            }
                        }
                    }
                }
            }
            else if (e.CommandName.Equals(ComandosGrid.Eliminar.Value))
            {
                hdfIDDel.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                Modal.registrarModal("deleteModal", "DeleteModalScript", this);
            }
            else if (e.CommandName.Equals(ComandosGrid.Asistencia.Value))
            {
                string idGestion = Utilidades_GridView.DevolverIdRow(e, GridView1);

                Response.Redirect(Paginas.Update_AsistenciaCapacitacion.Value + "?id=" + objUtilidades.cifrarCadena(idGestion));
            }
            else if (e.CommandName.Equals(ComandosGrid.Upload.Value))
            {
                hdfIDEsc.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);
                Modal.registrarModal("EscaneadoModal", "EscaneadoModalScript", this);
            }
            else if (e.CommandName.Equals(ComandosGrid.Imprimir.Value))
            {
                hImprimir.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);

                ViewState["Imprimir"] = string.Empty + hImprimir.Value;

                Modal.registrarModal("PrintListaModal", "PrintListaModalScript", this);
            }
            else if (e.CommandName.Equals(ComandosGrid.Consultar.Value))
            {
                hdfIDDel.Value = Utilidades_GridView.DevolverIdRow(e, GridView1);
                hdfIDDel.Value = objUtilidades.cifrarCadena(Convert.ToString(hdfIDDel.Value));
                Response.Redirect(Paginas.View_GestionLaboral.Value + "?id=" + hdfIDDel.Value);
            }
        }