private void btnPesquisa_Click(object sender, EventArgs e) { ModFornecedor modF = new ModFornecedor(); FornecedorNEG neg = new FornecedorNEG(); modF = neg.PesquisarFornecedor(Regex.Replace(txtCnpjPesquisa.Text, "[^0-9a-zA-Z]+", "")); txtId.Text = Convert.ToInt32(modF.Id).ToString(); txtRazaoSocial.Text = modF.RazaoSocial; txtNome.Text = modF.Nome; txtCnpj.Text = modF.Cnpj; MessageBox.Show("Pesquisa realizada com sucesso!"); }
protected void PesquisaCnpj_Click(object sender, EventArgs e) { ModFornecedor modF = new ModFornecedor(); FornecedorNEG neg = new FornecedorNEG(); modF = neg.PesquisarFornecedor(Regex.Replace(txtCnpjPesquisa.Text, "[^0-9a-zA-Z]+", "").Replace("/", "").Replace(".", "").Replace("-", "")); txtId.Text = Convert.ToInt32(modF.Id).ToString(); txtRazaoSocial.Text = modF.RazaoSocial; txtNomefantasia.Text = modF.Nome; txtCnpj.Text = modF.Cnpj; if (modF.Cnpj == txtCnpjPesquisa.Text) { MessageBox.Show("Pesquisa realizada com sucesso!"); } else { MessageBox.Show("CNPJ não cadastrado!"); } }