Example #1
0
        public void AddItem_Click(object sender, EventArgs e)
        {
            Materias materia = new Materias();

            materia.Nome          = txtNomeM.Text;
            materia.Codigo        = Convert.ToInt32(txtCod.Value);
            materia.Carga_horaria = Convert.ToInt32(txtCarga.Value);
            materia.Periodo       = Convert.ToInt32(txtPeriodo.Text);

            var pesquisa = new DaoProfessor().procurarProfessorNome(txtProfessor.Text);

            pesquisa.Curso_id   = Convert.ToInt32(txtCodigo.Value);
            pesquisa.Materia_id = Convert.ToInt32(txtCod.Value);

            materia.Professor_id = pesquisa.NR;

            listaMaterias.Add(materia);

            controles.excluirProfessor(pesquisa.NR);
            controles.adicionarProfessor(pesquisa);

            txtNomeM.Text     = "";
            txtCod.Value      = 0;
            txtCarga.Value    = 0;
            txtProfessor.Text = "";
            txtPeriodo.Text   = "";
            listar();
        }
Example #2
0
        public void lerProfessor()
        {
            DaoProfessor daoProfessor = new DaoProfessor();
            string       jsonFilePath = @".\listaProfessor.txt";

            if (File.Exists(jsonFilePath))
            {
                string json = File.ReadAllText(jsonFilePath);

                Professores[] listaProfessor = JsonConvert.DeserializeObject <Professores[]>(json);

                daoProfessor.addProfessorLer(listaProfessor.ToList());
            }
        }