Beispiel #1
0
        private void btnApagar_Click(object sender, EventArgs e)
        {
            if (dgvAluno.CurrentRow == null)
            {
                MessageBox.Show("Não tem nenhuma peça selecionada!");
                return;
            }

            int linhaSelecionada = dgvAluno.CurrentRow.Index;

            ListaAluno   alunos    = Program.alunos[linhaSelecionada];
            DialogResult resultado = MessageBox.Show("Deseja realmente apagar o registro " + alunos.Nome + "?", "AVISO", MessageBoxButtons.YesNo);

            if (resultado == DialogResult.Yes)
            {
                Program.alunos.RemoveAt(linhaSelecionada);
                MessageBox.Show("Registro apagado com sucesso!");
                AtualizarListaAlunos();
            }
            else
            {
                MessageBox.Show("Registro não apagado.");
            }
            LimparCamposAluno();
        }
Beispiel #2
0
        public void InserirInformacoesDoAlunoNoCadastro()
        {
            ListaAluno aluno = Program.alunos.Find(x =>
                                                   x.Nome == Convert.ToString(this.dgvAluno.CurrentRow.Cells["ColumnNomeAluno"].Value));


            this.txtNomeAluno.Text         = aluno.Nome;
            this.cbSexoAluno.Text          = aluno.Sexo;
            this.mtbCpfAluno.Text          = aluno.CPF;
            this.cbTurno.Text              = aluno.Turno;
            this.cbNacionalidadeAluno.Text = aluno.Nacionalidade;
            this.txtRgAluno.Text           = aluno.RG;
            this.cbTurma.Text              = aluno.Turma;
            this.mtbCep.Text                     = aluno.Cep;
            this.nudNumeroCasa.Value             = aluno.NumeroCasa;
            this.txtComplemento.Text             = aluno.Complemento;
            this.txtMatriculaAluno.Text          = aluno.NumeroMatricula;
            this.cbTurma.Text                    = aluno.Turma;
            this.cbSexoResponsavel.Text          = aluno.SexoResponsavel;
            this.txtRgResponsavel.Text           = aluno.RGResponsavel;
            this.mtbCpfResponsavel.Text          = aluno.CPFResponsavel;
            this.txtNomeResponsavel.Text         = aluno.NomeResponsavel;
            this.mtbTelefone.Text                = aluno.TelefoneResponsavel;
            this.cbNacionalidadeResponsavel.Text = aluno.Nacionalidade;

            CEP buscarcep = new CEP(mtbCep.Text);

            this.txtBairo.Text      = buscarcep.bairro;
            this.txtCidade.Text     = buscarcep.localidade;
            this.txtLogradouro.Text = buscarcep.logradouro;
            this.txtUf.Text         = buscarcep.uf;
        }
        private void cb_Media_CheckedChanged(object sender, EventArgs e)
        {
            if (cb_Media.Checked)
            {
                int quantidadeNome = 0;
                for (int i = 0; i < Program.produtos.Count; i++)
                {
                    ListaProfessor   professor   = Program.professores[i];
                    ListaFuncionario funcionario = Program.funcionarios[i];
                    ListaAluno       aluno       = Program.alunos[i];
                    ListaAlimento    alimento    = Program.alimentos[i];
                    ListaEquipamento equipamento = Program.equipamentos[i];
                    ListaProduto     produto     = Program.produtos[i];

                    quantidadeNome = professor.Nome.Length + funcionario.Nome.Length + aluno.Nome.Length + alimento.Nome.Length + equipamento.Nome.Length + produto.Nome.Length;
                }

                double mediaNome      = quantidadeNome / 6;
                double mediaCadastros = (Program.produtos.Count + Program.alimentos.Count + Program.equipamentos.Count + Program.alunos.Count + Program.professores.Count + Program.funcionarios.Count) / 6;

                this.chart_Financeiro.Series[2].Points.AddXY("Media Cadastros: ", mediaCadastros);
                this.chart_Financeiro.Series[2].Points.AddXY("Media Nomes: ", mediaNome);
            }
            else
            {
                chart_Financeiro.Series[2].Points.Clear();
            }
        }
Beispiel #4
0
        private void btnEditar_Click(object sender, EventArgs e)
        {
            if (dgvAlimento.CurrentRow == null)
            {
                MessageBox.Show("Não tem nenhum Alimento selecionada!");
                return;
            }

            posicao = dgvAlimento.CurrentRow.Index;
            ListaAluno listaAlunos = Program.alunos[posicao];

            InserirInformacoesDoAlimentoNoCadastro();
        }
Beispiel #5
0
        public void AtualizarListaAlunos()
        {
            dgvAluno.Rows.Clear();
            string busca = txtBuscarAluno.Text.ToLower();

            for (int i = 0; i < Program.alunos.Count; i++)
            {
                ListaAluno alunos = Program.alunos[i];
                if ((alunos.Nome.ToLower().Contains(busca)) || (alunos.Cep.ToLower().Contains(busca)) || (alunos.Sexo.ToLower().Contains(busca)) || (alunos.Turma.ToLower().Contains(busca)))
                {
                    dgvAluno.Rows.Add(new object[] {
                        alunos.Nome, alunos.Sexo, alunos.Cep, alunos.Turno, alunos.Turma
                    });
                }
            }
        }
Beispiel #6
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNomeAluno.Text.Length < 4)
                {
                    MessageBox.Show("Nome do Aluno deve conter no mínimo 4 caracteres. Digite o nome completo.");
                    tabControlAlunos.SelectTab("tpAluno");
                    txtNomeAluno.Focus();
                    return;
                }

                if (cbSexoAluno.SelectedIndex < 0)
                {
                    MessageBox.Show("Selecione o sexo do aluno.");
                    tabControlAlunos.SelectTab("tpAluno");
                    cbSexoAluno.DroppedDown = true;
                    return;
                }

                if (cbNacionalidadeAluno.SelectedIndex < 0)
                {
                    MessageBox.Show("Selecione a nacionalidade do aluno.");
                    tabControlAlunos.SelectTab("tpAluno");
                    cbNacionalidadeAluno.DroppedDown = true;
                    return;
                }

                if (!Tools.validarCPF(mtbCpfAluno.Text))
                {
                    MessageBox.Show("CPF inválido.");
                    tabControlAlunos.SelectTab("tpAluno");
                    mtbCpfAluno.Focus();
                    return;
                }

                if (txtRgAluno.Text.Length < 6)
                {
                    MessageBox.Show("Informe um RG válido.");
                    tabControlAlunos.SelectTab("tpAluno");
                    txtRgAluno.Focus();
                    return;
                }

                if (dtpDataNascimentoAluno.Value > DateTime.Now) // TODO: Falta Colocar idade minima
                {
                    MessageBox.Show("Data de nascimento deve ser hoje ou uma data anterior.");
                    tabControlAlunos.SelectTab("tpAluno");
                    dtpDataNascimentoAluno.Focus();
                    return;
                }

                if (cbTurno.SelectedIndex < 0)
                {
                    MessageBox.Show("Selecione um turno.");
                    tabControlAlunos.SelectTab("tpAluno");
                    cbTurno.DroppedDown = true;
                    return;
                }

                if (cbTurma.SelectedIndex < 0)
                {
                    MessageBox.Show("Selecione uma Turma");
                    tabControlAlunos.SelectTab("tpAluno");
                    cbTurma.DroppedDown = true;
                    return;
                }

                if (!Tools.ValidaCEP(mtbCep.Text))
                {
                    MessageBox.Show("CEP inválido.");
                    tabControlAlunos.SelectTab("tpEndereco");
                    mtbCep.Focus();
                    return;
                }

                if (nudNumeroCasa.Value <= 0)
                {
                    MessageBox.Show("Informe um de número da casa válido.");
                    tabControlAlunos.SelectTab("tpEndereco");
                    nudNumeroCasa.Focus();
                    return;
                }

                ListaAluno alunos = new ListaAluno()
                {
                    Nome          = txtNomeAluno.Text,
                    Sexo          = cbSexoAluno.SelectedItem.ToString(),
                    Nacionalidade = cbNacionalidadeAluno.SelectedItem.ToString(),
                    CPF           = mtbCpfAluno.Text,
                    RG            = txtRgAluno.Text,
                    Turno         = cbTurno.SelectedItem.ToString(),
                    Turma         = cbTurma.SelectedItem.ToString(),
                    Nascimento    = dtpDataNascimentoAluno.Value,
                    Cep           = mtbCep.Text,
                    NumeroCasa    = Convert.ToInt32(nudNumeroCasa.Value),
                    Complemento   = txtComplemento.Text
                };

                int linhaposicao = dgvAluno.CurrentRow.Index;

                if (linhaposicao == -1)
                {
                    Program.alunos.Add(alunos);
                    MessageBox.Show("Cadastro realizado com sucesso!");
                }
                else
                {
                    Program.alunos[linhaposicao] = alunos;
                    MessageBox.Show("Cadastro alterado com sucesso!");
                }
                LimparCamposAluno();
                AtualizarListaAlunos();
            }
            catch (Exception)
            {
                MessageBox.Show("Erro!");
                return;
            }
        }
        private void cb_Maior_CheckedChanged(object sender, EventArgs e)
        {
            if (cb_Maior.Checked)
            {
                int    maiorFuncionario = 0, maiorProfessor = 0, maiorAluno = 0, maiorAlimento = 0, maiorEquipamento = 0, maiorProduto = 0;
                string nomeAluno = "", nomeFuncionario = "", nomeProfessor = "", nomeAlimento = "", nomeEquipamento = "", nomeProduto = "";
                for (int i = 0; i < Program.funcionarios.Count; i++)
                {
                    ListaFuncionario funcionario = Program.funcionarios[i];

                    if (funcionario.Nome.Length > maiorFuncionario)
                    {
                        maiorFuncionario = funcionario.Nome.Length;
                        nomeFuncionario  = funcionario.Nome;
                    }
                }

                for (int i = 0; i < Program.professores.Count; i++)
                {
                    ListaProfessor professor = Program.professores[i];
                    if (professor.Nome.Length > maiorProfessor)
                    {
                        maiorProfessor = professor.Nome.Length;
                        nomeProfessor  = professor.Nome;
                    }
                }
                for (int i = 0; i < Program.alunos.Count; i++)
                {
                    ListaAluno aluno = Program.alunos[i];
                    if (aluno.Nome.Length > maiorAluno)
                    {
                        maiorAluno = aluno.Nome.Length;
                        nomeAluno  = aluno.Nome;
                    }
                }
                for (int i = 0; i < Program.alimentos.Count; i++)
                {
                    ListaAlimento alimento = Program.alimentos[i];
                    if (alimento.Nome.Length > maiorAlimento)
                    {
                        maiorAlimento = alimento.Nome.Length;
                        nomeAlimento  = alimento.Nome;
                    }
                }
                for (int i = 0; i < Program.equipamentos.Count; i++)
                {
                    ListaEquipamento equipamento = Program.equipamentos[i];
                    if (equipamento.Nome.Length > maiorEquipamento)
                    {
                        maiorEquipamento = equipamento.Nome.Length;
                        nomeEquipamento  = equipamento.Nome;
                    }
                }
                for (int i = 0; i < Program.produtos.Count; i++)
                {
                    ListaProduto produto = Program.produtos[i];
                    if (produto.Nome.Length > maiorEquipamento)
                    {
                        maiorProduto = produto.Nome.Length;
                        nomeProduto  = produto.Nome;
                    }
                }
                this.chart_Financeiro.Series[0].Points.AddXY("Maior Nome Funcionario: " + nomeFuncionario, maiorFuncionario);
                this.chart_Financeiro.Series[0].Points.AddXY("Maior Nome Professor: " + nomeProfessor, maiorProfessor);
                this.chart_Financeiro.Series[0].Points.AddXY("Maior Nome Aluno: " + nomeAluno, maiorAluno);
                this.chart_Financeiro.Series[0].Points.AddXY("Maior Nome Alimento: " + nomeAlimento, maiorAlimento);
                this.chart_Financeiro.Series[0].Points.AddXY("Maior Nome Equipamento: " + nomeEquipamento, maiorEquipamento);
                this.chart_Financeiro.Series[0].Points.AddXY("Maior Nome produto: " + nomeProduto, maiorProduto);
            }
            else
            {
                chart_Financeiro.Series[0].Points.Clear();
            }
        }