Está en la página 1de 4

public void traerPersonal(string[] dato)

{
try
{
DataSet dsDataSet = new DataSet();
dsDataSet = inper.traerpersonal(dato);
DataTable dtDataTable = null;
dtDataTable = dsDataSet.Tables[0];
if (dato[0] != "n")
{
if (dtDataTable != null && dtDataTable.Rows.Count > 0)
{
gdpersonal.DataSource = dtDataTable;
gdpersonal.DataBind();
}
else
{
Response.Write("<script languaje = 'JavaScript'" + "> al
ert('no existe datos con registro');</script>");
}
}
else
{
if (dtDataTable != null && dtDataTable.Rows.Count > 0)
foreach (DataRow drDataRow in dtDataTable.Rows)
{
pnom.Text = Convert.ToString(drDataRow[0]);
snom.Text = Convert.ToString(drDataRow[1]);
pape.Text = Convert.ToString(drDataRow[2]);
sape.Text = Convert.ToString(drDataRow[3]);
ced.Text = Convert.ToString(drDataRow[4]);
telf.Text = Convert.ToString(drDataRow[5]);
sexo.Text = Convert.ToString(drDataRow[6]);
nacimi.Text = Convert.ToString(drDataRow[7]);
direc.Text = Convert.ToString(drDataRow[8]);
estcivil.Text = Convert.ToString(drDataRow[9]);
usu.Text = Convert.ToString(drDataRow[10]);
pass1.Text = Convert.ToString(drDataRow[11]);
espe.Text = Convert.ToString(drDataRow[12]);
perfil.Text = Convert.ToString(drDataRow[13]);
if (Convert.ToString(drDataRow[14]) == "ACTIVO")
{
est.Checked = true;
est.Text = "Activo";
}
else
{
{
est.Checked = false;
est.Text = "Desactivado";

}
}
}
else
{
Response.Write("<script languaje = 'JavaScript'" + "> al
ert('no existe datos con registro');</script>");
}
}
}
catch (Exception ex)
{
Response.Write("<script languaje = 'JavaScript'" + "> alert('" +
ex.Message + "');</script>");
}
}

protected void Page_Load(object sender, EventArgs e)


{
Usuario.Text = Session["nombre"] + " " + Session["apellido"];
if (!IsPostBack)
{
string[] dato = { "*" };
traerPersonal(dato);
}
}

protected void TextBox1_TextChanged(object sender, EventArgs e)


{
{
try
{
string[] nombre ={
"n",
cedbus.Text
};
traerPersonal(nombre);
}
catch (Exception ex)
{
Response.Write("<script languaje = 'JavaScript'" + "> alert(
'" + ex.Message + "');</script>");
}
}
}
protected void gdpersonal_SelectedIndexChanged(object sender, EventArgs
e)
{
Eliminar.Enabled = true;
Guardar.Enabled = true;
Modificar.Enabled = true;
int fila = gdpersonal.SelectedIndex;
pnom.Text = gdpersonal.Rows[fila].Cells[0].Text;
snom.Text = gdpersonal.Rows[fila].Cells[1].Text;
pape.Text = gdpersonal.Rows[fila].Cells[2].Text;
sape.Text = gdpersonal.Rows[fila].Cells[3].Text;
ced.Text = gdpersonal.Rows[fila].Cells[4].Text;
telf.Text = gdpersonal.Rows[fila].Cells[5].Text;
sexo.Text = gdpersonal.Rows[fila].Cells[6].Text;
nacimi.Text = gdpersonal.Rows[fila].Cells[7].Text;
direc.Text = gdpersonal.Rows[fila].Cells[8].Text;
estcivil.Text = gdpersonal.Rows[fila].Cells[9].Text;
usu.Text = gdpersonal.Rows[fila].Cells[10].Text;
pass1.Text = gdpersonal.Rows[fila].Cells[11].Text;
espe.Text = gdpersonal.Rows[fila].Cells[12].Text;
perfil.Text = gdpersonal.Rows[fila].Cells[13].Text;
if (gdpersonal.Rows[fila].Cells[14].Text == "ACTIVO")
{
est.Checked = true;
est.Text = "Activo";
}
else
{
est.Checked = false;
est.Text = "Desactivado";
}
}

login
using
using
using
using
using
using
using

System;
System.Collections.Generic;
System.Data.SqlClient;
System.Linq;
System.Web;
System.Web.UI;
System.Web.UI.WebControls;

namespace clinicahemisferios.vistas
{
public partial class frm_login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_ingresar_Click(object sender, EventArgs e)
{
String usu = txt_usu.Text;
String pass = txt_pass.Text;
Negocio.log cone = new Negocio.log();
SqlDataReader usuario=cone.ingre(usu,pass);
if (usuario != null && usuario.Read()){
String pnom= usuario.GetString(3);
String pape= usuario.GetString(1);
Session["nombre"]=pnom;
Session["apellido"]=pape;
Response.Redirect("../vistas/frm_inicio.aspx");
}
else
{
ClientScript.RegisterClientScriptBlock(GetType(), "mensaje", "al
ert('Datos Incorrectos');", true);
}
}
}
}