Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. private void _rbtnSalvar_Click(object sender, EventArgs e)
  2. {
  3. try
  4. { //1
  5. baixaServico.Desconto = Convert.ToDecimal(string.IsNullOrWhiteSpace(_txtDesconto.Text) ? "0" : _txtDesconto.Text);
  6. baixaServico.FormaPagamento = _cbFormaPagamento.Text;
  7. baixaServico.IdCliente = Convert.ToInt32(_cbCliente.SelectedValue);
  8. baixaServico.FlgPago = _mckbPago.Checked ? "S" : "N";
  9.  
  10. baixaServico.Validar(); //2
  11.  
  12. if (baixaServico.ErrosValidacao.Count > 0) //3
  13. {
  14. baixaServico.ErrosValidacao.ForEach(erro => MessageBox.Show(erro, "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)); //5
  15. baixaServico.LimparErrosValidacao();
  16.  
  17. return;
  18. }
  19.  
  20. baixaServico.Salvar(); //4
  21.  
  22. MessageBox.Show("Novo registro salvo.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
  23.  
  24. botaoSalvarClicado = true;
  25.  
  26. Close();
  27. }
  28. catch (FormatException) //6
  29. {//7
  30. MessageBox.Show("Oops.. informe apenas numeros com \",\" ou \".\"", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement