Exemple #1
0
        public void PesquisarLimiteCliente()
        {
            try
            {
                novoCliente = new RegraNegocio.ClienteRegraNegocio();
                DataTable dadosTabelaCliente = new DataTable();
                dadosTabelaCliente = novoCliente.PesquisarLimiteCliente(idCliente);

                if (dadosTabelaCliente.Rows.Count > 0)
                {
                    try
                    {
                        LimiteCliente = Convert.ToDecimal(dadosTabelaCliente.Rows[0]["LIMITE"].ToString());
                        gastoCliente  = Convert.ToDecimal(dadosTabelaCliente.Rows[0]["GASTO"].ToString());
                        gastoAtual    = Convert.ToDecimal(dadosTabelaCliente.Rows[0]["GASTO"].ToString());
                    }
                    catch
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void gdvCliente_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string portaComImpressora = "";
                int    idRetorno          = 0;

                idCliente = frmFechamentoVenda.idCliente = Convert.ToInt32(gdvCliente.Rows[e.RowIndex].Cells["CLIENTE_ID"].Value);
                this.Close();

                somaTotalCompra = frmFechamentoVenda.somaTotalCompra;

                //metodo para buscar limite do cliente.....................................................................................
                PesquisarLimiteCliente();

                if ((LimiteCliente != null) && (LimiteCliente > 0))
                {
                    gastoCliente = (gastoCliente + somaTotalCompra);

                    //if (gastoCliente <= LimiteCliente)
                    //{
                    int n = Convert.ToInt32(gdvCliente.CurrentRow.Index);

                    if (n >= 0)
                    {
                        frmFechamentoVenda.idCliente = Convert.ToInt32(gdvCliente.Rows[n].Cells["CLIENTE_ID"].Value);

                        //frmFechamentoVenda.FecharVenda();
                        //frmFechamentoVenda.VendaAberto();

                        this.Close();

                        //metodo pra Alterar gasto NA TABELA VENDA realizado pelo cliente ................................................................
                        novoCliente = new RegraNegocio.ClienteRegraNegocio();
                        novoCliente.AtualizarGastoCliente(idCliente, gastoCliente);
                        frmFechamentoVenda.retornoVendaId = true;
                    }
                    else
                    {
                        MessageBox.Show("Informe o Cliente Realização do Relatório.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Cliente não Contem Limite Informado.\nPor Favor Inserir um Valor de Limite para Cliente.", "Atenção");
                    frmFechamentoVenda.Close();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
        public void ContadorCliente()
        {
            try
            {
                novoCliente = new RegraNegocio.ClienteRegraNegocio();
                DataTable dadosTabelaCliente = new DataTable();
                dadosTabelaCliente = novoCliente.ContadorCliente();

                string contador = dadosTabelaCliente.Rows[0]["NOME"].ToString();
                lblTotalCliente.Text = contador.ToString();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #4
0
        public void ListaCliente()
        {
            try
            {
                novoCliente = new RegraNegocio.ClienteRegraNegocio();
                DataTable dadosTabelaCliente = new DataTable();
                dadosTabelaCliente = novoCliente.ListaCliente();

                gdvCliente.DataSource = dadosTabelaCliente;
                EstiloCoresLinha();
                txtPesquisa.Focus();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #5
0
 private void txtPesquisa_TextChanged_1(object sender, EventArgs e)
 {
     try
     {
         if (rbNome.Checked == true)
         {
             novoCliente = new RegraNegocio.ClienteRegraNegocio();
             DataTable dadosTabelaCliente = new DataTable();
             dadosTabelaCliente    = novoCliente.PesquisarClienteNome(txtPesquisa.Text);
             gdvCliente.DataSource = dadosTabelaCliente;
             EstiloCoresLinha();
         }
         else
         {
             if (rbCpf.Checked == true)
             {
                 novoCliente = new RegraNegocio.ClienteRegraNegocio();
                 DataTable dadosTabelaCliente = new DataTable();
                 dadosTabelaCliente    = novoCliente.PesquisarClienteCPF_CNPJ(txtPesquisa.Text);
                 gdvCliente.DataSource = dadosTabelaCliente;
                 EstiloCoresLinha();
             }
             else
             {
                 if (rbCnpj.Checked == true)
                 {
                     novoCliente = new RegraNegocio.ClienteRegraNegocio();
                     DataTable dadosTabelaCliente = new DataTable();
                     dadosTabelaCliente    = novoCliente.PesquisarClienteRG_IE(txtPesquisa.Text);
                     gdvCliente.DataSource = dadosTabelaCliente;
                     EstiloCoresLinha();
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }