protected void btnGuardar_Click(object sender, EventArgs e)
    {
        if (txtCorreo.Text != string.Empty)
        {
            Boolean correo = email_bien_escrito(txtCorreo.Text.Trim());

            if (correo == true)
            {
                BL_RRHH_SOL_FORMATIVO obj      = new BL_RRHH_SOL_FORMATIVO();
                DataTable             dt       = new DataTable();
                DataTable             dtCorreo = new DataTable();
                dt       = obj.uspSEL_RRHH_FORMATIVO_PROCESAR_AREAS(Convert.ToInt32(lblCodigo.Text), txtComentarios.Text, lblvalor.Text, Session["IDE_USUARIO"].ToString());
                dtCorreo = obj.SP_CORREO_FORMATIVO_APROBACIONES(Convert.ToInt32(lblCodigo.Text), "A2", txtCorreo.Text);
                if (dtCorreo.Rows.Count > 0)
                {
                    string cleanMessage = "Solicitud enviada";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
                }
            }
            else
            {
                string cleanMessage = "Error! verificar correo";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }
        else
        {
            string cleanMessage = "Falta ingresar correo";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }
    protected void ProcesarReconocimiento(object sender, ImageClickEventArgs e)
    {
        ImageButton btnProcesar = ((ImageButton)sender);
        GridViewRow row         = btnProcesar.NamingContainer as GridViewRow;
        string      pk          = GridView1.DataKeys[row.RowIndex].Values[0].ToString();

        RadioButtonList rb = (RadioButtonList)row.FindControl("rdoOpcion");

        lblCodigo.Text      = string.Empty;
        lblvalor.Text       = string.Empty;
        txtComentarios.Text = string.Empty;
        txtCorreo.Text      = string.Empty;

        if (rb.SelectedValue == "A3")
        {
            BL_RRHH_SOL_FORMATIVO obj = new BL_RRHH_SOL_FORMATIVO();
            DataTable             dt  = new DataTable();
            dt = obj.uspSEL_RRHH_SOL_FORMATIVO_PROCESAR(Convert.ToInt32(pk), rb.SelectedValue);
            string cleanMessage = "Solicitud procesada";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            Listar();
        }
        else if (rb.SelectedValue == "A1")
        {
            lblvalor.Text  = rb.SelectedValue.ToString();
            lblCodigo.Text = pk;
            ModalRegistro.Show();
        }
        else if (rb.SelectedValue == "A2")
        {
            BL_RRHH_SOL_FORMATIVO obj      = new BL_RRHH_SOL_FORMATIVO();
            DataTable             dt       = new DataTable();
            DataTable             dtCorreo = new DataTable();
            dt       = obj.uspSEL_RRHH_SOL_FORMATIVO_PROCESAR(Convert.ToInt32(pk), rb.SelectedValue);
            dtCorreo = obj.SP_CORREO_FORMATIVO_APROBACIONES(Convert.ToInt32(pk), "A3", "");
            string cleanMessage = "Solicitud procesada";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            Listar();
        }
        else if (rb.SelectedValue == "R")
        {
            BL_RRHH_SOL_FORMATIVO obj      = new BL_RRHH_SOL_FORMATIVO();
            DataTable             dt       = new DataTable();
            DataTable             dtCorreo = new DataTable();
            dt       = obj.uspSEL_RRHH_SOL_FORMATIVO_PROCESAR(Convert.ToInt32(pk), rb.SelectedValue);
            dtCorreo = obj.SP_CORREO_FORMATIVO_APROBACIONES(Convert.ToInt32(pk), rb.SelectedValue, "");

            string cleanMessage = "Solicitud procesada";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            Listar();
        }
    }
    protected void btnProcesar_Click(object sender, EventArgs e)
    {
        BL_RRHH_SOL_FORMATIVO obj      = new BL_RRHH_SOL_FORMATIVO();
        DataTable             dt       = new DataTable();
        DataTable             dtCorreo = new DataTable();
        string valor = string.Empty;

        if (rdoOpcion.SelectedValue != string.Empty)
        {
            if (rdoOpcion.SelectedValue == "APROBADO")
            {
                valor = Session["ESTADO"].ToString();
            }
            else
            {
                valor = "R";
            }

            dt = obj.uspSEL_RRHH_FORMATIVO_PROCESAR_AREAS(Convert.ToInt32(lblCodigo.Text), txtObservaciones.Text, valor, Session["IDE_USUARIO"].ToString());

            if (Session["ESTADO"].ToString() == "A2" && valor != "R")
            {
                valor = "A3";
            }

            dtCorreo = obj.SP_CORREO_FORMATIVO_APROBACIONES(Convert.ToInt32(lblCodigo.Text), valor, "");

            string cleanMessage = "Solicitud enviada a la Gerencia de RRHH";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            Datos(lblCodigo.Text);
        }
        else
        {
            string cleanMessage = "Indicar situación de la solicitud";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
    }