public void login(string user, string password) { try { conexion.enlace(); SqlCommand comando = new SqlCommand("select nombre_empleado, id_puesto from empleados where usuario_empleado = @user and contraseña_empleado = @pass", conexion.enlace()); comando.Parameters.AddWithValue("user", user); comando.Parameters.AddWithValue("pass", password); SqlDataAdapter dtadapter = new SqlDataAdapter(comando); DataTable datatabla = new DataTable(); dtadapter.Fill(datatabla); if (datatabla.Rows.Count == 1) { this.Hide(); if (datatabla.Rows[0][1].ToString() == "1") { } else if (datatabla.Rows[0][1].ToString() == "2") { Menu_admi admi = new Menu_admi(); admi.Show(); } else if (datatabla.Rows[0][1].ToString() == "3") { } else if (datatabla.Rows[0][1].ToString() == "4") { } else if (datatabla.Rows[0][1].ToString() == "5") { } else if (datatabla.Rows[0][1].ToString() == "6") { Iniciodevendedores viewVendedor = new Iniciodevendedores(); viewVendedor.Show(); } } else { MessageBox.Show("El Usuario y/o Contraseña son Incorrectos. Por Favor Verificar el ingreso de los Datos!"); txtusuario.Clear(); txtcontrasena.Clear(); } } catch (Exception e) { MessageBox.Show("No se Encuentra informacion. " + e.Message); } finally { conexion.enlace().Close(); } }
private void RegistrarToolStripMenuItem_Click(object sender, EventArgs e) { Iniciodevendedores pantalla_principal = new Iniciodevendedores(); pantalla_principal.Show(); }