Beispiel #1
0
 private void txt_CodigoAluno_Leave(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txt_CodigoAluno.Text))
     {
         try
         {
             int         id    = Convert.ToInt32(txt_CodigoAluno.Text);
             AlunosModel aluno = new AlunosRepository().ObterCodigo(id);
             if (aluno != null)
             {
                 PreencherCampos(aluno);
             }
             else
             {
                 MessageBox.Show("Registro não existente");
                 txt_CodigoAluno.Focus();
                 txt_CodigoAluno.SelectionStart  = 0;
                 txt_CodigoAluno.SelectionLength = txt_CodigoAluno.Text.Length;
             }
         }
         catch (NotFiniteNumberException ex)
         {
             MessageBox.Show("Digite um codigo valido" + ex.Message);
         }
     }
 }
Beispiel #2
0
        public CadastroAlunos(int codigo)
        {
            InitializeComponent();
            // TODO: Complete member initialization
            this.codigo = codigo;
            AlunosModel aluno = new AlunosRepository().ObterCodigo(codigo);

            PreencherCampos(aluno);
        }
 public UsuarioController(AlunosRepository alunosRepository,
                          CadforpsRepository cadforpsRepository,
                          PessoasRepository pessoasRepository,
                          ISaeHelperCookie saeHelperCookie)
 {
     this._alunosRepository   = alunosRepository;
     this._cadforpsRepository = cadforpsRepository;
     this._pessoasRepository  = pessoasRepository;
     this._saeHelperCookie    = saeHelperCookie;
 }
Beispiel #4
0
        private void btn_Excluir_Click(object sender, EventArgs e)
        {
            int  linhaSelecionada = dgv_ListaAlunos.CurrentRow.Index;
            int  codigo           = Convert.ToInt32(dgv_ListaAlunos.Rows[linhaSelecionada].Cells[0].Value.ToString());
            bool apagado          = new AlunosRepository().Apagar(codigo);

            if (apagado)
            {
                dgv_ListaAlunos.Rows.RemoveAt(linhaSelecionada);
                MessageBox.Show("Registro apagado com sucesso");
            }
            else
            {
                MessageBox.Show("Não foi possivel apagar");
            }
        }
 public UsuarioLogado(ISaeHelperSession saeHelperSession,
                      ISaeHelperCookie saeHelperCookie,
                      SaeCriptography saeCriptography,
                      AlunosRepository alunosRepository,
                      AppCfgRepository appCfgRepository,
                      CadforpsRepository cadforpsRepository,
                      PessoasRepository pessoasRepository,
                      HistoricoRepository historicoRepository)
 {
     this._saeHelperSession    = saeHelperSession;
     this._saeHelperCookie     = saeHelperCookie;
     this._saeCriptography     = saeCriptography;
     this._alunosRepository    = alunosRepository;
     this._appCfgRepository    = appCfgRepository;
     this._cadforpsRepository  = cadforpsRepository;
     this._pessoasRepository   = pessoasRepository;
     this._historicoRepository = historicoRepository;
 }
Beispiel #6
0
 public ChatController(UsuarioLogado usuarioLogado,
                       ChatDomain chatDomain,
                       GroupBuilder groupBuilder,
                       AlunosRepository alunosRepository,
                       CadforpsRepository cadforpsRepository,
                       PessoasRepository pessoasRepository,
                       ISaeHelperCookie saeHelperCookie,
                       ChatLogRepository chatLogRepository)
 {
     this._usuarioLogado      = usuarioLogado;
     this._chatDomain         = chatDomain;
     this._groupBuilder       = groupBuilder;
     this._alunosRepository   = alunosRepository;
     this._cadforpsRepository = cadforpsRepository;
     this._pessoasRepository  = pessoasRepository;
     this._saeHelperCookie    = saeHelperCookie;
     this._chatLogRepository  = chatLogRepository;
 }
Beispiel #7
0
 public ChatDomain(ISaeHelperCookie helperCookie,
                   GroupBuilder groupBuilder,
                   ChatProfessRepository chatProfessRepository,
                   AlunosRepository alunosRepository,
                   CadforpsRepository cadforpsRepository,
                   PessoasRepository pessoasRepository,
                   MhundDbContext db,
                   UsuarioLogado usuarioLogado)
 {
     this._helperCookie          = helperCookie;
     this._groupBuilder          = groupBuilder;
     this._chatProfessRepository = chatProfessRepository;
     this._alunosRepository      = alunosRepository;
     this._cadforpsRepository    = cadforpsRepository;
     this._pessoasRepository     = pessoasRepository;
     this._db            = db;
     this._usuarioLogado = usuarioLogado;
 }
Beispiel #8
0
        private void AtualizarLista()
        {
            string coluna = "nome";

            string tipoOrdenacao = "ASC";

            if (rb_Frequencia.Checked)
            {
                coluna = "frequencia";
            }
            if (rb_DESC.Checked)
            {
                tipoOrdenacao = "DESC";
            }

            dgv_ListaAlunos.Rows.Clear();
            List <AlunosModel> alunos = new AlunosRepository().obeterTodos(txt_Busca.Text, coluna, tipoOrdenacao);

            foreach (AlunosModel aluno in alunos)
            {
                dgv_ListaAlunos.Rows.Add(new object[] { aluno.Id, aluno.Nome, aluno.Nota_1, aluno.Nota_2, aluno.Nota_3, aluno.Frequencia, aluno.SituacaoAluno });
            }
        }
Beispiel #9
0
        private void btn_Salvar_Click(object sender, EventArgs e)
        {
            AlunosModel aluno = new AlunosModel();

            try
            {
                if (Utils.Exeption(Utils.ValidarMatricula(Convert.ToInt16(txt_MatriculaAluno.Text))))
                {
                    MessageBox.Show(Utils.ValidarMatricula(Convert.ToInt16(txt_MatriculaAluno.Text)));
                    txt_MatriculaAluno.Focus();
                    txt_MatriculaAluno.SelectionStart  = 0;
                    txt_MatriculaAluno.SelectionLength = txt_MatriculaAluno.Text.Length;
                    return;
                }

                else if (Utils.Exeption(Utils.ValidarNome(txt_Nome.Text)))
                {
                    MessageBox.Show(Utils.ValidarNome(txt_Nome.Text));
                    txt_Nome.Focus();
                    return;
                }
                else if (Utils.Exeption(Utils.ValidarNota(Convert.ToDouble(txt_Nota_1.Text))))
                {
                    MessageBox.Show(Utils.ValidarNota(Convert.ToDouble(txt_Nota_1.Text)));
                    txt_Nota_1.Focus();
                    txt_Nota_1.SelectionStart  = 0;
                    txt_Nota_1.SelectionLength = txt_Nota_1.Text.Length;
                    return;
                }
                else if (Utils.Exeption(Utils.ValidarNota(Convert.ToDouble(txt_Nota_2.Text))))
                {
                    MessageBox.Show(Utils.ValidarNota(Convert.ToDouble(txt_Nota_2.Text)));
                    txt_Nota_2.Focus();
                    txt_Nota_2.SelectionStart  = 0;
                    txt_Nota_2.SelectionLength = txt_Nota_2.Text.Length;

                    return;
                }
                else if (Utils.Exeption(Utils.ValidarNota(Convert.ToDouble(txt_Nota_3.Text))))
                {
                    MessageBox.Show(Utils.ValidarNota(Convert.ToDouble(txt_Nota_3.Text)));
                    txt_Nota_3.Focus();
                    txt_Nota_3.SelectionStart  = 0;
                    txt_Nota_3.SelectionLength = txt_Nota_3.Text.Length;
                    return;
                }
                else if (Utils.Exeption(Utils.ValidarFrequencia(Convert.ToInt16(txt_Frequencia.Text))))
                {
                    MessageBox.Show(Utils.ValidarFrequencia(Convert.ToInt16(txt_Frequencia.Text)));
                    txt_Frequencia.Focus();
                    txt_Frequencia.SelectionStart  = 0;
                    txt_Frequencia.SelectionLength = txt_Frequencia.Text.Length;
                    return;
                }
                else if (Utils.Exeption(Utils.ValidarMatricula(Convert.ToInt16(txt_MatriculaAluno.Text))))
                {
                    MessageBox.Show(Utils.ValidarMatricula(Convert.ToInt16(txt_MatriculaAluno.Text)));
                    txt_MatriculaAluno.Focus();
                    txt_MatriculaAluno.SelectionStart  = 0;
                    txt_MatriculaAluno.SelectionLength = txt_MatriculaAluno.Text.Length;
                    return;
                }


                aluno.Matricula     = Convert.ToInt16(txt_MatriculaAluno.Text);
                aluno.Nome          = txt_Nome.Text;
                aluno.Nota_1        = Convert.ToDouble(txt_Nota_1.Text);
                aluno.Nota_2        = Convert.ToDouble(txt_Nota_2.Text);
                aluno.Nota_3        = Convert.ToDouble(txt_Nota_3.Text);
                aluno.Frequencia    = Convert.ToInt16(txt_Frequencia.Text);
                aluno.MediaNotas    = Utils.MediaNotas(Convert.ToDouble(txt_Nota_1.Text), Convert.ToDouble(txt_Nota_2.Text), Convert.ToDouble(txt_Nota_3.Text));
                aluno.SituacaoAluno = Utils.SituacaoMedia(Utils.MediaNotas(Convert.ToDouble(txt_Nota_1.Text), Convert.ToDouble(txt_Nota_2.Text), Convert.ToDouble(txt_Nota_3.Text)));
            }
            catch (Exception)
            {
                MessageBox.Show("ERRO ao Salvar.");
                return;
            }


            if (string.IsNullOrEmpty(txt_CodigoAluno.Text))
            {
                int id = new AlunosRepository().Inserir(aluno);
                txt_CodigoAluno.Text = id.ToString();
                MessageBox.Show("Cadastrado com sucesso!");
            }
            else
            {
                int id = Convert.ToInt32(txt_CodigoAluno.Text);
                aluno.Id = id;
                bool alterou = new AlunosRepository().Alterar(aluno);
                if (alterou)
                {
                    MessageBox.Show("Alterado com sucesso!");
                }
                else
                {
                    MessageBox.Show("Não foi possível Alterar");
                }
            }
        }