private void btnLogin_Click(object sender, EventArgs e) { try { CN_Login _CN_Login = new CN_Login(); Users _Users = _CN_Login.CN_GetUserLogin("JDLoco", "sasas"); //Users _Users = _CN_Login.CN_GetUserLogin(txtUsuario.Text, txtContrasena.Text); if (_Users.UsersId > 0) { BasePage.GlobalUsers = _Users; SetValues(); this.Hide(); MenuPrincipal menuPrincipal = new MenuPrincipal(); menuPrincipal.Show(); } else { MessageBox.Show("incorrecto"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_login_Click(object sender, EventArgs e) { string su = txt_usuario.Text; string pass = txt_contraseña.Text; if (su == "" && pass == "") { MessageBox.Show("Falta usuario y contraseña "); } else if (su == "" || pass == "") { MessageBox.Show("Falta usuario o contraseña "); } else { CN_Login usu = new CN_Login(); SqlDataReader leer; usu.Usuario = txt_usuario.Text; usu.Password = txt_contraseña.Text; leer = usu.IniciarSesion(); if (leer.Read() == true) { this.Hide(); Crud c = new Crud(); c.Show(); } else { MessageBox.Show("Usuario o Contraseña Incorrecto!!!!"); } } }
private void btnIniciar_Click(object sender, EventArgs e) { CN_Login _CD_Login = new CN_Login(); SqlDataReader sdrLeer; sdrLeer = _CD_Login.leerLogin(txtUsuario.Text, txtContraseña.Text); if (sdrLeer.Read() == true) { Program.user = txtUsuario.Text; Program.pass = txtContraseña.Text; Program.nombre = sdrLeer["nombre"].ToString(); Program.apellidos = sdrLeer["apellidos"].ToString(); Program.correo = sdrLeer["email"].ToString(); Cargando car = new Cargando(); car.Show(); //Principal _Pri = new Principal(); //_Pri.Show(); this.Hide(); } else { MessageBox.Show("Usuario o contraseña incorrectos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void OK_Click(object sender, EventArgs e) { if (txtUser.Text != "" && txtPassword.Text != "") { try { CN_Login obj = new CN_Login(); List <string> datosUsuarios = new List <string>(); datosUsuarios = obj.ConsultarUser(txtUser.Text, txtPassword.Text); if (datosUsuarios.ElementAt(0) != "0") { MessageBox.Show("Bienvenido"); Principal form = new Principal(datosUsuarios.ElementAt(1), datosUsuarios.ElementAt(2)); this.Hide(); form.Show(); } else { MessageBox.Show("Datos incorrectos, por favor intentelo de nuevo"); } } catch (Exception ex) { MessageBox.Show("Datos incorrectos" + ex); } } }
private void entrar() { //if (HayInternet() == true) //{ try { CN_Login _Login = new CN_Login(); MySqlDataReader Loguear; Loguear = _Login.IniciarSesion(txtNickname.Text, txtContra.Text); if (Loguear.Read() == true) { /* * if (HayInternet() == true) * { * * } * else * { * * MessageBox.Show("Compruebe su conexión a internet, no tendrá todas las funcionalidades", "Conexion a internet", MessageBoxButtons.OK, MessageBoxIcon.Error); * } */ Cursor.Current = Cursors.WaitCursor; Program.nickname = txtNickname.Text; Program.contraseña = txtContra.Text; Program.cargo = Loguear["nombreCargo"].ToString(); Program.nombre = Loguear["Nombre"].ToString(); Program.apellidos = Loguear["Apellidos"].ToString(); Program.correo = Loguear["Correo"].ToString(); dsUsuario Ds = new dsUsuario(); for (int i = 0; i < 3; i++) { Ds.Tables[0].Rows.Add(new object[] { Loguear["nombreCargo"].ToString(), Loguear["Nombre"].ToString(), Loguear["Correo"].ToString() }); } Reportes r = new Reportes(); r.setInformacion(Ds); Menu mn = new Menu(); mn.Show(); Cursor.Current = Cursors.Default; this.Hide(); } else { MessageBox.Show("Usuario o contraseña incorrectos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); txtContra.Focus(); } } catch (Exception ex) { MessageBox.Show("Ha ocurrido un error " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } //} else { // MessageBox.Show("Compruebe su conexión a internet", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} }
private void MostrarUsuarios() { CN_Login _CN_Login = new CN_Login(); dgvUsuarios.DataSource = _CN_Login.MostrarUsuarios(); }
public Principal(string cuentaUsuario = "default", string tipoUsuario = "default") { InitializeComponent(); tstlUser.Text = cuentaUsuario; tstlTipoUser.Text = tipoUsuario; try { CN_Login obj = new CN_Login(); List <string> datosUsuarios = new List <string>(); datosUsuarios = obj.ConsultarPermisosUser(cuentaUsuario); //MessageBox.Show(datosUsuarios.ElementAt(1)); //MessageBox.Show("0"); //MessageBox.Show(datosUsuarios.ElementAt(2)); if (Convert.ToBoolean(datosUsuarios.ElementAt(1)) == true) { tsmiProductos.Enabled = true; tsmiProductos.Visible = true; } else { tsmiProductos.Enabled = false; tsmiProductos.Visible = false; } if (Convert.ToBoolean(datosUsuarios.ElementAt(2)) == true) { tsmiIngresos.Enabled = true; tsmiIngresos.Visible = true; } else { tsmiIngresos.Enabled = false; tsmiIngresos.Visible = false; } if (Convert.ToBoolean(datosUsuarios.ElementAt(3)) == true) { tsmiSalidas.Enabled = true; tsmiSalidas.Visible = true; } else { tsmiSalidas.Enabled = false; tsmiSalidas.Visible = false; } if (Convert.ToBoolean(datosUsuarios.ElementAt(4)) == true) { tsmiSolicitudes.Enabled = true; tsmiSolicitudes.Visible = true; } else { tsmiSolicitudes.Enabled = false; tsmiSolicitudes.Visible = false; } if (Convert.ToBoolean(datosUsuarios.ElementAt(5)) == true) { tsmiReportes.Enabled = true; tsmiReportes.Visible = true; } else { tsmiReportes.Enabled = false; tsmiReportes.Visible = false; } if (Convert.ToBoolean(datosUsuarios.ElementAt(6)) == true) { UsuariosToolStripMenuItem.Enabled = true; UsuariosToolStripMenuItem.Visible = true; } else { UsuariosToolStripMenuItem.Enabled = false; UsuariosToolStripMenuItem.Visible = false; } } catch (Exception ex) { MessageBox.Show("Error, vuelva a cargar el sistema!!!"); } }