protected void Page_Load(object sender, EventArgs e) { xx = (CLLogin)Session["Usuario"]; string sCnn = "Data Source=localhost;Initial Catalog=ropa;Integrated Security=True"; string sSel = "DAO_leer_persona ';" + (xx.Usuario) + "'"; SqlCommand cmd = new SqlCommand(sSel, sCnn); SqlDataAdapter da; DataTable dt = new DataTable(); da = new SqlDataAdapter(sSel, sCnn); da.Fill(dt); //de la fila , columna de la tabla obtenida txtRut.Value = dt.Rows[0][1].ToString(); txtNombre.Value = dt.Rows[0][2].ToString(); txtApP.Value = dt.Rows[0][3].ToString(); txtApM.Value = dt.Rows[0][4].ToString(); txtCorreo.Value = dt.Rows[0][5].ToString(); txtTelefono.Value = dt.Rows[0][6].ToString(); ////lblNombre.Text = xx.Usuario; //string comando = "DAO_leer_persona ';" + (xx.Usuario) + "'"; //DataTable dt = BD_conexion.getInstance().mySQLSelect(comando); //txtRut.Value = dt.Rows[0][1].ToString(); //txtNombre.Value = dt.Rows[0][2].ToString(); //txtApP.Value = dt.Rows[0][3].ToString(); //txtApM.Value = dt.Rows[0][4].ToString(); //txtCorreo.Value = dt.Rows[0][5].ToString(); //txtTelefono.Value = dt.Rows[0][6].ToString(); }
protected void btnLogin_(object sender, EventArgs e) { string rut = txtRut.Value; string clave = txtClave.Value; ArrayList parametros = new ArrayList(); parametros.Add(new Parametros("rut", rut)); parametros.Add(new Parametros("clave", clave)); bool dato = BD_conexion.getInstance().loginExecute("NEG_datos_Usuario", parametros); if (dato) { Session["Usuario"] = new CLLogin(int.Parse(txtRut.Value), txtClave.Value); Response.Redirect("PG_perfil.aspx"); } else { Response.Write("<script>alert('usuario o contraseña incorrecto')</script>"); } //string rut = txtRut.Value; //string clave = txtClave.Value; // BD_conexion.getInstance().sqlPkgDec("DAO_leer_usuario"); // BD_conexion.getInstance().sqlPkgParIn("persona_rut", rut); // BD_conexion.getInstance().sqlPkgParIn("clave", clave); // BD_conexion.getInstance().ParnOutString("@resultado", 255); // ConeccionReturn rt = BD_conexion.getInstance().sqlPkgExe(); //Response.Write(rt.code); //if (rt.code == "1") //{ // Response.Redirect("PG_perfil.aspx"); //} //else //{ // Response.Write("<script>alert('usuario o contraseña incorrecto')</script>"); //} }
public void Login(CLLogin packet) { Packet answer; int result = DBManager.CheckPlayerLogin(packet.UserID, packet.Password); if (result == 0) // LoginOK { answer = new LCLoginOK(); answer.Write(ref netstream); LConsole.WriteStatus("User '{0}' logged in ", packet.UserID); this.UserID = packet.UserID; } else { answer = new LCLoginError(); if (result == 1) // Wrong UserID or Password { ((LCLoginError)answer).ErrorID = ErrorID.WrongUserOrPassword; LConsole.WriteWarning("User '{0}' failed to log in with password '{1}'", packet.UserID, packet.Password); answer.Write(ref netstream); } else if (result == 2) // Access Denied { ((LCLoginError)answer).ErrorID = ErrorID.AccessDenied; LConsole.WriteWarning("Banned user '{0}' tried to log in but was rejected.", packet.ID); } } answer.Write(ref netstream); }