Esempio n. 1
0
        private void loadDados()
        {
            StreamReader lA = new StreamReader("Alunos.txt");

            while (!lA.EndOfStream)
            {
                string temp = lA.ReadLine();
                Aluno  obj  = new Aluno(temp.Substring(0, temp.IndexOf(',')), Int32.Parse(temp.Substring(temp.IndexOf(',') + 2)));

                listaAlunos.Add(obj);
            }
            updateDisplayAlunos();
            lA.Close();

            StreamReader lL = new StreamReader("Livros.txt");

            while (!lL.EndOfStream)
            {
                string temp = lL.ReadLine();
                Livros obj  = new Livros(temp.Substring(0, temp.IndexOf(',')), temp.Substring(temp.IndexOf(',') + 2, temp.IndexOf('-') - temp.IndexOf(',') - 3), temp.Substring(temp.IndexOf('-') + 2));

                listaLivros.Add(obj);
            }
            updateDisplayLivros();
            lL.Close();
        }
Esempio n. 2
0
        private void buttonCadastrarLivros_Click(object sender, EventArgs e)
        {
            if (textTitulo.Text.Count() > 0 && textAutor.Text.Count() > 0)
            {
                Livros obj = new Livros(textTitulo.Text, textAutor.Text, textID.Text);

                listaLivros.Add(obj);
                updateDisplayLivros();
            }
        }