예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (nomep.Text != "" && cpfp.Text != "" && rgp.Text != "" && endp.Text != "" &&
                telp.Text != "" && codp.Text != "" && emailp.Text != "")
            {
                //objeto aluno igual java
                professor.nome     = nomep.Text;
                professor.cpf      = cpfp.Text;
                professor.rg       = rgp.Text;
                professor.endereco = endp.Text;
                professor.telefone = telp.Text;
                professor.email    = emailp.Text;
                professor.codigo   = codp.Text;


                if (Validacoes.ValidarCpf(professor))
                {
                    //Se for no modo edição, ele entra para editar sem se preocupar com o CPF
                    //Do contrário, ele só entra quando não houver o cpf no banco
                    if (modoEdicao || ProfessorDAO.ObterProfessorPorcpf(professor) == null)
                    {
                        if (modoEdicao)
                        {
                            if (ProfessorDAO.Alterar(professor))
                            {
                                MessageBox.Show("Professor editado com sucesso.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("Erro ao tentar editar o professor.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            if (ProfessorDAO.Incluir(professor))
                            {
                                MessageBox.Show("Professor cadastrado com sucesso.", "Informação", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                            else
                            {
                                MessageBox.Show("Erro ao tentar incluir o professor.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        Program.atualizarListas();
                    }
                    else
                    {
                        MessageBox.Show("Professor já cadastrado.", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("CPF inválido.", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show("Todos os campos são de preenchimento obrigatório.", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 public ProfessorBRL()
 {
     if (_professorDAO == null)
     {
         _professorDAO = new ProfessorDAO();
     }
 }
예제 #3
0
 private void btnGravarProfessor_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(txtNomeProfessor.Text))
     {
         //gravar no banco.
         professor = new Professor()
         {
             Nome     = txtNomeProfessor.Text,
             CPF      = Convert.ToString(txtCPFProfessor.Text),
             dataNasc = Convert.ToDateTime(dateNascimentoProfessor.Text)
         };
         if (ProfessorDAO.CadastrarProfessor(professor))
         {
             LimparCampos();
             MessageBox.Show("Professor cadastrado com sucesso!", "Escola WPF",
                             MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             MessageBox.Show("Esse professor já está Cadastrado!", "Escola WPF",
                             MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         MessageBox.Show("Favor preencher o nome!", "Escola WPF",
                         MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        public static async void Atualizar()
        {
            ProfessorDAO             pd = new ProfessorDAO();
            List <ProfessorCadastro> b  = new List <ProfessorCadastro>();

            AtualizarProfessores = await pd.GetProfessoresAsync();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (Login.Professor == false)
            {
                Aluno a = AlunoDAO.BuscarNomeSenha(Login.cpfLogin, Login.senhaLogin);

                txtBairro.Text = a.bairro.ToString();
                txtNome.Text   = a.nome.ToString();
                txtEstado.Text = a.estado.ToString();
                txtCidade.Text = a.cidade.ToString();
                txtCpf.Text    = a.cpf.ToString();
                txtRg.Text     = a.rg.ToString();
                txtSenha.Text  = a.senha.ToString();
                txtEmail.Text  = a.email.ToString();
            }
            else
            {
                Professor p = ProfessorDAO.BuscarNomeSenha(Login.cpfLogin, Login.senhaLogin);

                txtBairro.Text = p.bairro.ToString();
                txtNome.Text   = p.nome.ToString();
                txtEstado.Text = p.estado.ToString();
                txtCidade.Text = p.cidade.ToString();
                txtCpf.Text    = p.cpf.ToString();
                txtRg.Text     = p.rg.ToString();
                txtSenha.Text  = p.senha.ToString();
                txtEmail.Text  = p.email.ToString();
            }
        }
예제 #6
0
        public ActionResult CadastrarLicao(Licao licao, string data, int idTurma, int idMateria)
        {
            ViewBag.idMateria = new SelectList(MateriaDAO.listaMateria(), "idMateria", "nme_Materia");
            ViewBag.idTurma   = new SelectList(TurmaDAO.listaTurmas(true), "idTurma", "ano_Turma");
            if (ModelState.IsValid)
            {
                string CPFProf = System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1];
                licao.professor = ProfessorDAO.buscarProfessor("CPF", CPFProf);

                licao.dta_Inicio_Licao    = DateTime.Now;
                licao.Dta_Conclusao_Licao = Convert.ToDateTime(data);

                licao.flg_Ativo = 0;

                licao.conceito = ConceitoDAO.conceitoId(5); //ID 5 = SEM CONCEITO

                licao.materia = MateriaDAO.materiaId(idMateria);

                licao.turma = TurmaDAO.turmaId(idTurma);

                if (LicaoDAO.addLicao(licao))
                {
                    ViewBag.Sucesso = true;
                    return(View());
                }
                else
                {
                    ModelState.AddModelError("", "Uma Lição com o mesmo nome ja foi cadastrada no sistema!");
                }
            }
            return(View(licao));
        }
        async void Salvar(object sender, EventArgs e)
        {
            //recupera o objeto conta da tela
            ProfessorCadastro prof = new ProfessorCadastro()
            {
                Nome       = nomeProfessor.Text.Trim(),
                Disciplina = disciplina.Text.Trim(),
                CPF        = cpfProfessor.Text.Trim(),
            };
            //chama o service para incluir a conta via API
            ProfessorDAO service = new ProfessorDAO();


            //mostra mensagem de erro caso não foi possível incluir
            if (service.AddProfessorAsync(prof) == null)
            {
                await DisplayAlert("Erro", "Ocorreu um erro ao incluir a Conta", "Ok");
            }
            else
            {
                string mensagem = "Professor cadastrado com sucesso";
                await PopupNavigation.Instance.PushAsync(new PopPupSucesso());

                Atualizar();
            }
        }
 private void btnCadastrarProduto_Click(object sender, RoutedEventArgs e)
 {
     if (txtNome.Text != "" && txtCpf.Text != "" && txtRg.Text != "" && txtEstado.Text != "" && txtCidade.Text != "" && txtBairro.Text != "" && txtEmail.Text != "" && txtSenha.Text != "")
     {
         Professor p = new Professor
         {
             nome   = txtNome.Text,
             senha  = txtSenha.Text,
             email  = txtEmail.Text,
             cpf    = txtCpf.Text,
             rg     = txtRg.Text,
             estado = txtEstado.Text,
             cidade = txtCidade.Text,
             bairro = txtBairro.Text,
         };
         if (ProfessorDAO.CadastrarProfessor(p))
         {
             MessageBox.Show("Professor Cadastrado!", "Sucesso", MessageBoxButton.OK, MessageBoxImage.Information);
             LimparFormulario();
         }
         else
         {
             MessageBox.Show("Esse Professor já existe!", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         MessageBox.Show("Prencha todos os campos", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private static void ManipularProfessor(ObjApi objApi)
        {
            usrEdit        = new Usuario();
            disciplinaEdit = new Disciplina();
            professorEdit  = new Professor();

            professorEdit  = ProfessorDAO.BuscarProfessorMatricula(objApi.ProfessorJson.Matricula);
            disciplinaEdit = DisciplinaDAO.BuscarPorNome(objApi.DisciplinaJson.Nome);

            bool cadastrar = true;

            if (professorEdit.Disciplinas != null && professorEdit.Disciplinas.Count() > 1)
            {
                foreach (Disciplina obj in professorEdit.Disciplinas)
                {
                    if (obj.Nome.Equals(disciplinaEdit.Nome))
                    {
                        cadastrar = false;
                        break;
                    }
                }
            }
            if (cadastrar)
            {
                professorEdit.Disciplinas.Add(disciplinaEdit);
            }

            /*edição para inclusão de uma Disciplina para o Professor*/
            ProfessorDAO.EditarProfessor(professorEdit);
        }
예제 #10
0
 // GET: Turma/Create
 public ActionResult Create()
 {
     ViewBag.instituicoes = InstituicaoDAO.BuscarTodos();
     ViewBag.Cursos       = CursoDAO.BuscarTodos();
     ViewBag.professores  = ProfessorDAO.BuscarTodos();
     return(View());
 }
        private void btnCadastrar_Click(object sender, RoutedEventArgs e)
        {
            Professor professor = new Professor {
            };

            if (!string.IsNullOrWhiteSpace(txtNome.Text))
            {
                professor.nome       = txtNome.Text;
                professor.disciplina = txtDisciplina.Text;


                if (ProfessorDAO.AdicionarProfessor(professor))
                {
                    MessageBox.Show("Professor Gravado com Sucesso!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Erro ao cadastrar aluno!");
                }
            }
            else
            {
                MessageBox.Show("Favor preencher todos os campos!!");
            }
        }
        private void btnCadastrar_Click(object sender, RoutedEventArgs e)
        {
            Professor busca = new Professor();

            busca.matricula = Convert.ToInt32(cboProfessor.SelectedValue);
            List <Aluno> alunosaqui = new List <Aluno>();
            Turma        turma      = new Turma();

            if (!string.IsNullOrWhiteSpace(txtNome.Text))
            {
                //para cada aluno selecionado
                foreach (Aluno a in lbxAlunos.SelectedItems)
                {
                    alunosaqui.Add(a);
                }

                turma.Nome_turma = txtNome.Text;
                turma.professor  = ProfessorDAO.BuscarProfessorPorMatricula(busca);
                turma.alunos     = alunosaqui;

                if (TurmaDAO.AdicionarTurma(turma) == true)
                {
                    MessageBox.Show("Turma Gravada com Sucesso!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Erro ao cadastrar turma!");
                }
            }
            else
            {
                MessageBox.Show("Favor preencher todos os campos!!");
            }
        }
예제 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ProfessorDAO pfdao = new ProfessorDAO();

            gvAlunosMateria.DataSource = pfdao.carregarDadosAap(Convert.ToInt32(Session["idprojeto"]));
            gvAlunosMateria.DataBind();
        }
예제 #14
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //Seta as listas para os objetos correspondentes obtidos em banco
     objectListView1.SetObjects(ProfessorDAO.ObterProfessores());
     objectListView2.SetObjects(AlunoDAO.ObterAlunos());
     objectListView3.SetObjects(ProjetoDAO.ObterProjetos());
 }
예제 #15
0
        private void btnBuscarProfessor_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtBuscarProfessor.Text))
            {
                professor = new Professor
                {
                    CPF = txtBuscarProfessor.Text
                };

                professor = ProfessorDAO.BuscarProfessorPorCPF(professor);

                if (professor != null)
                {
                    //Mostrar os dados
                    txtNomeProfessor.Text        = professor.Nome;
                    txtCPFProfessor.Text         = professor.CPF.ToString();
                    dateNascimentoProfessor.Text = professor.dataNasc.ToString();
                    HabilitarCampos(true);
                }
                else
                {
                    MessageBox.Show("Esse aluno não existe!", "Escola WPF",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("Favor preencher o nome!", "Escola WPF",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public ActionResult CadastrarProfessor(Professor professor, HttpPostedFileBase fupImagem)
        {
            if (ModelState.IsValid)
            {
                if (fupImagem != null)
                {
                    string nomeImagem = Path.GetFileName(fupImagem.FileName);
                    string caminho    = Path.Combine(Server.MapPath("~/Images/"), nomeImagem);
                    fupImagem.SaveAs(caminho);
                    professor.FotoProfessor = nomeImagem;
                }
                else
                {
                    professor.FotoProfessor = "semImagem.jpg"; // ENCONTRAR FOTO SEM NADA PRA COLOCAR AQUI
                }

                if (ProfessorDAO.CadastrarProfessor(professor) == true)
                {
                    ModelState.AddModelError("", "Professor adicionado com sucesso!");
                    return(View(professor));
                }
                else
                {
                    ModelState.AddModelError("", "Não é possível alterar um professor com o mesmo CPF!");
                    return(View(professor));
                }
            }
            else
            {
                return(View(professor));
            }
        }
        public SelecionarProfessorViewModel(Avaliacao avaliacao)
        {
            IsVisible   = true;
            Professores = new ObservableCollection <Professor>();
            using (var dao = new ProfessorDAO())
            {
                var profs = dao.GetAtivos();

                if (profs != null)
                {
                    Professores = new ObservableCollection <Professor>(profs);
                }
            }

            SelecionarCommand = new Command(() => {
                IsVisible    = false;
                var selected = Professores?.Where(x => x.Selected).ToList();

                if (selected.Count < 1)
                {
                    App.Current.MainPage?.DisplayAlert("Selecione o professor", "Nenhum professor selecionado.", "Fechar");
                    IsVisible = true;
                    return;
                }
                var pages = new Views.AvaliarProfessorPage(avaliacao, selected);
                App.Current.MainPage?.Navigation.PushAsync(pages);
                IsVisible = true;
            });
        }
        public ActionResult EditarProfessor(Professor professorAlterado)
        {
            Professor professorOriginal = ProfessorDAO.BuscarProfessorPorId(professorAlterado.NumProfessor);

            professorOriginal.NomeProfessor     = professorAlterado.NomeProfessor;
            professorOriginal.CPFProfessor      = professorAlterado.CPFProfessor;
            professorOriginal.FormacaoProfessor = professorAlterado.FormacaoProfessor;
            professorOriginal.FotoProfessor     = professorAlterado.FotoProfessor;
            professorOriginal.Logradouro        = professorAlterado.Logradouro;
            professorOriginal.CEP        = professorAlterado.CEP;
            professorOriginal.Numero     = professorAlterado.Numero;
            professorOriginal.Bairro     = professorAlterado.Bairro;
            professorOriginal.Localidade = professorAlterado.Localidade;
            professorOriginal.UF         = professorAlterado.UF;


            if (ModelState.IsValid)
            {
                if (ProfessorDAO.AlterarProfessor(professorOriginal))
                {
                    return(RedirectToAction("Index", "Professor"));
                }
                else
                {
                    ModelState.AddModelError("", "Não é possível alterar um professor com o mesmo nome!");
                    return(View(professorOriginal));
                }
            }
            else
            {
                return(View(professorOriginal));
            }
        }
예제 #19
0
        public ActionResult AlterarCurso(int id)
        {
            Curso curso = CursoDAO.BuscarCursoPorId(id);

            ViewBag.Categorias  = new SelectList(CategoriaDAO.RetornarCategoria(), "CategoriaId", "NomeCategoria");
            ViewBag.Professores = new SelectList(ProfessorDAO.RetornarProfessores(), "NumProfessor", "NomeProfessor");
            return(View(curso));
        }
 public ExercicioController(ExercicioDAO exercicioDAO, TreinoDAO treinoDAO, AlunoDAO alunoDAO, ProfessorDAO professorDAO, ListaTreinoDAO listaTreinoDAO)
 {
     _exercicioDAO   = exercicioDAO;
     _alunoDAO       = alunoDAO;
     _professorDAO   = professorDAO;
     _listaTreinoDAO = listaTreinoDAO;
     _treinoDAO      = treinoDAO;
 }
예제 #21
0
        public static Professor MapToProfessorDAO(ProfessorDAO professor)
        {
            var prof = new Professor();

            prof.ProfessorID = professor.Id;
            prof.Name        = professor.name;
            return(prof);
        }
예제 #22
0
        public static ProfessorDAO MapToProfessorDAO(Professor professor)
        {
            var prof = new ProfessorDAO();

            prof.Id   = professor.ProfessorID;
            prof.name = professor.Name;
            return(prof);
        }
        // GET: GerarProva
        public ActionResult GerarProva()
        {
            List <string> assuntos = new List <string>();

            //localiza os cursos de acordo com o id do professor
            ViewBag.Turmas = ProfessorDAO.BuscarDisciplinasProfessor(Convert.ToInt32(Session["IdUsr"]));
            ViewBag.Cursos = CursoDAO.listarCursosPorProfessor(Convert.ToInt32(Session["IdUsr"]));
            return(View(new Prova()));
        }
 private void cbxNomeProfessor_Loaded(object sender, RoutedEventArgs e)
 {
     //Carregar todas as categorias para o combobox
     cbxNomeProfessor.ItemsSource = ProfessorDAO.RetornaProfessor();
     //Configurar o que vai aparecer em cada item do combobox
     cbxNomeProfessor.DisplayMemberPath = "Nome";
     //Configurar o vai ficar escondido em cada item do combobox
     cbxNomeProfessor.SelectedValuePath = "CPF";
 }
예제 #25
0
 private void AtualizaProfessores()
 {
     using (var dao = new ProfessorDAO())
     {
         var profs = dao.GetAll();
         Professores = new ObservableCollection <Professor>(profs);
     }
     OnPropertyChanged(nameof(Professores));
 }
예제 #26
0
        public ActionResult Professores()
        {
            var professorDAO = new ProfessorDAO();
            var professores  = professorDAO.Listar();

            ViewBag.Professores = professores;

            return(View());
        }
예제 #27
0
        // GET: Professor/Delete/5
        public ActionResult Delete(int id)
        {
            Professor professor = ProfessorDAO.BuscarPorId(id);

            if (professor == null)
            {
                return(HttpNotFound());
            }
            return(View(professor));
        }
        public bool InsertProfessor(ProfessorDAO professor)
        {
            var p = new Professor();

            p.FirstName = professor.FirstName;
            p.LastName  = professor.LastName;
            p.Active    = true;

            return(ef.AddProfessor(p));
        }
예제 #29
0
 public UserService(ITokenService tokenService, IUserSessionService userSessionService, IMapper mapper, UserOperations ops, StudentDAO studDao, ProfessorDAO profDao, AssistentDAO assisDao)
 {
     _tokenService       = tokenService;
     _userSessionService = userSessionService;
     _mapper             = mapper;
     _userops            = ops;
     _studentDao         = studDao;
     _assistentDao       = assisDao;
     _professorDao       = profDao;
 }
예제 #30
0
        public ActionResult AddProfessor(Professor professor)
        {
            professor.DataInicio = DateTime.Now.ToString("dd/MM/yyyy");
            DateTime.TryParse(professor.DtNascimento, out DateTime dataNascimento);
            professor.DtNascimento = dataNascimento.ToString("dd/MM/yyyy");
            ProfessorDAO professorDAO = new ProfessorDAO();

            professorDAO.AdicionaProfessor(professor);
            return(RedirectToAction("Index"));
        }
예제 #31
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                Professor Professor;
                ProfessorDAO ProfessorDAO = new ProfessorDAO();
                Professor = ProfessorDAO.Buscar(textBox1.Text);
                textBox2.Text = Professor.Nome;
                textBox3.Text = Professor.Email;
                textBox4.Text = Professor.Telefone;
                }

            catch (Exception)
            {
                MessageBox.Show("Esse ID não está cadastrado, verifique!");
            }
        }
예제 #32
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int id = int.Parse(textBox1.Text);
                string nome = textBox2.Text;
                string email = (textBox3.Text);
                string telefone = (textBox4.Text);

                Professor Professor = new Professor(id, nome, email, telefone);

                ProfessorDAO ProfessorDAO = new ProfessorDAO();

                ProfessorDAO.Incluir(Professor);

                MessageBox.Show("Professor cadastrado com sucesso!");
            }
            catch (OracleException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #33
0
파일: SPADAO.cs 프로젝트: marlonps/OpenSARC
        /// <summary>
        /// Retorna todas as turmas cadastradas no SPA
        /// </summary>
        /// <returns></returns>
        public IList<Turma> GetTurmas(Guid calendarioId)
        {
            DbCommand cmdSelect = baseDados.GetSqlStringCommand(QueryMap.Default.Turmas);
            Entities.Turma turma = null;
            try
            {
                IList<Entities.Turma> listaAux = new List<Entities.Turma>();
                using (IDataReader leitor = baseDados.ExecuteReader(cmdSelect))
                {
                    CalendariosDAO caDAO = new CalendariosDAO();
                    DisciplinasDAO disciDAO = new DisciplinasDAO();
                    ProfessorDAO profDAO = new ProfessorDAO();
                    CursosDAO curDAO = new CursosDAO();

                    //Calendario - pega o corrente, neste caso, foi passado por parâmetro,
                    //no futuro, será variável de sessão.
                    Calendario cal = caDAO.GetCalendario(calendarioId);

                    while (leitor.Read())
                    {
                        Curso cur = null;
                        Disciplina discip = null;
                        Professor prof = null;

                        string numero = leitor.GetString(leitor.GetOrdinal("TURMA"));
                        int num = Convert.ToInt32(numero.Substring(0, 3));
                        string datahora = leitor.GetValue(leitor.GetOrdinal("HORARIO")).ToString();
                        string codigoCurso;
                        string disciplinaCodigo;
                        string matriculaProfessor;

                        //Disciplina - Turmas.CODIGO
                        try
                        {
                            disciplinaCodigo = leitor.GetValue(leitor.GetOrdinal("CODIGO")).ToString();

                            discip = disciDAO.GetDisciplina(disciplinaCodigo, calendarioId);
                        }
                        catch (Exception )
                        {
                            CriaLOG(leitor);
                            continue;
                        }

                        //Matricula do professor - Turmas.PROFESSOR
                        try
                        {
                            matriculaProfessor = leitor.GetValue(leitor.GetOrdinal("PROFESSOR1")).ToString();

                            prof = profDAO.GetProfessorByMatricula(matriculaProfessor);
                        }
                        catch (Exception )
                        {
                            CriaLOG(leitor);
                            continue;
                        }

                        //Código do curso - Turmas.CURSO
                        try
                        {
                            codigoCurso = leitor.GetValue(leitor.GetOrdinal("CURSO")).ToString();

                            cur = curDAO.GetCurso(codigoCurso);
                        }

                        catch (Exception )
                        {
                            CriaLOG(leitor);
                            continue;
                        }

                        turma = Entities.Turma.NewTurma(num, cal, discip, datahora, prof, cur);
                        listaAux.Add(turma);
                    }
                }
                return listaAux;
            }
            catch (Exception ex)
            {
                throw new DataAccessException("Erro ao ler dados.", ex);
            }
        }