private void maskedTextBox1_Leave_1(object sender, EventArgs e) { string textos = ((MaskedTextBox)sender).Text.ToString().Replace(".", "").Replace("-", ""); if (textos.Length > 0) { forn = new FornecedorDao().getByCpnj(textos); labelNome.Text = forn.Nome.ToString().ToUpper(); labelTelefone.Text = forn.Telefone.ToString().ToUpper(); labelEmail.Text = forn.Email.ToString().ToUpper(); List <Produto> PRODUT = new ProdutoBLL().GetAll(); if (PRODUT.Count(x => x.ativo > 0) > 0) { comboBoxPorduto.Items.AddRange(PRODUT.Where(x => x.ativo > 0).ToArray()); comboBoxPorduto.DisplayMember = "Nome"; } else { MessageBox.Show("Não há produtos ativos. Favor cadastrar!", "Ateção!"); } } else { MessageBox.Show("Informe um CNPJ."); } }
private void maskedTextBox1_Leave_1(object sender, EventArgs e) { string textos = ((MaskedTextBox)sender).Text.ToString().Replace(".", "").Replace("-", ""); if (textos.Length > 0) { cli = new ClienteDao().getByCpf(textos); labelNome.Text = cli.Nome.ToString().ToUpper(); labelRg.Text = cli.RG.ToString().ToUpper(); labelTelefone.Text = cli.Telefone.ToString().ToUpper(); labelDescontos.Text = (cli.Pontos).ToString().ToUpper(); labelPontos.Text = (cli.Pontos).ToString(); textBoxEmail.Text = cli.Email.ToString(); List <Produto> PRODUT = new ProdutoBLL().GetAll(); if (PRODUT.Count(x => x.ativo > 0) > 0) { comboBoxPorduto.Items.AddRange(PRODUT.Where(x => x.ativo > 0).ToArray()); comboBoxPorduto.DisplayMember = "Nome"; } else { MessageBox.Show("Não há produtos ativos. Favor cadastrar!", "Ateção!"); } } else { labelPontos.Text = "0"; labelDescontos.Text = "0"; MessageBox.Show(("Informe um CPF.")); } }