private void btnCadastrarNovoUser_Click(object sender, RoutedEventArgs e) { Cad = new Framework.Login.DadosModel(); if (tb_nomeCadastro.Text == string.Empty || tb_usuarioCadastro.Text == string.Empty || tb_senhaCadastro.Password == string.Empty || tb_cpfCadastro.Text == string.Empty || cb_permissaoCadastro.SelectedIndex == -1) { MessageBox.Show("Tente preencher todos os campos antes de clicar em Cadastrar novamente! :P", "Algo Errado!!!", MessageBoxButton.OK, MessageBoxImage.Error); } else { Cad.users.Add(new Framework.Login.users { nome = tb_nomeCadastro.Text, usuario = tb_usuarioCadastro.Text, senha = Crypt.md5(tb_senhaCadastro.Password), cpf = tb_cpfCadastro.Text, level = cb_permissaoCadastro.SelectedIndex }); Cad.SaveChanges(); tb_nomeCadastro.Text = ""; tb_usuarioCadastro.Text = ""; tb_senhaCadastro.Password = ""; tb_cpfCadastro.Text = ""; cb_permissaoCadastro.SelectedIndex = -1; MessageBox.Show("Usuário " + tb_nomeCadastro.Text + " cadastrado!\nVocê já pode fazer login.", "Legal!!!", MessageBoxButton.OK, MessageBoxImage.Information); } }// FIM EVENTO PARA CADASTRAR