private void btnSalvar_Click(object sender, EventArgs e) { try { model set = new model(); DtoMotorista c = new DtoMotorista(); c.nome = textBoxNome.Text; c.endereco = textBoxEndereco.Text; c.telefone = textBoxTelefone.Text; c.email = textBoxEmail.Text; c.cpfcnpj = textBoxCPF.Text; c.ierg = textBoxRG.Text; c.id_cidade = Convert.ToInt16(comboBox1.SelectedValue); c.observacoes = textBoxObservacao.Text; c.complemento = textBoxComplemento.Text; if (textBoxComissao.Text != string.Empty) { c.comissao = float.Parse(textBoxComissao.Text); } if (textBoxID.Text == string.Empty) { set.setMotorista(c); } else { c.id = int.Parse(textBoxID.Text); set.AlteraMotorista(c); } MessageBox.Show("Registro salvo com sucesso"); } catch (Exception ex) { throw ex; } }