Ejemplo n.º 1
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                Banco banco = (Banco)bancoBindingSource.Current;

                if (estado.Equals(EstadoFormulario.INSERIR))
                {
                    int codBanco = (int)GerenciadorBanco.GetInstace().inserir(banco);
                    codBancoTextBox.Text = codBanco.ToString();
                }
                else
                {
                    GerenciadorBanco.GetInstace().atualizar(banco);
                }
                bancoBindingSource.EndEdit();
            }
            catch (DadosException de)
            {
                bancoBindingSource.CancelEdit();
                throw de;
            }
            finally
            {
                bancoBindingSource.ResumeBinding();
                habilitaBotoes(true);
                btnBuscar.Focus();
            }
        }
        private void btn_salvar_Click(object sender, EventArgs e)
        {
            if (cmb_codTurma.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione uma turma válida da lista!", "Erro");
                return;
            }

            if (cmb_aluno.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione um aluno válido da lista!", "Erro");
                return;
            }
            string[] codTurma = cmb_codTurma.SelectedItem.ToString().Split('|');
            string[] codAluno = cmb_aluno.SelectedItem.ToString().Split('|');

            if (Verifica.AlunoCadastrado(codAluno[0].Trim(), codTurma[0].Trim()))
            {
                MessageBox.Show("Aluno já matriculado nesta turma.", "Impossível cadastrar!");
                return;
            }

            if (!(Verifica.PodeMatricular(codTurma[0].Trim())))
            {
                MessageBox.Show("Limite máximo de alunos atingidos.", "Impossível cadastrar!");
                return;
            }

            if (GerenciadorBanco.CadastrarMatricula(int.Parse(codTurma[0]), int.Parse(codAluno[0])))
            {
                MessageBox.Show("Aluno matriculado com sucesso!");
            }
        }
        private void btn_salvarCurso_Click(object sender, EventArgs e)
        {
            if (!(txt_nomeCurso.Text.Trim().Length != 0 && Verifica.Moeda(txt_vMatricula.Text.Trim()) &&
                  Verifica.Moeda(txt_vTotal.Text.Trim()) &&
                  txt_vMulta.Text.Trim().ToString().Length != 0 && Verifica.Moeda(txt_vRescisao.Text.Trim()) &&
                  txt_meses.Text.Trim().Length != 0 &&
                  txt_modulos.Text.Trim().Length != 0 && msk_horas.Text.Trim().Length != 0 &&
                  (cmb_dias.SelectedIndex + 1).ToString().Length != 0))
            {
                MessageBox.Show("Verifique se todos os campos foram preenchidos corretamente " +
                                "e se nenhum campo obrigatório foi deixado em branco",
                                "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string nome       = txt_nomeCurso.Text.Trim(),
                   vMatricula = txt_vMatricula.Text.Trim(),
                   total      = txt_vTotal.Text.Trim(),
                   multa      = txt_vMulta.Text.Trim(),
                   rescisao   = txt_vRescisao.Text.Trim(),
                   meses      = txt_meses.Text.Trim(),
                   horas      = msk_horas.Text.Trim(),
                   aulaSem    = (cmb_dias.SelectedIndex + 1).ToString(),
                   descricao  = txt_descricaoCurso.Text.Trim(),
                   modulos    = txt_modulos.Text.Trim();

            FormCadastrarModulo form = new FormCadastrarModulo(int.Parse(modulos), GerenciadorBanco.GetCodCurso() + 1, nome, descricao, meses, horas,
                                                               aulaSem, vMatricula, float.Parse(total), float.Parse(multa), float.Parse(rescisao));

            form.ShowDialog();
            return;
        }
        private void btn_salvarResp_Click(object sender, EventArgs e)
        {
            string nome       = txt_nomeResp.Text.Trim(),
                   rg         = msk_rgResp.Text.Trim(),
                   cpf        = msk_cpfResp.Text.Trim(),
                   nasc       = msk_nascResp.Text.Trim(),
                   dddResp    = msk_dddResp.Text.Trim(),
                   telResp    = msk_telResp.Text.Trim(),
                   dddAltResp = msk_dddAltResp.Text.Trim(),
                   telAltResp = msk_telAltResp.Text.Trim(),
                   endereco   = txt_enderecoResp.Text.Trim(),
                   bairro     = txt_bairroResp.Text.Trim(),
                   cidade     = txt_cidadeResp.Text.Trim();
            char   sexo       = ' ';
            string Ano        = "";

            Ano = msk_nascResp.Text.Trim();
            Ano = Ano[6].ToString() + Ano[7].ToString() + Ano[8].ToString() +
                  Ano[9].ToString();

            if (Verifica.Vazio(nome) && Verifica.RG(rg) &&
                Verifica.CPF(cpf) && Verifica.DDDeTelefone(dddResp, telResp) &&
                Verifica.DDDeTelefoneALT(dddAltResp, telAltResp) &&
                Verifica.Vazio(endereco) && Verifica.Vazio(bairro) &&
                Verifica.Vazio(cidade) && Verifica.Maior(nasc) &&
                rd_F.Checked || rd_M.Checked)
            {
                if (rd_F.Checked)
                {
                    sexo = 'f';
                }
                if (rd_M.Checked)
                {
                    sexo = 'm';
                }

                string telefone    = dddResp + telResp,
                       telefoneAlt = dddAltResp + telAltResp;

                if (GerenciadorBanco.CadastrarResponsavel(nome, rg, cpf, nasc, sexo, telefone,
                                                          telefoneAlt, endereco, bairro, cidade))
                {
                    MessageBox.Show("Responsável cadastrado com sucesso!");
                    codResp = GerenciadorBanco.GetCodResp();
                    this.Close();
                    return;
                }
                else
                {
                    MessageBox.Show("Erro ao cadastrar responsável!", "Erro!", MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Verifique se todos os campos foram preenchidos corretamente " +
                                "e se nenhum campo obrigatório foi deixado em branco",
                                "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 5
0
 private void FrmContaBanco_Load(object sender, EventArgs e)
 {
     GerenciadorSeguranca.getInstance().verificaPermissao(this, Global.CONTAS_BANCO_CAIXA, Principal.Autenticacao.CodUsuario);
     bancoBindingSource.DataSource      = GerenciadorBanco.GetInstace().ObterTodos();
     contaBancoBindingSource.DataSource = GerenciadorContaBanco.GetInstance().ObterTodos();
     habilitaBotoes(true);
 }
Ejemplo n.º 6
0
        private void btn_gerar_Click(object sender, EventArgs e)
        {
            if (cmb_situacao.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione uma situação válida da lista!");
                return;
            }

            if (cmb_cursos.SelectedIndex > -1 && cmb_situacao.SelectedIndex == 0)
            {
                dgv_alunos.DataSource = GerenciadorBanco.rAlunosAtivosCurso(cmb_cursos.SelectedItem.ToString());
                return;
            }

            if (cmb_situacao.SelectedIndex == 0)
            {
                dgv_alunos.DataSource = GerenciadorBanco.rAlunoTodosCurso();
                return;
            }

            if (cmb_cursos.SelectedIndex < 0)
            {
                dgv_alunos.DataSource = GerenciadorBanco.rAlunoTodosCursoSituacao(cmb_situacao.SelectedItem.ToString());
                return;
            }
        }
Ejemplo n.º 7
0
 public FormCadastrarProfessor()
 {
     InitializeComponent();
     msk_admissaoProf.Text      = DateTime.Now.ToString();
     pic_fotoProf.ImageLocation = @"C:\Projeto\user.png";
     rd_A.Checked     = true;
     txt_codProf.Text = (GerenciadorBanco.GetCodProf() + 1).ToString();
 }
 public FormCadastradarAluno(string texto)
 {
     InitializeComponent();
     pic_fotoAluno.ImageLocation = caminhoImagem;
     this.Text         = texto;
     txt_codAluno.Text = (GerenciadorBanco.GetCodAluno() + 1).ToString();
     rd_I.Checked      = true;
 }
Ejemplo n.º 9
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Confirma exclusão?", "Confirmar Exclusão", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         GerenciadorBanco.GetInstace().remover(int.Parse(codBancoTextBox.Text));
         bancoBindingSource.RemoveCurrent();
     }
     btnBuscar.Focus();
 }
        public static bool PodeMatricular(string codTurma)
        {
            if (GerenciadorBanco.GetQtdMatriculas(codTurma) >= GerenciadorBanco.GetQtdAluno(codTurma))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 11
0
 private void txtTexto_TextChanged(object sender, EventArgs e)
 {
     if ((cmbBusca.SelectedIndex == 1) && !txtTexto.Text.Equals(""))
     {
         bancoBindingSource.DataSource = GerenciadorBanco.GetInstace().Obter(int.Parse(txtTexto.Text));
     }
     else
     {
         bancoBindingSource.DataSource = GerenciadorBanco.GetInstace().ObterPorNome(txtTexto.Text);
     }
 }
Ejemplo n.º 12
0
 private void btn_consultarResponsavel_Click(object sender, EventArgs e)
 {
     if (txt_nomeResponsavel.Text.Trim().Length == 0)
     {
         dgv_pesquisaResponsavel.DataSource = GerenciadorBanco.getResponsavel();
     }
     else
     {
         dgv_pesquisaResponsavel.DataSource = GerenciadorBanco.getResponsavelPorNome(txt_nomeResponsavel.Text.Trim());
     }
 }
        private void cmb_cursos_Leave(object sender, EventArgs e)
        {
            if (cmb_cursos.SelectedIndex < 0)
            {
                return;
            }

            diasCadastrados = GerenciadorBanco.GetDiasPorSemana((string)cmb_cursos.SelectedItem);

            modulos = true;
        }
Ejemplo n.º 14
0
 private void btn_consultar_Click(object sender, EventArgs e)
 {
     if (txt_nomeAluno.Text.Trim().Length == 0)
     {
         dgv_pesquisaAluno.DataSource = GerenciadorBanco.getAluno();
     }
     else
     {
         dgv_pesquisaAluno.DataSource = GerenciadorBanco.getAlunoPorNome(txt_nomeAluno.Text.Trim());
     }
 }
 public static bool Maior(string dataNasc)
 {
     if (GerenciadorBanco.GetIdade(dataNasc) < 18)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        private void cmb_codTurma_DropDown(object sender, EventArgs e)
        {
            if (cmb_codTurma.Text.Length > 0)
            {
                return;
            }

            string[] turmas = GerenciadorBanco.getListaTotalTurma().ToArray();
            cmb_codTurma.Items.Clear();
            cmb_codTurma.Items.AddRange(turmas);
            return;
        }
        // Drop Down
        private void cmb_professor_DropDown(object sender, EventArgs e)
        {
            if (cmb_professor.Text.Length > 0)
            {
                return;
            }

            string[] prof_total = GerenciadorBanco.getListaTotalProf().ToArray();
            cmb_professor.Items.Clear();
            cmb_professor.Items.AddRange(prof_total);
            return;
        }
        private void cmb_cursos_DropDown(object sender, EventArgs e)
        {
            if (cmb_cursos.Text.Length > 0)
            {
                return;
            }

            string[] nomes_cursos = GerenciadorBanco.getListaTotalCurso().ToArray();
            cmb_cursos.Items.Clear();
            cmb_cursos.Items.AddRange(nomes_cursos);
            return;
        }
        // Drop Box, lista dados
        private void cmb_aluno_DropDown(object sender, EventArgs e)
        {
            if (cmb_aluno.Text.Length > 0)
            {
                return;
            }

            string[] alunos = GerenciadorBanco.getListaTotalNomeCodAluno().ToArray();
            cmb_aluno.Items.Clear();
            cmb_aluno.Items.AddRange(alunos);
            return;
        }
        // Btn Salvar
        private void btn_salvar_Click(object sender, EventArgs e)
        {
            if (cmb_cursos.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione um curso válido da lista!");
                return;
            }

            if (cmb_modulos.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione um módulo válido da lista!");
                return;
            }

            if (cmb_professor.SelectedIndex < 0)
            {
                MessageBox.Show("Selecione um professor válido da lista!");
                return;
            }


            if (!(txt_maxAlunos.Text.Length > 0 && msk_horarioInicial.Text.Length == 5 && diasSemana.Count() > 0 && msk_inicio.Text.Length == 10))
            {
                MessageBox.Show("Verifique se todos os campos foram preenchidos corretamente e/ou se nenhum campo foi deixado em branco.", "Erro!");
                return;
            }

            string curso = (string)cmb_cursos.SelectedItem;

            string[] professor      = cmb_professor.SelectedItem.ToString().Split('(');
            string   horarioInicial = msk_horarioInicial.Text.Trim();
            string   inicioAulas    = msk_inicio.Text.Trim();
            int      maxAluno       = int.Parse(txt_maxAlunos.Text.Trim());
            string   modulo         = GerenciadorBanco.GetCodModuloReal(cmb_modulos.SelectedItem.ToString(), curso);


            if (diasClicados < diasCadastrados)
            {
                int dias = diasCadastrados - diasClicados;
                MessageBox.Show("Falta(m) " + dias.ToString() + " dia(s) para ser(em) selecionado(s)!");
                return;
            }

            if (GerenciadorBanco.CadastrarTurma(int.Parse(modulo), maxAluno, diasSemana, horarioInicial, GerenciadorBanco.GetCodProfPorNome(professor[0]), inicioAulas))
            {
                MessageBox.Show("Turma cadastrada com sucesso!");
            }
            else
            {
                MessageBox.Show("Erro ao cadastrar turma!");
            }
        }
 private void txt_consultaCurso_Click(object sender, EventArgs e)
 {
     {
         if (txt_nomeCurso.Text.Trim().Length == 0)
         {
             dgv_pesquisaCurso.DataSource = GerenciadorBanco.getCurso();
         }
         else
         {
             dgv_pesquisaCurso.DataSource = GerenciadorBanco.getCursoPorNome(txt_nomeCurso.Text.Trim());
         }
     }
 }
 private void btn_consultarProfessor_Click(object sender, EventArgs e)
 {
     {
         if (txt_nomeProfessor.Text.Trim().Length == 0)
         {
             dgv_pesquisaProfessor.DataSource = GerenciadorBanco.getProfessor();
         }
         else
         {
             dgv_pesquisaProfessor.DataSource = GerenciadorBanco.getProfessorPorNome(txt_nomeProfessor.Text.Trim());
         }
     }
 }
Ejemplo n.º 23
0
 private void btn_consultaModulo_Click(object sender, EventArgs e)
 {
     {
         if (txt_consultaModulo.Text.Trim().Length == 0)
         {
             dgv_pesquisaModulo.DataSource = GerenciadorBanco.getModulo();
         }
         else
         {
             dgv_pesquisaModulo.DataSource = GerenciadorBanco.getModuloPorCurso(txt_consultaModulo.Text.Trim());
         }
     }
 }
Ejemplo n.º 24
0
 private void btn_consultarTurma_Click(object sender, EventArgs e)
 {
     {
         if (txt_consultaTurma.Text.Trim().Length == 0)
         {
             dgv_pesquisaTurma.DataSource = GerenciadorBanco.getTurma();
         }
         else
         {
             dgv_pesquisaTurma.DataSource = GerenciadorBanco.getTurmaPorCurso(txt_consultaTurma.Text.Trim());
         }
     }
 }
        public static bool AlunoCadastrado(string codAluno, string codTurma)
        {
            List <string> listaMatriculas = GerenciadorBanco.getListaMatriculados(codTurma);

            for (int i = 0; i < listaMatriculas.Count(); ++i)
            {
                if (listaMatriculas[i] == codAluno)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 26
0
        private void btn_salvarProf_Click(object sender, EventArgs e)
        {
            if (!(txt_nomeProf.Text.Trim().Length > 0 && Verifica.RG(msk_rgProf.Text.Trim()) &&
                  Verifica.Email(txt_emailProf.Text.Trim()) &&
                  Verifica.DDDeTelefone(msk_dddProf.Text.Trim(), msk_telProf.Text.Trim()) &&
                  Verifica.DDDeTelefoneALT(msk_dddAltProf.Text.Trim(), msk_telAltProf.Text.Trim()) &&
                  msk_admissaoProf.Text.Trim().Length == 10 &&
                  Verifica.Maior(msk_nascProf.Text.Trim()) &&
                  (rd_F.Checked || rd_M.Checked)))
            {
                MessageBox.Show("Verifique se todos os campos foram preenchidos corretamente " +
                                "e se nenhum campo obrigatório foi deixado em branco",
                                "Erro! Campos com erros!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string nome     = txt_nomeProf.Text.Trim(),
                   rg       = msk_rgProf.Text.Trim(),
                   cpf      = msk_cpfProf.Text.Trim(),
                   nasc     = msk_nascProf.Text.Trim(),
                   email    = txt_emailProf.Text.Trim(),
                   ddd      = msk_dddProf.Text.Trim(),
                   tel      = msk_telProf.Text.Trim(),
                   dddAlt   = msk_dddAltProf.Text.Trim(),
                   telAlt   = msk_telAltProf.Text.Trim(),
                   endereco = txt_enderecoProf.Text.Trim(),
                   bairro   = txt_bairroProf.Text.Trim(),
                   cidade   = txt_cidadeProf.Text.Trim(),
                   admissao = msk_admissaoProf.Text.Trim();
            char sexo       = ' ';

            if (rd_F.Checked)
            {
                sexo = 'f';
            }
            if (rd_M.Checked)
            {
                sexo = 'm';
            }

            string telefoneAlt = dddAlt + telAlt,
                   telefone    = ddd + tel;

            if (GerenciadorBanco.CadastrarProfessor(nome, rg, cpf, nasc, sexo, email, telefone, telefoneAlt,
                                                    endereco, bairro, cidade, admissao, caminhoImagem))
            {
                MessageBox.Show("Professor cadastrado com sucesso!");
                return;
            }
        }
        public static bool ProfessorExiste(string PROFESSOR)
        {
            List <string> listaProf = GerenciadorBanco.getListaTotalProf();

            for (int i = 0; i < listaProf.Count(); ++i)
            {
                if (listaProf[i] == PROFESSOR)
                {
                    return(true);
                }
            }

            return(false);
        }
        public static bool CursoExiste(string CURSO)
        {
            List <string> listaCursos = GerenciadorBanco.getListaTotalCurso();

            for (int i = 0; i < listaCursos.Count(); ++i)
            {
                if (listaCursos[i] == CURSO)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 29
0
        public static void RealizarCalculo(decimal salarioMinimo)
        {
            var contribuintes = new GerenciadorBanco().ContribuinteRepositorio.BuscarTodos();

            foreach (var contribuinte in contribuintes)
            {
                CalculadorRenda.Calcular(contribuinte, salarioMinimo);
                contribuinte.ValorImpostoRenda = CalculadorImpostoFactory.
                                                 CreateInstance(contribuinte.QuantidadeSalarios).
                                                 Calcular(contribuinte.RendaLiquida);

                using (var contribuinteEdicao = new ContribuinteDao())
                {
                    contribuinteEdicao.Alterar(contribuinte);
                }
            }
        }
        // Preview Key Down
        private void cmb_cursos_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyData == Keys.Up || e.KeyData == Keys.Down || cmb_cursos.Text.Length == 0 || e.KeyData == Keys.Left || e.KeyData == Keys.Right)
            {
                return;
            }

            if (e.KeyValue == 8)
            {
                return;
            }

            string[] nomes = GerenciadorBanco.getListaCursos(cmb_cursos.Text).ToArray();
            cmb_cursos.DroppedDown = nomes.Length > 0 ? true : false;
            cmb_cursos.Items.Clear();
            cmb_cursos.Items.AddRange(nomes);
            cmb_cursos.SelectionStart = cmb_cursos.Text.Length;
        }