public static datosSesion instancia(string no_cuenta, string contra) { if (ins == null) { ins = new datosSesion(no_cuenta, contra); } return(ins); }
private void button1_Click(object sender, EventArgs e) { MySqlConnection cone = con.obtenerConexion(); if (cone != null) { String no_cuenta = txtuser.Text; String pass = txtpass.Text; datosSesion datos = datosSesion.instancia(no_cuenta, pass); Boolean existe = con.existeUsuario(cone, pass, no_cuenta); if (existe == true) { //PASA A LA PANTALLA DE INICIO MessageBox.Show("Bienvenido:\n" + Acciones.Sesion.credencial + "\n"); Pantallas.Principal p = new Pantallas.Principal(); p.Show(); this.Visible = false; } else { datosSesion.limpia(); if (intentos < 3) { MessageBox.Show("Credenciales incorrectas"); intentos++; } else { MessageBox.Show("Llego al limite de intentos por sesion"); } } } }
public static void limpia() { ins = null; }