コード例 #1
0
ファイル: FrmCliente.cs プロジェクト: MarlonLira/Ruler-ant
        public void AtualizarObjeto()
        {
            ClientePst cliente;

            try
            {
                if (txt_nome.Text != "" && txt_id.Text != "")
                {
                    cliente          = new ClientePst();
                    cliente.Id       = int.Parse(txt_id.Text);
                    cliente.Nome     = txt_nome.Text;
                    cliente.Telefone = txt_telefone.Text;
                    cliente.Debito   = txt_debito.Text.Replace(",", ".");

                    con.openCon(cliente.Atualizar());
                    con.closeCon();

                    MessageBox.Show("Cliente Atualizado com Sucesso");
                    DisplayData(cliente.Pesquisar());
                }
                else
                {
                    MessageBox.Show("Erro! Por favor verifique os valores informados");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message + " A tentativa de atualização falhou");
            }

            ClearData();
        }
コード例 #2
0
ファイル: FrmCliente.cs プロジェクト: MarlonLira/Ruler-ant
 public void PesquisarObjeto()
 {
     try
     {
         ClientePst cliente = new ClientePst();
         if (string.IsNullOrEmpty(txt_id.Text))
         {
             DisplayData(cliente.Pesquisar());
         }
         else
         {
             DisplayData(cliente.PesquisarId(int.Parse(txt_id.Text)));
             if (table.Rows.Count > 0)
             {
                 txt_nome.Text     = table.Rows[0]["nome"].ToString();
                 txt_telefone.Text = table.Rows[0]["telefone"].ToString();
                 txt_debito.Text   = table.Rows[0]["debito"].ToString();
                 aux = "";
             }
             else
             {
                 MessageBox.Show("Cliente com o id " + txt_id.Text + " não existe!");
                 aux = "";
             }
         }
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message + " A tentativa de pesquisa falhou!");
     }
 }
コード例 #3
0
        public void AtualizarObjeto()
        {
            if (txt_nome.Text != "" && txt_id.Text != "")
            {
                ClientePst cliente = new ClientePst(int.Parse(txt_id.Text), txt_nome.Text, txt_telefone.Text, txt_debito.Text.Replace(",", "."));

                con.openCon(cliente.Atualizar());
                con.closeCon();

                MessageBox.Show("Cliente Atualizado com Sucesso");

                DisplayData(cliente.Pesquisar());
                ClearData();
            }
            else
            {
                MessageBox.Show("Erro! Por favor verifique os valores informados");
            }
        }