Exemple #1
0
        public void PesquisarObjeto()
        {
            try
            {
                PagamentoPst pagamento = new PagamentoPst();

                if (!string.IsNullOrEmpty(txt_id_pedido.Text))
                {
                    DisplayData(pagamento.Pesquisar());
                }
                else if (!string.IsNullOrEmpty(txt_id.Text))
                {
                    DisplayData(pagamento.Pesquisar("id_movimento", int.Parse(txt_id.Text)));
                    if (table.Rows.Count > 0)
                    {
                        cbb_cliente.Text   = table.Rows[0]["nome_cliente"].ToString();
                        txt_debito.Text    = table.Rows[0]["valor"].ToString();
                        txt_id_pedido.Text = table.Rows[0]["pedido_id"].ToString();
                    }
                    else
                    {
                        MessageBox.Show("O id informado '" + txt_id.Text + "' não existe!");
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Exemple #2
0
        public void CadastrarObjeto()
        {
            if (!string.IsNullOrEmpty(cbb_cliente.Text) && !string.IsNullOrEmpty(txt_valor.Text))
            {
                PagamentoPst pagamento = new PagamentoPst(int.Parse(cbb_id_cliente.Text), double.Parse(txt_valor.Text), cbb_tipo_pagamento.Text, int.Parse(txt_id_pedido.Text));

                //Consultar Objeto
                Checar(txt_id_pedido.Text);
                if (table.Rows.Count > 0)
                {
                    aux = table.Rows[0]["pedido_id"].ToString();
                }
                else
                {
                    aux = "";
                }

                /*//Condição para não haver produtos iguais.
                 * if (aux == txt_id_pedido.Text)
                 * {
                 *  MessageBox.Show("Erro! Esse pagamento já foi efetuado. ");
                 *  ClearData();
                 * }
                 * else
                 * {*/
                con.openCon(pagamento.Cadastrar());
                con.closeCon();
                MessageBox.Show("Pagamento feito com Sucesso!");
                //}

                ClearData();
                PesquisarObjeto();
            }
        }
Exemple #3
0
 public void Checar(string objeto)
 {
     try
     {
         PagamentoPst pagamento = new PagamentoPst();
         DisplayData(pagamento.Pesquisar(int.Parse(objeto)));
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
Exemple #4
0
        public void PesquisarObjeto(string coluna, string objeto)
        {
            try
            {
                PagamentoPst pagamento = new PagamentoPst();
                if (aux == "cliente" || string.IsNullOrEmpty(aux))
                {
                    aux = "procurar";
                    ClientePst cliente = new ClientePst();
                    DisplayData(cliente.checar(objeto));
                    if (table.Rows.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(table.Rows[0]["debito"].ToString()))
                        {
                            cbb_cliente.Text    = table.Rows[0]["nome"].ToString();
                            txt_debito.Text     = table.Rows[0]["debito"].ToString();
                            cbb_id_cliente.Text = table.Rows[0]["id_cliente"].ToString();
                        }
                        else
                        {
                            txt_debito.Text = "0";
                        }
                    }
                    aux = "";
                }
                else if (aux == "id")
                {
                    aux = "";
                    DisplayData(pagamento.Pesquisar(coluna, int.Parse(objeto)));

                    if (table.Rows.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(table.Rows[0]["id_movimento"].ToString()))
                        {
                            cbb_cliente.Text    = table.Rows[0]["nome_cliente"].ToString();
                            cbb_id_cliente.Text = table.Rows[0]["id_cliente"].ToString();
                        }
                        else
                        {
                            txt_debito.Text = "0";
                        }
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Exemple #5
0
        public void Checar(string objeto)
        {
            PagamentoPst pagamento = new PagamentoPst();

            DisplayData(pagamento.Pesquisar(int.Parse(objeto)));
        }