Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void _rbtnSalvar_Click(object sender, EventArgs e)
- {
- try
- { //1
- baixaServico.Desconto = Convert.ToDecimal(string.IsNullOrWhiteSpace(_txtDesconto.Text) ? "0" : _txtDesconto.Text);
- baixaServico.FormaPagamento = _cbFormaPagamento.Text;
- baixaServico.IdCliente = Convert.ToInt32(_cbCliente.SelectedValue);
- baixaServico.FlgPago = _mckbPago.Checked ? "S" : "N";
- baixaServico.Validar(); //2
- if (baixaServico.ErrosValidacao.Count > 0) //3
- {
- baixaServico.ErrosValidacao.ForEach(erro => MessageBox.Show(erro, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)); //5
- baixaServico.LimparErrosValidacao();
- return;
- }
- baixaServico.Salvar(); //4
- MessageBox.Show("Novo registro salvo.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
- botaoSalvarClicado = true;
- Close();
- }
- catch (FormatException) //6
- {//7
- MessageBox.Show("Oops.. informe apenas numeros com \",\" ou \".\"", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement