Exemple #1
0
    protected void BuscaPersonal(string Nombre)
    {
        string cleanMessage = string.Empty;

        if (Nombre == string.Empty)
        {
            cleanMessage = "Ingresar Numero de DNI";
            limpiar();
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            BL_PERSONAL obj         = new BL_PERSONAL();
            DataTable   dtResultado = new DataTable();
            dtResultado = obj.BuscarDNI_TC(Nombre);
            if (dtResultado.Rows.Count > 0)
            {
                txtDNI.ReadOnly        = true;
                lblCodigoPersonal.Text = dtResultado.Rows[0]["IDE_EMPLEADO"].ToString();
                txtDNI.Text            = dtResultado.Rows[0]["DES_DNI"].ToString();
                txtNombre.Text         = dtResultado.Rows[0]["DES_NOMBRE"].ToString();
                txtApePat.Text         = dtResultado.Rows[0]["DES_APEPAT"].ToString();
                txtApeMat.Text         = dtResultado.Rows[0]["DES_APEMAT"].ToString();
                txtFono.Text           = dtResultado.Rows[0]["DES_TELEFONO"].ToString();
                txtCorreo.Text         = dtResultado.Rows[0]["DES_CORREO"].ToString();
                txtDireccion.Text      = dtResultado.Rows[0]["DES_DIRECCION"].ToString();
                txtNacimiento.Text     = dtResultado.Rows[0]["FEC_FECHA_NACIMIENTO"].ToString();
                //  txtIngreso.Text = dtResultado.Rows[0]["FEC_FECHA_INGRESO"].ToString();
                ddlCivil.SelectedValue  = dtResultado.Rows[0]["DES_ESTADO_CIVIL"].ToString();
                ddlCargos.SelectedValue = dtResultado.Rows[0]["DES_CARGO"].ToString();
                ParametrosCivil();
                ddlDocumento.SelectedValue = dtResultado.Rows[0]["DES_TIPO_DOCUMENTO"].ToString();
                TipoDocumento();
                if (dtResultado.Rows[0]["FOTO"] != DBNull.Value)
                {
                    byte[] imageBuffer = (byte[])dtResultado.Rows[0]["FOTO"];
                    if (imageBuffer != null)
                    {
                        System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBuffer);
                        ImgFoto.ImageUrl = "~/HandlerFoto.ashx?ID=" + Nombre; // dtResultado.Rows[0]["icodpersonal"];
                    }
                }
            }
            else
            {
                cleanMessage = "No existe informacion sobre el DNI ingresado";
                limpiar();
                ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            }
        }
    }
Exemple #2
0
    protected void txtPersonal_TextChanged(object sender, EventArgs e)
    {
        string cleanMessage = string.Empty;

        if (txtPersonal.Text == string.Empty)
        {
            cleanMessage = "Ingresar Nombre a consultar";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
        }
        else
        {
            BL_PERSONAL obj         = new BL_PERSONAL();
            DataTable   dtResultado = new DataTable();

            //int i = 0; int j = 0;
            //char[] letras = dni.ToCharArray();
            //for (i = 0; i < dni.Length; i++)
            //{
            //    if (letras[i] == '-')
            //    {
            //        j = i;
            //        break;
            //    }
            //}
            dtResultado = obj.BuscarDNI_TC(txtPersonal.Text);
            if (dtResultado.Rows.Count > 0)
            {
                GridPersonal.Visible    = true;
                GridPersonal.DataSource = dtResultado;
                GridPersonal.DataBind();
            }
            else
            {
                GridPersonal.Visible    = false;
                GridPersonal.DataSource = null;
                GridPersonal.DataBind();
            }
        }
    }