Пример #1
0
        private void btAtivarMembro_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtMatricula.Text))
            {
                MessageBox.Show("Selecione um nome na lista para ativar!", "Atenção");
                return;
            }

            try
            {
                int    codigo = Convert.ToInt32(txtMatricula.Text);
                string strTp  = "S";

                DalHelper.Delete(codigo, strTp);
                ExibirDados(false);
                MessageBox.Show("O membro foi ativado!", "Atenção");
                LimpaDados();
                desabilitarBotoes();
                picFoto.Load("C:\\Program IBNFU\\Fotos\\Sem Foto.jpg");
                //picFoto.SizeMode = PictureBoxSizeMode.StretchImage;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #2
0
        } //FECHA BTNCRIARTABELAEVENTOS

        private void RetQtdTpCadastro()
        {
            DataTable dt = new DataTable();

            dt = DalHelper.GetQtdTpCadastro();

            DataRow[] oDataRow = dt.Select();

            foreach (DataRow dr in oDataRow)
            {
                if (dr[1].ToString() == "Ficha de Membro")
                {
                    lblMembro.Text = dr[0].ToString();
                }
                if (dr[1].ToString() == "Recebeu Jesus")
                {
                    lblRetJesus.Text = dr[0].ToString();
                }
                if (dr[1].ToString() == "Ficha de Batismo")
                {
                    lblBatizou.Text = dr[0].ToString();
                }
                if (dr[1].ToString() == "Ficha de Transferencia")
                {
                    lblTransf.Text = dr[0].ToString();
                }
                if (dr[1].ToString() == "Ficha de Visita")
                {
                    lblVisit.Text = dr[0].ToString();
                }
                // Aniversariants
            }
        }
Пример #3
0
        private void ExibirDados(bool pesquisa)
        {
            string stid = txtMatPesquisa.Text;
            string stnm = txtNmPesquisa.Text;

            try
            {
                DataTable dt = new DataTable();
                dt = DalHelper.GetMembro(pesquisa, stid, stnm);

                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("Membro não encontrado!");
                    return;
                }

                dgvDados.DataSource          = dt;
                dgvDados.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                //dgvDados.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                DesativaFicha();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #4
0
        private void RetronaQtdNascimento()
        {
            try
            {
                DataTable dt = new DataTable();
                dt = DalHelper.GetQtdNascimento();

                DataRow[] oDataRow = dt.Select();

                // iniciar os label's
                lblLocalNasc.Text   = "0";
                lblVisitasNasc.Text = "0";

                foreach (DataRow dr in oDataRow)
                {
                    // totaliza os label's
                    if (dr[1].ToString() == "S") // se membro for local
                    {
                        lblLocalNasc.Text = dr[0].ToString();
                    }
                    if (dr[1].ToString() == "N") // se membro for visitante
                    {
                        lblVisitasNasc.Text = dr[0].ToString();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Não foi possivel carregar quantidade de crianças apresentadas!", "ATENÇÃO");
            }
        }
Пример #5
0
        } // ENCERRAR BTNENCERRAR

        private void btnCriarTabelaEvento_Click(object sender, EventArgs e)
        {
            try
            {
                DalHelper.CriarTabelaSQlite();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        } //FECHA BTNCRIARTABELAEVENTOS
Пример #6
0
        }// btnCadNascimento_Click

        private void btnPesquisa_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            string tp = "";

            if (rdRelMembro.Checked == true)
            {
                tp = "Membro";
            }
            else if (rdNascimentos.Checked == true)
            {
                tp = "Rg_Nascimento";
            }
            else if (rdRelCasamento.Checked == true)
            {
                tp = "Rg_Casamento";
            }
            else
            {
                MessageBox.Show("Você precisa selecionar o tipo de Relatório que deseja!");
                Cursor = Cursors.Default;
                return;
            }

            string dt_ini, dt_fim, Qtd;

            lblQtd.Text = "Total: ";

            dt_ini = txtDt_inicio.Text;
            dt_fim = txtDt_fim.Text;

            DataTable dt = new DataTable();

            dt = DalHelper.GetRelatorio(tp, dt_ini, dt_fim);

            Qtd = Convert.ToString(dt.Rows.Count);

            lblQtd.Text = lblQtd.Text + Qtd;

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("Não houve dados para esse relatório.");
                Cursor = Cursors.Default;
                return;
            }

            dgvRelDados.DataSource          = dt;
            dgvRelDados.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            btnGerarRelatorio.Enabled = true;

            Cursor = Cursors.Default;
        }// btnPesquisa_Click
Пример #7
0
 private void btnCriarTabela_Click(object sender, EventArgs e)
 {
     try
     {
         DalHelper.CriarTabelaSQlite();
         btnCriarTabela.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro : " + ex.Message);
     }
 }
Пример #8
0
 private void btnCriarBancoDados_Click(object sender, EventArgs e)
 {
     try
     {
         DalHelper.CriarBancoSQLite();
         btnCriarBancoDados.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Erro : " + ex.Message);
     }
 }
Пример #9
0
        private void btnAtualizarDados_Click(object sender, EventArgs e)
        {
            if (!Valida("Atualizar"))
            {
                //MessageBox.Show("Informe os dados cliente a atualizar", "Atenção");
                return;
            }

            try
            {
                Membro cli = new Membro();
                cli.Id              = Convert.ToInt32(txtMatricula.Text);
                cli.Nome            = txtNome.Text;
                cli.datanascimento  = txtDataNasc.Text;
                cli.nmpai           = txtNmPai.Text;
                cli.nmmae           = txtNmMae.Text;
                cli.estadocivil     = txtEstadoCivil.Text;
                cli.idade           = txtIdade.Text;
                cli.profissao       = txtProfissao.Text;
                cli.endereco        = txtEndereco.Text;
                cli.numero          = txtNumero.Text;
                cli.bairro          = txtBairro.Text;
                cli.cidade          = txtCidade.Text;
                cli.referencia      = txtReferencia.Text;
                cli.cep             = txtCep.Text.Replace("-", "");
                cli.telefone1       = txtTelefone1.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                cli.telefone2       = txtTelefone2.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                cli.databatismo     = txtDataBatismo.Text;
                cli.nmigreja        = txtNmIgreja.Text;
                cli.nmpastor        = txtNmPastor.Text;
                cli.tempofrequencia = txtTempoIgreja.Text;
                cli.cargo           = txtCargo.Text;
                cli.funcao          = txtFuncao.Text;
                cli.grupo           = txtGrupo.Text;
                cli.sexo            = strSexo;
                cli.tpcadastro      = strTpCadastro;
                //cli.log = strlog;

                DalHelper.Update(cli);
                ExibirDados(false);
                MessageBox.Show("Dados atualizados com sucesso!");
                LimpaDados();
                desabilitarBotoes();
                pnGrid.Enabled     = true;
                rdFeminino.Checked = false;
                rdMasc.Checked     = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #10
0
        private void cbEstadoCivil_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable      dt = new DataTable();
            CarregaDadosBD bd = new CarregaDadosBD();

            bd.EstadoCivil = cbEstadoCivil.Text;

            dt = DalHelper.GetDadosFiltro(bd);

            dgvDados.DataSource       = dt;
            dgvDados.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
            DesativaFicha();
        }
Пример #11
0
        private void CarregaCombo()
        {
            DataTable dt = new DataTable();

            // Carrega cargo
            dt = DalHelper.GetCombos("Cargo");
            cbCargo.DataSource  = dt;
            cbCargo.ValueMember = "Cargo";
            cbCargo.Text        = "Todos";

            // Carrega Grupo
            dt = DalHelper.GetCombos("Grupo");
            cbGrupo.DataSource  = dt;
            cbGrupo.ValueMember = "Grupo";
            cbGrupo.Text        = "Todos";

            // Carrega Funcao
            dt = DalHelper.GetCombos("Funcao");
            cbFuncao.DataSource  = dt;
            cbFuncao.ValueMember = "Funcao";
            cbFuncao.Text        = "Todos";

            // Carrega Sexo
            dt = DalHelper.GetCombos("Sexo");
            cbSexo.DataSource  = dt;
            cbSexo.ValueMember = "Sexo";
            cbSexo.Text        = "Todos";

            // Carrega TpCadastro
            dt = DalHelper.GetCombos("TpCadastro");
            cbTipoCadastro.DataSource  = dt;
            cbTipoCadastro.ValueMember = "Tp_Cadastro";
            cbTipoCadastro.Text        = "Todos";

            // Carrega Estado civil
            dt = DalHelper.GetCombos("Estadocivil");
            cbEstadoCivil.DataSource  = dt;
            cbEstadoCivil.ValueMember = "Estado_civil";
            cbEstadoCivil.Text        = "Todos";
        }
Пример #12
0
        private void RetornaAniversariantes()
        {
            try
            {
                DataTable dt = new DataTable();
                dt = DalHelper.GetAniversariantes();

                if (dt.Rows.Count != 0)
                {
                    dgvAniversariantes.DataSource       = dt;
                    dgvAniversariantes.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                }
                else
                {
                    dgvAniversariantes.DataSource = "Não existe aniversariantes neste mês";
                }
                dgvAniversariantes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #13
0
        }// FECHA LOAD

        private void RetornaEventos()
        {
            try
            {
                DataTable dt = new DataTable();
                dt = DalHelper.GetEventos();

                if (dt.Rows.Count != 0)
                {
                    grdEventos.DataSource       = dt;
                    grdEventos.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                }
                else
                {
                    grdEventos.DataSource = "Não existe eventos neste mês.";
                }
                grdEventos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #14
0
        private void btnExcluirDados_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtMatricula.Text))
            {
                MessageBox.Show("Selecione um nome na lista para inativar!", "Atenção");
                return;
            }

            try
            {
                int    codigo = Convert.ToInt32(txtMatricula.Text);
                string strTp  = "N";

                DalHelper.Delete(codigo, strTp);
                ExibirDados(false);
                MessageBox.Show("O membro foi desativado, para ativa-lo, faça uma pesquisa!", "Atenção");
                LimpaDados();
                desabilitarBotoes();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #15
0
        private void btnIncluirDados_Click(object sender, EventArgs e)
        {
            if (!Valida("Incluir"))
            {
                MessageBox.Show("Existem dados a serem preenchidos. * ", "Atenção");
                return;
            }

            try
            {
                string mat = txtDataNasc.Text;
                string DataBatismo;

                if (txtDataBatismo.Text == "  /  /")
                {
                    DataBatismo = "";
                }
                else
                {
                    DataBatismo = txtDataBatismo.Text;
                }

                Membro cli = new Membro();
                cli.Id              = Convert.ToInt32(mat.Replace("/", ""));
                cli.Nome            = txtNome.Text;
                cli.datanascimento  = txtDataNasc.Text;
                cli.nmpai           = txtNmPai.Text;
                cli.nmmae           = txtNmMae.Text;
                cli.estadocivil     = txtEstadoCivil.Text;
                cli.idade           = txtIdade.Text;
                cli.profissao       = txtProfissao.Text;
                cli.endereco        = txtEndereco.Text;
                cli.numero          = txtNumero.Text;
                cli.bairro          = txtBairro.Text;
                cli.cidade          = txtCidade.Text;
                cli.referencia      = txtReferencia.Text;
                cli.cep             = txtCep.Text.Replace("-", "");
                cli.telefone1       = txtTelefone1.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                cli.telefone2       = txtTelefone2.Text.Replace("(", "").Replace(")", "").Replace("-", "");
                cli.databatismo     = DataBatismo;
                cli.nmigreja        = txtNmIgreja.Text;
                cli.nmpastor        = txtNmPastor.Text;
                cli.tempofrequencia = txtTempoIgreja.Text;
                cli.cargo           = txtCargo.Text;
                cli.funcao          = txtFuncao.Text;
                cli.grupo           = txtGrupo.Text;
                cli.sexo            = strSexo;
                cli.tpcadastro      = strTpCadastro;
                cli.status          = "S";

                DalHelper.Add(cli);

                ExibirDados(false);
                LimpaDados();
                pnGrid.Enabled     = true;
                rdFeminino.Checked = false;
                rdMasc.Checked     = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro : " + ex.Message);
            }
        }
Пример #16
0
        private void btnCadNascimento_Click(object sender, EventArgs e)
        {
            string mblocal = "";

            if (txtNmMae.Text == "")
            {
                MessageBox.Show("Favor, insira um nome para Mãe.");
                return;
            }
            else
            if (txtNmPai.Text == "")
            {
                MessageBox.Show("Favor, insira um nome do Pai.");
                return;
            }
            else
            if (txtNmCrianca.Text == "")
            {
                MessageBox.Show("Favor, insira o nome da criança.");
                return;
            }
            else
            if (txtDtNascimento.Text == "" || txtDtNascimento.Text == "  /  /")
            {
                MessageBox.Show("Favor, digite uma data de nascimento válida!.");
                return;
            }
            if (txtNmPastor.Text == "")
            {
                MessageBox.Show("Favor, insira o nome do pastor que apresentou.");
                return;
            }
            else
            if (txtDataapresentacao.Text == "" || txtDataapresentacao.Text == "  /  /")
            {
                MessageBox.Show("Favor, digite uma data de apresentação válida!.");
                return;
            }
            else
            if (rdMembroLocalNao.Checked == true)
            {
                mblocal = "N";
            }
            else if (rdMembroLocalSim.Checked == true)
            {
                mblocal = "S";
            }
            else
            {
                MessageBox.Show("Marque uma opção para mebro local!");
                return;
            }

            try
            {
                clsRegistros reg = new clsRegistros();

                reg.Nomecrianca    = txtNmCrianca.Text;
                reg.Nomepai        = txtNmPai.Text;
                reg.Nomemae        = txtNmMae.Text;
                reg.dtapresentacao = txtDataapresentacao.Text;
                reg.dtnascimento   = txtDtNascimento.Text;
                reg.Nomepastor     = txtNmPastor.Text;
                reg.membrolocal    = mblocal;

                DalHelper.AddNascimento(reg);
                MessageBox.Show("Cadastramento realizado com sucesso!");

                txtNmPai.Text            = "";
                txtNmMae.Text            = "";
                rdMembroLocalNao.Checked = false;
                rdMembroLocalSim.Checked = false;
                txtDataapresentacao.Text = "";
                txtNmPastor.Text         = "";
                txtDtNascimento.Text     = "";
                txtNmCrianca.Text        = "";

                CarregadadosIniciais();
                AtivaGruposInicial();
                DesabilitarCadNascimento();
            }
            catch
            {
                MessageBox.Show("Não foi possivel relizar o cadastro. Reinicie  o sistema e tente novamente", "Atenção");
                MessageBox.Show("Se o erro persistir, acione o adminitrador.", "Atenção");

                txtNmPai.Text            = "";
                txtNmMae.Text            = "";
                rdMembroLocalNao.Checked = false;
                rdMembroLocalSim.Checked = false;
                txtDataapresentacao.Text = "";
                txtNmCrianca.Text        = "";
                txtDtNascimento.Text     = "";
                txtNmPastor.Text         = "";

                CarregadadosIniciais();
                AtivaGruposInicial();
                DesabilitarCadNascimento();
            }
        }