private void btBuscaCliente_Click(object sender, EventArgs e)
        {
            ClassCliente c = new ClassCliente();
            string       s = txtPesqCliente.Text;

            dgvCliente.DataSource = c.SearchClieNomeV(s);
        }
Beispiel #2
0
        private void frmRptClie1_Load(object sender, EventArgs e)
        {
            ClassCliente cc = new ClassCliente();

            ClassClienteBindingSource.DataSource = cc.rptSimples();
            this.rptSimples.RefreshReport();
        }
        private void btPesq_Click(object sender, EventArgs e)
        {
            ClassCliente cc = new ClassCliente();


            if (cbTipo.SelectedIndex == -1)
            {
                MessageBox.Show("Selecione um Tipo de pesquisa!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            if (cbTipo.SelectedIndex == 0 && rdAtiv.Checked == true)
            {
                dgRes.DataSource = cc.SearchClieStatusAtiv();
            }
            if (cbTipo.SelectedIndex == 0 && rdAtiv.Checked == false)
            {
                dgRes.DataSource = cc.SearchClieStatusInat();
            }
            if (cbTipo.SelectedIndex == 1 && txtPes.Text != "")
            {
                cc.txtSearch = txtPes.Text; dgRes.DataSource = cc.SearchClieNome();
            }
            if (cbTipo.SelectedIndex == 2 && cbEst.SelectedIndex != -1)
            {
                cc.EndEstadoClienteS = Convert.ToString(cbEst.SelectedItem); dgRes.DataSource = cc.SearchClieEst();
            }
            if (cbTipo.SelectedIndex == 3 && mskCpf.Text != "   ,   ,   -")
            {
                cc.CpfClienteS = mskCpf.Text; dgRes.DataSource = cc.SearchClieCpf();
            }
            if (cbTipo.SelectedIndex == 4 && txtCod.Text != "")
            {
                cc.CodClienteS = Convert.ToInt32(txtCod.Text); dgRes.DataSource = cc.SearchClieCod();
            }
        }
        private void btDel_Click(object sender, EventArgs e)
        {
            if (dgRes.SelectedCells.Count > 0)
            {
                ClassCliente cc = new ClassCliente();
                cc.RetornClie(Convert.ToInt32(dgRes.SelectedRows[0].Cells[0].Value));

                if (MessageBox.Show("Você Deseja Realmente Excluir o Cliente '" + cc.NomeCliente + "' ?", "Alerta!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    int aux = cc.DelClie();

                    if (aux != 0)
                    {
                        MessageBox.Show("O Cliente '" + cc.NomeCliente + "' foi Excluido com Sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    else
                    {
                        MessageBox.Show("Erro ao realizar Exclusão.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    btPesq_Click(this, new EventArgs());
                }
            }
        }
        private void btEdit_Click(object sender, EventArgs e)
        {
            if (dgRes.SelectedCells.Count > 0)
            {
                ClassCliente cc = new ClassCliente();
                cc.RetornClie(Convert.ToInt32(dgRes.SelectedRows[0].Cells[0].Value));
                frmCadastroCliente fc = new frmCadastroCliente();

                fc.txtCod.Text       = cc.CodCliente.ToString();
                fc.dataCad.Text      = cc.DataCadCliente.ToString();
                fc.txtNome.Text      = cc.NomeCliente;
                fc.txtNomeSoc.Text   = cc.NomeSocCliente;
                fc.txtDataNasc.Text  = cc.DataNascClie.ToString("dd-MM-yyyy");
                fc.txtTel1.Text      = cc.TelCliente1;
                fc.txtTel2.Text      = cc.TelCliente2;
                fc.txtCpf.Text       = cc.CpfCliente;
                fc.CB_OREMISSOR.Text = cc.OrgEmiClie;
                fc.txtRg.Text        = cc.RgClie;
                fc.txtEnd.Text       = cc.EndRuaCliente;
                fc.txtCidade.Text    = cc.EndCityCliente;
                fc.CbEst.Text        = cc.EndEstadoCliente;
                fc.txtCep.Text       = cc.EndCepCliente;

                fc.chkAtivo.Enabled = true;
                if (cc.StatusClieI == 1)
                {
                    fc.chkAtivo.Checked = true;
                }
                else
                {
                    fc.chkAtivo.Checked = false;
                }

                if (cc.SexoCliente == 1)
                {
                    fc.radFem.Checked = true;
                }
                else
                {
                    fc.radMasc.Checked = true;
                }

                fc.btCad.Visible   = false;
                fc.BtAtt.Visible   = true;
                fc.btClear.Visible = false;
                fc.ShowDialog();
                btPesq_Click(this, new EventArgs());
            }
        }
Beispiel #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtNome.Text != "" && txtCpf.Text != "   .   .   -" && txtDataNasc.Text != "  /  /" && CbEst.SelectedIndex != -1 && CB_OREMISSOR.SelectedIndex != -1)
            {
                ClassConexao cCon  = new ClassConexao();
                ClassCliente cClie = new ClassCliente();



                if (radMasc.Checked == true)
                {
                    cClie.SexoCliente = 0;
                }
                if (radFem.Checked == true)
                {
                    cClie.SexoCliente = 1;
                }
                if (radFem.Checked == false && radMasc.Checked == false)
                {
                    MessageBox.Show("Selecione um Sexo!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    cClie.NomeCliente      = txtNome.Text;
                    cClie.NomeSocCliente   = txtNomeSoc.Text;
                    cClie.TelCliente1      = txtTel1.Text;
                    cClie.TelCliente2      = txtTel2.Text;
                    cClie.CpfCliente       = txtCpf.Text;
                    cClie.RgClie           = txtRg.Text;
                    cClie.OrgEmiClie       = CB_OREMISSOR.SelectedItem.ToString();
                    cClie.EndCepCliente    = txtCep.Text;
                    cClie.EndCityCliente   = txtCidade.Text;
                    cClie.EndRuaCliente    = txtEnd.Text;
                    cClie.EndEstadoCliente = Convert.ToString(CbEst.SelectedItem);
                    cClie.DataNascClie     = Convert.ToDateTime(txtDataNasc.Text);

                    int aux = cClie.CadastrarCliente();

                    if (aux != 0)
                    {
                        MessageBox.Show("O Cliente '" + cClie.NomeCliente + "' foi Cadastrado com Sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    else
                    {
                        MessageBox.Show("Erro ao Realizar Cadastro!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                MessageBox.Show("Verificar campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (txtNome.Text == "")
                {
                    txtNome.BackColor = Color.DarkRed;
                }
                txtCpf.BackColor      = Color.DarkRed;
                txtDataNasc.BackColor = Color.DarkRed;
                txtRg.BackColor       = Color.DarkRed;
                txtCep.BackColor      = Color.DarkRed;
            }
        }
        private void brGerar_Click(object sender, EventArgs e)
        {
            if (cbTipo.SelectedIndex == -1)
            {
                MessageBox.Show("Selecione um tipo de Relatório para Gerar!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if (cbTipo.SelectedIndex == 0 && cbMes.SelectedIndex != -1 && mskDia.Text != "")
                {
                    ClassCliente c = new ClassCliente();

                    int mes = cbMes.SelectedIndex + 1;
                    int dia = Convert.ToInt32(mskDia.Text);

                    ClassClienteBindingSource.DataSource = c.RelatorioClienteDIAMES(mes, dia);
                    this.reportViewer1.RefreshReport();
                }
                //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cbTipo.SelectedIndex == 1 && cbMes.SelectedIndex != -1)
                {
                    ClassCliente c = new ClassCliente();

                    int mes = cbMes.SelectedIndex + 1;

                    ClassClienteBindingSource.DataSource = c.RelatorioClienteMES(mes);
                    this.reportViewer1.RefreshReport();
                }
                //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cbTipo.SelectedIndex == 2 && cbMes.SelectedIndex != -1 && mskDia.Text != "" && mskAno.Text != "  /  /")
                {
                    ClassCliente c = new ClassCliente();

                    int mes = cbMes.SelectedIndex + 1;
                    int dia = Convert.ToInt32(mskDia.Text);
                    int ano = Convert.ToInt32(mskAno.Text);

                    ClassClienteBindingSource.DataSource = c.RelatorioClienteDATA(dia, mes, ano);
                    this.reportViewer1.RefreshReport();
                }
                //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cbTipo.SelectedIndex == 3 && TxtIdin.Text != "" && TxtIdfin.Text != "")
                {
                    int idadeI, IdadeF;
                    idadeI = Convert.ToInt32(TxtIdin.Text);
                    IdadeF = Convert.ToInt32(TxtIdfin.Text);

                    ClassCliente c = new ClassCliente();
                    ClassClienteBindingSource.DataSource = c.RelatorioClienteIDADE(idadeI, IdadeF);
                    this.reportViewer1.RefreshReport();
                }
                //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cbTipo.SelectedIndex == 4 && TxtIdin.Text != "")
                {
                    int idadeI = Convert.ToInt32(TxtIdin.Text);

                    ClassCliente c = new ClassCliente();
                    ClassClienteBindingSource.DataSource = c.RelatorioClienteMAIORDE(idadeI);
                    this.reportViewer1.RefreshReport();
                }
                //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cbTipo.SelectedIndex == 5 && CbCidade.SelectedIndex != -1)
                {
                    string cidade = CbCidade.Text;

                    ClassCliente c = new ClassCliente();
                    ClassClienteBindingSource.DataSource = c.RelatorioClienteCIDADE(cidade);
                    this.reportViewer1.RefreshReport();
                }
                //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                if (cbTipo.SelectedIndex == 6)
                {
                    if (RdMasc.Checked == true || RdFem.Checked == true)
                    {
                        int s = 0;
                        if (RdMasc.Checked == true)
                        {
                            s = 0;
                        }
                        if (RdFem.Checked == true)
                        {
                            s = 1;
                        }

                        ClassCliente c = new ClassCliente();
                        ClassClienteBindingSource.DataSource = c.RelatorioClienteSEXO(s);
                        this.reportViewer1.RefreshReport();
                    }
                    //else MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                if (cbTipo.SelectedIndex == 7)
                {
                    if (RdAtiv.Checked == true || RdInat.Checked == true)
                    {
                        int s = 1;
                        if (RdAtiv.Checked == true)
                        {
                            s = 1;
                        }
                        if (RdInat.Checked == true)
                        {
                            s = 0;
                        }

                        ClassCliente c = new ClassCliente();
                        ClassClienteBindingSource.DataSource = c.RelatorioClienteSTATUS(s);
                        this.reportViewer1.RefreshReport();
                    }
                    else
                    {
                        MessageBox.Show("Verificar Campos!", "Aviso!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }