protected void Page_Load(object sender, EventArgs e) { string user = Request.Form["_username"]; string pass = Request.Form["_password"]; string red = "RACMobile.aspx"; EN.ENCliente enCli = new EN.ENCliente(); DataSet ds = new DataSet(); ds = enCli.ObtenerDatosClienteConDni(user); if (ds.Tables["Cliente"].Rows.Count > 0) { if (ds.Tables["Cliente"].Rows[0][10].ToString() == pass) { Session["Usuario"] = user.ToString(); Response.Redirect(red); } else { red += "#registro"; Response.Redirect(red); } } }
private void TButtonBuscar_Click(object sender, EventArgs e) { EN.ENCliente cliente = new EN.ENCliente(); DataSet cli = new DataSet(); if (incorrecto == false) { string dni = TTextBoxDNI.Text.ToString(); cliente.DNI = TTextBoxDNI.Text; cli = cliente.ObtenerDatosClienteConDni(TTextBoxDNI.Text); if (cli.Tables["Cliente"].Rows.Count != 1) { MessageBox.Show("No se encuentra ningún cliente.", "¡ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); incorrecto = true; TTextBoxNombre.Text = ""; TTextBoxApellidos.Text = ""; } else { cliente.RellenarCliente(); incorrecto = false; TTextBoxNombre.Text = cliente.Nombre; TTextBoxApellidos.Text = cliente.Apellidos; } } }