public void CarregaFotos(int produto) { try { System.Text.StringBuilder sb = new System.Text.StringBuilder(); Entidades.ProdutosCollection EntColl = new Entidades.ProdutosCollection(); BLL.Produtos Bll = new BLL.Produtos(); EntColl = Bll.CarregaFotos(produto); //sb.AppendLine(""); sb.AppendLine("<ul>"); foreach (var fot in EntColl) { sb.AppendLine("<li><img src='images/produtos/" + fot.Imagem + "' width='200px' /><p style='cursor:pointer;' onclick=\"return RemoveImagem('" + fot.idImagem + "')\">remover</p></li>"); } sb.AppendLine("</ul>"); litFotos.Text = sb.ToString(); } catch (Exception) { throw; } }
public void CarregaProduto(int produto) { try { Entidades.Produtos Ent = new Entidades.Produtos(); BLL.Produtos Bll = new BLL.Produtos(); Ent = Bll.CarregaProdutoGetSelected(produto); string Descri = Ent.Descricao.ToString(); string Especi = Ent.Especificacoes.ToString(); Descri = Descri.Replace("<br>", "\r\n"); Especi = Especi.Replace("<br>", "\r\n"); CodProd.Text = Ent.CodProduto.ToString(); NomeProd.Text = Ent.NomeProduto.ToString(); Descricao.Text = Descri; Especificacoes.Text = Especi; ddlCategoria.SelectedValue = Convert.ToString(Ent.Categoria); string imagem = Ent.Imagem.ToString(); CarregaFotos(imagem); } catch (Exception) { throw; } }
public void CarregaProdutos() { try { System.Text.StringBuilder sb = new System.Text.StringBuilder(); Entidades.ProdutosCollection EntColl = new Entidades.ProdutosCollection(); BLL.Produtos Bll = new BLL.Produtos(); EntColl = Bll.CarregaProdutos(); sb.AppendLine(@"<div class='table-responsive'> <table class='table' id='table2'> <thead> <tr> <th width='20%'>Produto</th> <th width='7%'>Código</th> <th>Descrição</th> <th width='15%'>Categoria</th> <th width='10%'>Ações</th> </tr> </thead> <tbody>"); string cssli = ""; foreach (var prod in EntColl) { if (cssli == "odd") { cssli = "even"; } else { cssli = "odd"; } sb.AppendLine(@" <tr class='" + cssli + @" gradeA'> <td>" + prod.NomeProduto + @"</td> <td>" + prod.CodProduto + @"</td>"); string descri = prod.Descricao.ToString(); //descri.Substring(0, descri.IndexOf(' ', 48)); sb.AppendLine("<td>" + descri + "</td>"); sb.AppendLine("<td>" + prod.NomeCategoria + @"</td>"); sb.AppendLine("<td class='center'>"); sb.AppendLine("<a href='Cadastro_Imagens.aspx?prt=" + prod.IdProduto + "'><img src='images/adicionar.png' /></a>"); sb.AppendLine("<img style='cursor:pointer;' onclick=\"return RemoveProduto('" + prod.IdProduto + "')\" src='images/remover.png' />"); sb.AppendLine("<a href='Editar_Produto.aspx?prt=" + prod.IdProduto + "'><img src='images/editar.png' /></a>"); sb.AppendLine("</td>"); sb.AppendLine("</tr>"); } sb.AppendLine(@"</tbody> </table> </div>"); sb.AppendLine(""); litLista.Text = sb.ToString(); } catch (Exception) { throw; } }
protected void RemoveProduto_Click(object sender, EventArgs e) { try { int idProduto = Convert.ToInt32(hdnProd.Value); BLL.Produtos BLL = new BLL.Produtos(); BLL.RemoveProduto(idProduto); Response.Redirect("Produto_Lista.aspx"); } catch (Exception) { throw; } }
public void CarregaProduto(int produto) { try { idProduto.Text = produto.ToString(); Entidades.Produtos Ent = new Entidades.Produtos(); BLL.Produtos Bll = new BLL.Produtos(); Ent = Bll.CarregaProdutoGetSelected(produto); NomeProd.Text = Ent.NomeProduto.ToString(); } catch (Exception) { throw; } }
protected void RemoveImagemId_Click(object sender, EventArgs e) { try { int Foto = Convert.ToInt32(hdnProd.Value); string pro = Request.QueryString["prt"]; BLL.Produtos BLL = new BLL.Produtos(); BLL.RemoveFotos(Foto); Response.Redirect("Cadastro_Imagens.aspx?prt=" + pro + ""); } catch (Exception) { throw; } }
public void CarregaCategorias() { try { Entidades.ProdutosCollection EntColl = new Entidades.ProdutosCollection(); BLL.Produtos BLL = new BLL.Produtos(); EntColl = BLL.CarregaCategorias(); ddlCategoria.DataTextField = "NomeCategoria"; ddlCategoria.DataValueField = "IdCategoria"; ddlCategoria.DataSource = EntColl; ddlCategoria.DataBind(); ddlCategoria.Items.Insert(0, "Selecione"); ddlCategoria.SelectedIndex = 0; } catch (Exception) { throw; } }