Ejemplo n.º 1
0
        private void BuscaSocioByTitulo(string titulo)
        {
            SocioDAL sDAL = new SocioDAL();
            Socio    s    = sDAL.RetornaSocioByTitulo(titulo);

            mskCpf.Text     = s.Cpf;
            lblNome.Text    = s.Nome;
            lblIdSocio.Text = s.Id.ToString();
            lblNome.Visible = true;
        }
Ejemplo n.º 2
0
        private void cmdPesquisaFatura_Click(object sender, EventArgs e)
        {
            lstSocios.Items.Clear();
            SocioDAL     sDal = new SocioDAL();
            List <Socio> list = sDal.RetornaSocioByNome(txtNome.Text);

            foreach (Socio socio in list)
            {
                PopulaLista(socio);
            }
        }
Ejemplo n.º 3
0
        private void Cabecalho()
        {
            int    cont = 0;
            string cabecalho;

            //cabecalho = "<TR><TD><FONT FACE='VERDANA' SIZE='4'><b>S.R. 3 De Maio</b></TD><TD ALIGN=RIGHT><FONT FACE='VERDANA' SIZE='2'>" + DateTime.Now + "</FONT></TD></TR>";
            //cabecalho += "<TR><TD><FONT FACE = 'VERDANA' SIZE='2'>Relação Sócios</FONT></TD></TR>";
            cabecalho  = "<div>";
            cabecalho += "<img width=100 height=103 ALIGN=LEFT src='" + System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "\\Images\\logo3DeMaio.png'/>";
            cabecalho += "<tr><TD ALIGN=LEFT width=400><FONT FACE='VERDANA' SIZE='4'><b>&nbsp;&nbsp;&nbsp;&nbsp;S.R. 3 De Maio</b></TD><br /><TD ALIGN=RIGHT width=250><FONT FACE='VERDANA' SIZE='2'>" + DateTime.Now + "</FONT></TD></tr>";
            cabecalho += "<tr><TD><FONT FACE = 'VERDANA' SIZE='2'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Relação de mensalidades abertas</FONT></TD></tr>";
            cabecalho += "</DIV>";

            cabecalho += "<TR><TD><br /></TD></TR> ";
            cabecalho += "<TR><TD><br /></TD></TR> ";
            cabecalho += "<TR><TD><br /></TD></TR> ";

            cabecalho += "</TABLE>";
            cabecalho += "<TABLE CELLSPACING=1 CELLPADDING=1 STYLE='WIDTH=750'>";

            cabecalho += "<tr>";
            cabecalho += "<td  ALIGN=LEFT WIDTH=100><FONT FACE='VERDANA' SIZE='2'><B>Título</B></FONT></TD>";
            cabecalho += "<td  ALIGN=LEFT WIDTH=650><FONT FACE='VERDANA' SIZE='2'><B>Nome</B></FONT></TD>";
            cabecalho += "</tr>";

            SocioDAL     sDAL = new SocioDAL();
            List <Socio> list = sDAL.RetornaSocioByNome(txtNome.Text);

            foreach (Socio socio in list)
            {
                cont      += 1;
                cabecalho += "<tr>";
                cabecalho += "<td  ALIGN=LEFT WIDTH=100><FONT FACE='VERDANA' SIZE='2'>" + socio.Titulo + "</FONT></TD>";
                cabecalho += "<td  ALIGN=LEFT WIDTH=650><FONT FACE='VERDANA' SIZE='2'>" + socio.Nome + "</B></FONT></TD>";
                cabecalho += "</tr>";
                cabecalho += "<TR><TD COLSPAN=2><hr /></TD ></TR> ";
            }

            cabecalho += "<tr>";
            cabecalho += "<td  ALIGN=LEFT WIDTH=100><FONT FACE='VERDANA' SIZE='2'>Sócios: " + cont + "</FONT></TD>";
            cabecalho += "</tr>";

            try
            {
                using (sw = File.AppendText(path))
                {
                    sw.WriteLine(cabecalho);
                }
            }
            catch (IOException ex)
            {
                MessageBox.Show(ex.Message, "Aviso");
            }
        }
Ejemplo n.º 4
0
        private void mskCpf_Leave(object sender, EventArgs e)
        {
            string cpf = mskCpf.Text.Replace(".", "");

            cpf = cpf.Replace(",", "");
            if (cpf != "         -")
            {
                SocioDAL sDal = new SocioDAL();
                Socio    s    = sDal.RetornaSocioByCpf(mskCpf.Text);
                if (s.Titulo != 0)
                {
                    txtTitulo.Text = s.Titulo.ToString();
                    txtTitulo_Leave(null, null);
                }
            }
        }
Ejemplo n.º 5
0
        private void InserirSocio()
        {
            DateTime?dtExpedicao  = null;
            DateTime?dtNascimento = null;

            if (mskDtExpedicao.Text != "  /  /")
            {
                dtExpedicao = DateTime.Parse(mskDtExpedicao.Text);
            }
            if (mskDtNascimentoSocio.Text != "  /  /")
            {
                dtNascimento = DateTime.Parse(mskDtNascimentoSocio.Text);
            }

            DialogResult dr;
            bool         gravou = false;

            dr = MessageBox.Show("Sócio sem endereço ou com endereço incompleto.\n" +
                                 "Deseja continuar o cadastro?", "Aviso", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                try
                {
                    SocioDAL sDal = new SocioDAL();
                    Socio    S    = new Socio
                    {
                        Titulo           = int.Parse(txtTitulo.Text),
                        DataAdesao       = DateTime.Parse(mskDtAdesao.Text),
                        Cpf              = mskCpf.Text,
                        Nome             = txtNome.Text,
                        Rg               = txtRg.Text,
                        OrgaoExpedidor   = txtOrgaoExpedidor.Text,
                        UfOrgaoExpedidor = cmbUfOrgaoExpedidor.Text,
                        DataExpedicao    = dtExpedicao,
                        Situacao         = txtSituacao.Text,
                        DataNascimento   = dtNascimento,
                        FoneResidencial  = mskResidencial.Text,
                        FoneCelular      = mskCelular.Text,
                        FoneComercial    = mskComercial.Text,
                        Email            = txtEmail.Text,
                        DataCadastro     = DateTime.Parse(mskDtCadastroSocio.Text),
                        DataAtualizacao  = DateTime.Parse(mskDtAtualizacaoSocio.Text),
                        Ativo            = bool.Parse(ckbSocioAtivo.Checked.ToString()),
                        Obs              = txtAdicionaisObs.Text,
                        PathImagem       = foto
                    };
                    if (lblId.Text.Equals("idSocio"))
                    {
                        gravou = sDal.InsertSocio(S);
                        if (gravou)
                        {
                            if (ValidaEndereco())
                            {
                                Endereco E = new Endereco()
                                {
                                    Cep         = mskCep.Text,
                                    Rua         = txtRua.Text,
                                    Numero      = int.Parse(txtNumero.Text),
                                    Bairro      = txtBairro.Text,
                                    Cidade      = txtCidade.Text,
                                    Uf          = cmbUfEndereco.Text,
                                    Complemento = txtComplemento.Text,
                                    IdSocio     = ReturnIdGeradoSocio()
                                };
                                EnderecoDAL eDal = new EnderecoDAL();
                                gravou = eDal.InsertEndereco(E);
                            }
                        }
                    }
                }
                catch (SystemException ex)
                {
                    string           exception = ex.Message.ToString();
                    frmTDM_Menssagem frmErro   = new frmTDM_Menssagem("Revise os dados.", 2, exception);
                    frmErro.Show();
                }
            }
            if (gravou)
            {
                tabControl1.SelectedTab = tabPage1;
                frmTDM_Menssagem frm = new frmTDM_Menssagem("Cadastrado com sucesso!", 1, "");
                frm.Show();
                Limpar();
                LimparDependente();
            }
        }
Ejemplo n.º 6
0
        private void AtualizarSocio()
        {
            DateTime?dtExpedicao  = null;
            DateTime?dtNascimento = null;

            if (mskDtExpedicao.Text != "  /  /")
            {
                dtExpedicao = DateTime.Parse(mskDtExpedicao.Text);
            }
            if (mskDtNascimentoSocio.Text != "  /  /")
            {
                dtNascimento = DateTime.Parse(mskDtNascimentoSocio.Text);
            }

            bool gravou = false;

            try
            {
                SocioDAL sDal = new SocioDAL();
                Socio    S    = new Socio
                {
                    Id               = int.Parse(lblId.Text),
                    Titulo           = int.Parse(txtTitulo.Text),
                    DataAdesao       = DateTime.Parse(mskDtAdesao.Text),
                    Cpf              = mskCpf.Text,
                    Nome             = txtNome.Text,
                    Rg               = txtRg.Text,
                    OrgaoExpedidor   = txtOrgaoExpedidor.Text,
                    UfOrgaoExpedidor = cmbUfOrgaoExpedidor.Text,
                    DataExpedicao    = dtExpedicao,
                    Situacao         = txtSituacao.Text,
                    DataNascimento   = dtNascimento,
                    FoneResidencial  = mskResidencial.Text,
                    FoneCelular      = mskCelular.Text,
                    FoneComercial    = mskComercial.Text,
                    Email            = txtEmail.Text,
                    DataAtualizacao  = DateTime.Now,
                    Ativo            = bool.Parse(ckbSocioAtivo.Checked.ToString()),
                    Obs              = txtAdicionaisObs.Text,
                    PathImagem       = foto
                };
                if (!lblId.Text.Equals("idSocio"))
                {
                    gravou = sDal.UpdatedSocio(S);
                    if (gravou)
                    {
                        try
                        {
                            int?numero = null;
                            if (txtNumero.Text.Trim() != "")
                            {
                                numero = int.Parse(txtNumero.Text);
                            }
                            Endereco E = new Endereco()
                            {
                                Cep         = mskCep.Text,
                                Rua         = txtRua.Text,
                                Numero      = numero,
                                Bairro      = txtBairro.Text,
                                Cidade      = txtCidade.Text,
                                Uf          = cmbUfEndereco.Text,
                                Complemento = txtComplemento.Text,
                                IdSocio     = int.Parse(lblId.Text)
                            };
                            EnderecoDAL eDal = new EnderecoDAL();
                            //idEnd = eDal.IdEnderecoBySocio(long.Parse(lblId.Text));
                            if (!lblIdEndereco.Text.Equals("idEndereco"))
                            {
                                gravou = eDal.UpdateEndereco(E);
                            }
                            else
                            {
                                gravou = eDal.InsertEndereco(E);
                            }
                        }
                        catch (SystemException ex)
                        {
                            string           exception = ex.Message.ToString();
                            frmTDM_Menssagem frmErro   = new frmTDM_Menssagem("Revise os dados.", 2, exception);
                            frmErro.Show();
                        }
                    }
                }
            }
            catch (SystemException ex)
            {
                string           exception = ex.Message.ToString();
                frmTDM_Menssagem frmErro   = new frmTDM_Menssagem("Revise os dados.", 2, exception);
                frmErro.Show();
            }
            if (gravou)
            {
                tabControl1.SelectedTab = tabPage1;
                frmTDM_Menssagem frm = new frmTDM_Menssagem("Cadastrado com sucesso!", 1, "");
                frm.Show();
                Limpar();
                LimparDependente();
            }
        }