protected void butNuevaPartida_Click(object sender, EventArgs e) { DALPokegotchi daLPokegotchi = new DALPokegotchi(); if (daLPokegotchi.SelectUsuario(textNombre.Text) == null && textNombre.Text != "") { daLPokegotchi.InsertarUsuario(textNombre.Text); Session["userId"] = daLPokegotchi.ObtenerIdUsuario(textNombre.Text); Session["listPokemonId"] = new Hashtable(); Response.Redirect("PaginaPokedex.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Ya existe una partida con ese nombre. Prueba a introducir uno diferente')", true); } }
protected void butCargarPartida_Click(object sender, EventArgs e) { DALPokegotchi daLPokegotchi = new DALPokegotchi(); try { if (daLPokegotchi.SelectUsuario(textNombre.Text) != null) { Session["userId"] = daLPokegotchi.ObtenerIdUsuario(textNombre.Text); Session["listPokemonId"] = new Hashtable(); Response.Redirect("PaginaPokedex.aspx", false); Context.ApplicationInstance.CompleteRequest(); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('No existe ninguna partida con ese nombre.')", true); } } catch (Exception error) { textNombre.Text = error.Message; } }