private void btnCadastrar_Click(object sender, EventArgs e) { if (txtSenha.Text == txtCSenha.Text) { Cadastro cad = new Cadastro(); dal da = new dal(); string dia = DataNasc.Value.Day.ToString(); string mes = DataNasc.Value.Month.ToString(); string ano = DataNasc.Value.Year.ToString(); string data = (ano + "/" + mes + "/" + dia); cad.Data = data; cad.Nome = txtNome.Text; cad.Email = txtEmail.Text; cad.Login = txtLogin.Text; cad.Senha = txtSenha.Text; if (rbtMasculino.Checked == true) { cad.Sexo = "M"; } if (rbtFeminino.Checked == true) { cad.Sexo = "F"; } da.cadastro(cad); txtNome.Text = ""; txtLogin.Text = ""; txtEmail.Text = ""; txtSenha.Text = ""; txtCSenha.Text = ""; txtNome.Focus(); MessageBox.Show("Você está registrado!"); Perfil p = new Perfil(); this.Close(); p.Show(); } else { MessageBox.Show("Confirme se sua senha e email estão iguais!"); } }
private void btnCadastrar_Click(object sender, EventArgs e) { if (txtSenha.TextLength < 3) { MessageBox.Show("Sua senha deve ter no minimo 3 caracteres!", "Alerta!"); } if (txtSenha.Text != txtCSenha.Text) { txtSenha.Text = ""; txtCSenha.Text = ""; MessageBox.Show("Sua confirmação de senha não está igual!", "Alerta!"); } if (txtNome.TextLength < 3) { MessageBox.Show("Insira um nome com no mínimo 3 caracteres!", "Alerta!"); } if (txtLogin.TextLength < 4) { MessageBox.Show("Seu login deve conter no mínimo 4 caracteres!", "Alerta!"); } Login = txtLogin.Text; Metodos met = new Metodos(); met.buscarLoginErro(Login); string Erro = met.LoginErro; if (Erro != null) { MessageBox.Show("Escolha um Login disponivel!", "Erro"); txtLogin.Text = ""; } if (Erro == null && txtSenha.Text == txtCSenha.Text && txtSenha.TextLength > 2 && txtNome.TextLength > 2 && txtLogin.TextLength > 3) { Cadastro cad = new Cadastro(); dal da = new dal(); string dia = DataNasc.Value.Day.ToString(); string mes = DataNasc.Value.Month.ToString(); string ano = DataNasc.Value.Year.ToString(); string data = (ano + "/" + mes + "/" + dia); cad.Data = data; cad.Nome = txtNome.Text; cad.Email = txtEmail.Text; cad.Login = txtLogin.Text; cad.Senha = txtSenha.Text; Login = txtLogin.Text.ToString(); if (rbtMasculino.Checked == true) { cad.Sexo = "M"; } if (rbtFeminino.Checked == true) { cad.Sexo = "F"; } da.cadastro(cad); MessageBox.Show("Está quase lá! Selecione uma foto de perfil!", "Prossiga"); FotoUsuario foto = new FotoUsuario(Login); foto.Show(); this.Close(); } }