private void button_Click(object sender, RoutedEventArgs e) { SqlCommand cmd = new SqlCommand("SELECT USER_GSI FROM gsi_user WHERE USER_GSI=@user and PASS_GSI=@pass and POSICION_GSI=@admin", con); cmd.Parameters.AddWithValue("user", textBox.Text); //string pas = passwordBox.SecurePassword(); cmd.Parameters.AddWithValue("pass", passwordBox.Password); cmd.Parameters.AddWithValue("admin", comboBox.Text); con.Open(); SqlDataReader leer = cmd.ExecuteReader(); if (leer.Read() == true) { if(comboBox.Text == "Administrator") { PanelMenu login = new PanelMenu(); login.Show(); Close(); } else { Window1 lote = new Window1(); lote.Show(); Close(); } } else { MessageBox.Show("Usuario y Contraseña no son validos", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } con.Close(); }
private void button_Click(object sender, RoutedEventArgs e) { Window1 win = new Window1(); win.Show(); Close(); }