private void BtnCadastrar_Click(object sender, EventArgs e) { if (TextNome.Text.Length == 0) { MessageBox.Show(this, "Favor preencher o nome da despesa !", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TextPrecoCusto.Text.Length == 0) { MessageBox.Show(this, "Favor preencher o valor de custo do produto !", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TextPrecoVenda.Text.Length == 0) { MessageBox.Show(this, "Favor preencher o valor de venda do produto!", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (TextCor.Text.Length == 0) { MessageBox.Show(this, "Favor preencher a cor do produto!", null, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var id = ComboCategoria.SelectedItem; Cadastro.CadastrarProduto(TextNome.Text, TextCor.Text, ComboCategoria.SelectedValue.ToString(), ComboTamanho.SelectedValue.ToString(), TextPrecoCusto.Text, TextPrecoVenda.Text, TextCodigoEditar.Text, TextMarkupEditar.Text); MessageBox.Show(this, "Produto cadastrado com sucesso!", null, MessageBoxButtons.OK, MessageBoxIcon.Information); TextNome.Text = ""; TextCor.Text = ""; TextPrecoCusto.Text = ""; TextPrecoVenda.Text = ""; TextCodigo.Text = ""; TextMarkup.Text = ""; } }