private void Button_Click(object sender, RoutedEventArgs e) { try { IFormatter formatter = new BinaryFormatter(); Stream lstream = new FileStream("contactos.txt", FileMode.Open, FileAccess.Read, FileShare.None); mnj = (manejador_De_Archivos)formatter.Deserialize(lstream); lstream.Close(); } catch (Exception ex) { MessageBox.Show("Error atroz"); } List <Dueño> temp = mnj.obtenerCont(); foreach (Dueño mtemp in temp) { if (mtemp.Usuario1.Equals(usuario.Text)) { MessageBox.Show("usuario encontrado"); Principal tempo = new Principal(); this.Close(); tempo.seText(usuario.Text); tempo.Show(); } else { MessageBox.Show("usuario No existente"); } } }
public bool PlacaExistente(string placa) { try { IFormatter formatter = new BinaryFormatter(); Stream lstream = new FileStream("contactos.txt", FileMode.Open, FileAccess.Read, FileShare.None); mnj = (manejador_De_Archivos)formatter.Deserialize(lstream); lstream.Close(); } catch (Exception ex) { MessageBox.Show("Error atroz"); } List <Dueño> temp = mnj.obtenerCont(); foreach (Dueño mtemp in temp) { foreach (Mascota mas in mtemp.MisMascotas) { if (mas.Id1.Equals(placa)) { return(true); } } } return(false); }