private void btnlogin_Click(object sender, EventArgs e) { try { ClLogin cllog = new ClLogin(); cllog.username = txusername.Text; cllog.password = txpass.Text; } catch (Exception ex) { MessageBox.Show("Error." + ex.Source); throw; } //try //{ // SqlConnection cn = new SqlConnection( // ConfigurationManager.ConnectionStrings["cs_proyecto"].ConnectionString // ); // cn.Open(); // //string tablas = "SELECT * FROM Admin WHERE Username='******' AND Password='******'"; // SqlCommand comando = new SqlCommand(); // SqlParameter param = new SqlParameter(); // comando.Connection = cn; // comando.CommandType = CommandType.StoredProcedure; // comando.CommandText = "sp_admin"; // param = new SqlParameter(); // comando.Parameters.Add("@Username", SqlDbType.VarChar).Value = txusername.Text; // comando.Parameters.Add("@Password", SqlDbType.VarChar).Value = txpass.Text; // SqlDataReader reader = comando.ExecuteReader(); // if (reader.Read()) // { // MessageBox.Show("Bienvenido a Development SQl", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); // People pop = new People(); // pop.Show(); // this.Hide(); // } // else if (txusername.Text == "" && txpass.Text == "") // { // MessageBox.Show("Hay casillas vacias", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // else // { // MessageBox.Show("Lo sentimos, el Username o la Password no aparece en la Base de Datos", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // cn.Close(); //} //catch(Exception ex) //{ // MessageBox.Show("Hubo un error en el programa" + ex); //} }
protected void btnLogin_Click(object sender, EventArgs e) { string user = txtusuario.Text; string pass = txtclave.Text; int Login = ClLogin.IniciarSesion(user, pass); if (Login == 0) { Response.Write("<script>alert('Usuario Incorrecto')</script>"); } else { Response.Redirect("Menu.aspx"); Response.Write("<script>alert('Usuario Correcto')</script>"); } }
protected void btnLogin_Click(object sender, EventArgs e) { string user = txtcorreo.Text; string pass = txtclave.Text; int Login = ClLogin.IniciarSesion(user, pass); if (Login == 2) { Response.Write("<script>alert('Usuario Correcto')</script>"); Response.Redirect("Usuario/Menu.aspx"); } else if (Login == 1) { Response.Write("<script>alert('Administrador Correcto')</script>"); Response.Redirect("Admin/MenuAdmin.aspx"); } else { Response.Write("<script>alert('Usuario o contraseña incorrecta')</script>"); } }
protected void btnLogin_Click(object sender, EventArgs e) { string user = txtusuario.Text; string pass = txtclave.Text; int Login = ClLogin.IniciarSesion(user, pass); switch (Login) { case 1: Response.Redirect("Menu.aspx"); break; case 2: Response.Redirect("Menu2.aspx"); break; default: Response.Write("<script>alert('Usuario no existe')</script>"); break; } }