private void btnSalvar_Click(object sender, EventArgs e) { Model.Cadastro_UsuarioM musu = new Model.Cadastro_UsuarioM(); Dao.Cadastra_UsuarioD dusu = new Dao.Cadastra_UsuarioD(); Dao.LoginBD l = new Dao.LoginBD(); if (textBoxID.Text == "") { if (textBoxSenha.Text == textBoxConfirmaSenha.Text) { if (textBoxSenha.Text != "" && textBoxConfirmaSenha.Text != "" && textBoxUsuario.Text != "") { musu.SetUsuario(textBoxUsuario.Text); musu.SetSenha(textBoxSenha.Text); if (!dusu.Validausuario(musu)) { dusu.CadastraUsuario(musu); MessageBox.Show("Usuario cadastrado com sucesso !!!"); textBoxID.Clear(); textBoxUsuario.Clear(); textBoxSenha.Clear(); textBoxConfirmaSenha.Clear(); } else { MessageBox.Show("Usuario ja cadastrado !!!"); } } else { MessageBox.Show("Campos nao podem ser vazios !!"); } } else { MessageBox.Show("Senhas não conferem !"); } } else if (textBoxSenha.Text == textBoxConfirmaSenha.Text) { if (textBoxSenha.Text != "" && textBoxConfirmaSenha.Text != "") { musu.SetId(textBoxID.Text); musu.SetSenha(textBoxSenha.Text); dusu.AlterarUsuario(musu); MessageBox.Show("Senha Alterada com Sucesso !!!"); textBoxSenha.Clear(); textBoxConfirmaSenha.Clear(); } else { MessageBox.Show("Senhas não podem ser vazias !!"); } } else { MessageBox.Show("Senhas não conferem !"); } }
private void btnExcluir_Click(object sender, EventArgs e) { Model.Cadastro_UsuarioM musu = new Model.Cadastro_UsuarioM(); Dao.Cadastra_UsuarioD dusu = new Dao.Cadastra_UsuarioD(); Dao.LoginBD l = new Dao.LoginBD(); if (textBoxID.Text != "" && textBoxUsuario.Text != "") { musu.SetId(textBoxID.Text); dusu.ExcluiUsuario(musu); MessageBox.Show("Usuario excluido com Sucesso !!!"); textBoxID.Clear(); textBoxUsuario.Clear(); textBoxSenha.Clear(); textBoxConfirmaSenha.Clear(); } }