/// <summary> /// Repeater DataBound /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rptDados_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { BR_Estabelecimento estab = (BR_Estabelecimento)e.Item.DataItem; Label nome = (Label)e.Item.FindControl("lblNome"); Label descricao = (Label)e.Item.FindControl("lblDescricao"); Label categoria = (Label)e.Item.FindControl("lblCategoria"); Label endereco = (Label)e.Item.FindControl("lblEndereco"); Label nota = (Label)e.Item.FindControl("lblNota"); Image img = (Image)e.Item.FindControl("img"); if (estab.BR_Fotos_Estabelecimento.Count > 0) { img.ImageUrl = "~/Img/Estabelecimento/" + estab.BR_Fotos_Estabelecimento.FirstOrDefault().Imagem.ToUpper().Replace(".JPG", "_T.JPG").Replace(".PNG", "_T.PNG"); } // BR_Lista_Prato pratos = (BR_Lista_Prato)e.Item.DataItem; // Label prato = (Label)e.Item.FindControl("lblPrato"); // Label preco = (Label)e.Item.FindControl("lblPreco"); /* * nome.Text = estab.Nome; * descricao.Text = estab.DescricaoCurta; * categoria.Text = estab.Categoria; * nota.Text = "Nota: " + estab.Nota; * img.ImageUrl = "~/Img/Estabelecimento/" + estab.Imagem; */ } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Page.RouteData.Values.Count < 1) { Response.Redirect("~/Lugar"); } Int32.TryParse(Page.RouteData.Values["IdEstabelecimento"].ToString(), out Id); var estab = EstabelecimentoService.SelectById(Id); if (estab.Sucesso && estab != null) { CarregaCaracterirticas(); DetalhesEstab = ((BR_Estabelecimento)(estab.RetObj)); img.ImageUrl = "~/Images/Estabelecimento/" + DetalhesEstab.BR_Fotos_Estabelecimento.First().Imagem; lblNome.Text = DetalhesEstab.Razao_Social; lblDesc.Text = DetalhesEstab.Descricao; /* litWifi.Text = DetalhesEstab.Tem_Wifi != true ? "WiFi: Não" : "WiFi: Sim"; * litEstacionamento.Text = DetalhesEstab.Tem_Estacionamento != true ? "Estacionamento: Não" : "Estacionamento: Sim"; * litAcessoDeficiente.Text = DetalhesEstab.Tem_Acesso_Deficiente != true ? "Acesso a deficiente: Não" : "Acesso a deficiente: Sim"; * litFraldario.Text = DetalhesEstab.Tem_Fraldario != true ? "Fraldário: Não" : "Fraldário: Sim"; * litEspacoKids.Text = DetalhesEstab.Tem_Espaco_Kids != true ? "Espaço Kids: Não" : "Espaço Kids: Sim"; * litReserva.Text = DetalhesEstab.Tem_Reserva != true ? "Reserva: Não" : "Reserva: Sim"; * litTemMusica.Text = DetalhesEstab.Tem_Musica != true ? "Música: Não" : "Música: Sim"; * litCustomizacao.Text = DetalhesEstab.Tem_Customizacao != true ? "Customização: Não" : "Customização: Sim"; * litChamaGarcom.Text = DetalhesEstab.Tem_Chamada_Garcom != true ? "Chamar garçom: Não" : "Chamar garçom: Sim"; */ imgwifi.Visible = (DetalhesEstab.Tem_Wifi == true ? true : false); imgEstac.Visible = (DetalhesEstab.Tem_Estacionamento == true ? true : false); imgdeficientes.Visible = (DetalhesEstab.Tem_Acesso_Deficiente == true ? true : false); imgfraldario.Visible = (DetalhesEstab.Tem_Fraldario == true ? true : false); imgreserva.Visible = (DetalhesEstab.Tem_Reserva == true ? true : false); imgespacokids.Visible = (DetalhesEstab.Tem_Espaco_Kids == true ? true : false); imgmusica.Visible = (DetalhesEstab.Tem_Musica == true ? true : false); imgcustomizacao.Visible = (DetalhesEstab.Tem_Customizacao == true ? true : false); imgChamaGar.Visible = (DetalhesEstab.Tem_Chamada_Garcom == true ? true : false); rptDados.DataSource = DetalhesEstab.BR_Prato; rptDados.DataBind(); CarregaAvaliacoes(); CarregaComentarios(); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "IniciaMapa(" + DetalhesEstab.Latitude + "," + DetalhesEstab.Longitude + ");", true); } else { Response.Redirect("~/Lugar"); } } }
/// <summary> /// Repeater DataBound /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void rptDados_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { BR_Estabelecimento estab = (BR_Estabelecimento)e.Item.DataItem; Label nome = (Label)e.Item.FindControl("lblNome"); HyperLink descricao = (HyperLink)e.Item.FindControl("hplDesc"); HyperLink estabelecimento = (HyperLink)e.Item.FindControl("hplEstab"); Label endereco = (Label)e.Item.FindControl("lblEndereco"); Label nota = (Label)e.Item.FindControl("lblNota"); Image img = (Image)e.Item.FindControl("img"); Label qtd = (Label)e.Item.FindControl("lblQtd"); if (estab.BR_Fotos_Estabelecimento.Count > 0) { img.ImageUrl = "~/Images/Estabelecimento/" + estab.BR_Fotos_Estabelecimento.FirstOrDefault().Imagem; } nome.Text = estab.Razao_Social; descricao.NavigateUrl = "~/VerEstabelecimento/" + estab.Id; estabelecimento.NavigateUrl = "~/VerEstabelecimento/" + estab.Id; qtd.Text = "Pratos:" + estab.BR_Prato.Count; } }