protected void Estrela5_Click(object sender, EventArgs e) { DAL.DALRates dalaval = new DAL.DALRates(); DAL.DALGames daljogo = new DAL.DALGames(); Modelo.Avaliacao ava = new Modelo.Avaliacao(5, DAL.DALGames.SelectByName(jogo.nome).id, Session["id"].ToString()); if (DAL.DALRates.Select(DAL.DALGames.SelectByName(jogo.nome).id, Session["id"].ToString()) != null) { Estrela1.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela2.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela3.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela4.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela5.ImageUrl = "~/Images/EstrelaAcesa.png"; DAL.DALRates.Delete(ava); DAL.DALRates.Insert(ava); this.avaliacao = false; } else { Estrela1.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela2.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela3.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela4.ImageUrl = "~/Images/EstrelaAcesa.png"; Estrela5.ImageUrl = "~/Images/EstrelaAcesa.png"; DAL.DALRates.Insert(ava); this.avaliacao = true; } }
//excluir jogo protected void Confirmar_Click(object sender, EventArgs e) { string JogoUrl = this.jogo.jogoUrl; string descricao = this.jogo.descricao; string imagemUrl = this.jogo.imagemUrl; string nome = this.jogo.nome; DAL.DALGames daljogo = new DAL.DALGames(); Modelo.Jogo jogo = new Modelo.Jogo(JogoUrl, descricao, imagemUrl, nome); DAL.DALGames.Delete(jogo); Response.Redirect("~/Administrador/Index.aspx"); }
protected void addGame_Click(object sender, EventArgs e) { if (Categorias.SelectedItem.Value != "Escolha uma categoria") { //uploadGame(); uploadImage(); DAL.DALGames jogo = new DAL.DALGames(); Modelo.Jogo jog = new Modelo.Jogo(JogoUrl.Text, TextBox1.Text, this.imagem, TextBox2.Text, "..\\Images\\" + UploadImage.FileName); DAL.DALGames.Insert(jog); this.jogocategoria = new Modelo.JogoCategoria(DAL.DALGames.SelectByName(jog.nome).id, int.Parse(Categorias.SelectedItem.Value)); DAL.DALGamesCategories.Insert(this.jogocategoria); Response.Redirect("~/Administrador/Index.aspx"); } Response.Redirect("~/Administrador/Index.aspx"); }
protected void getPesquisaJog() { if (!Page.IsPostBack) { string connectionString = ConfigurationManager.ConnectionStrings["iGamesConnectionString"].ConnectionString; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); string a = Request.Form["search"]; string sqlBusca = "SELECT * FROM dbo.fn_Busca (" + a + ")"; SqlCommand cmdBusca = new SqlCommand(sqlBusca, connection); SqlDataReader drBusca = cmdBusca.ExecuteReader(); if (drBusca.HasRows) { while (drBusca.Read()) { daljogo = new DAL.DALGames(); string nome = (string)drBusca["nome"]; jog = DAL.DALGames.SelectByName(nome); jogos.Add(jog); } } connection.Close(); } }