private void btIncuir_Click(object sender, EventArgs e) { if (txtValorVale.Text.Trim() == "") { MessageBox.Show("Campo valor é obrigatório !!!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); txtValorVale.Focus(); return; } Vale vale = new Vale(); vale.descricaoVale = txtObservacao.Text; vale.valorVale = Convert.ToDecimal(txtValorVale.Text); vale.dataVale = Convert.ToDateTime(dtVale.Text); //criando funcionario Funcionario fun = new Funcionario(); fun.Id = Convert.ToInt32(cbo_funcionario.SelectedValue); vale.funcionarioVale = fun; ValeBLL bll = new ValeBLL(); string mensagem = bll.EmitirVale(vale); MessageBox.Show(mensagem, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); fun = null; bll = null; limpaCampos(); }
private void btExcluir_Click(object sender, EventArgs e) { if (MessageBox.Show("Deseja excluir o vale !!!", "Atenção", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (gridLista.SelectedRows.Count > 0) { ValeBLL bll = new ValeBLL(); bool mensagem = bll.ExcluirVale(Convert.ToInt32(gridLista.CurrentRow.Cells[0].Value.ToString())); CarregarVales(); } } }