Пример #1
0
 private void buttonCadastrar_Click(object sender, EventArgs e)
 {
     try
     {
         localhost.Usuario usuario = new localhost.Usuario();
         usuario.Cpf      = textBoxCpf.Text;
         usuario.Nome     = textBoxNome.Text;
         usuario.Telefone = textBoxTelefone.Text;
         usuario.Endereco = textBoxEndereco.Text;
         usuario.Senha    = textBoxSenha.Text;
         localhost.Service1 sv         = new localhost.Service1();
         String             retornoMsg = sv.InsertUsuario(usuario);
         if (retornoMsg == null || "".Equals(retornoMsg))
         {
             MessageBox.Show("Usuario Cadastrado com Sucesso!");
         }
         else
         {
             MessageBox.Show(retornoMsg);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Erro ao conectar e inserir" + ex.Message);
     }
 }