protected void ButtonEntrar_Click(object sender, EventArgs e) { WebApplicationWhatIF.DAL.DALAluno dalaluno = new WebApplicationWhatIF.DAL.DALAluno(); bool verif = dalaluno.Autenticar(TextBoxLogin.Text, TextBoxSenha.Text); if (verif) { Session["Nome"] = TextBoxLogin.Text; Session["Senha"] = TextBoxSenha.Text; Response.Redirect("~/WebFormIndex.aspx"); } else { teste.Text = "Usuário inválido!"; } }
protected void ButtonEnviar_Click(object sender, EventArgs e) { bool escolaPublica = Convert.ToBoolean(DropDownListEscola.SelectedItem.Value); WebApplicationWhatIF.DAL.DALAluno dalaluno = new WebApplicationWhatIF.DAL.DALAluno(); List <Modelo.Aluno> alunoverif = new List <Modelo.Aluno>(); alunoverif = dalaluno.Select(TextBoxNome.Text); if (alunoverif.Count == 0) { Modelo.Aluno aluno = new Modelo.Aluno(TextBoxNome.Text, TextBoxSenha.Text, TextBoxEmail.Text, escolaPublica, false, null); // FAZER IR FOTO PADRAO dalaluno.InsertNovoAluno(aluno); Response.Redirect("~/WebFormAutenticar.aspx"); } else { Label1.Text = "Nome do usuário já está sendo usado."; } }