Exemple #1
0
        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;
            }
        }
Exemple #2
0
        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;
            }
        }
Exemple #3
0
        // --------------------------------------------------------------------------------------------
        public Entidades.ProdutosCollection CarregaCategorias()
        {
            try
            {
                Entidades.Produtos           Ent    = new Entidades.Produtos();
                Entidades.ProdutosCollection EntCol = new Entidades.ProdutosCollection();

                //string banco = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=buffalobr.mysql.uhserver.com; DATABASE=buffalobr; UID=buffalobr;PASSWORD=gab97081@@--; OPTION=3";
                //OdbcConnection conexao = new OdbcConnection(banco);

                string banco = "server=mysql.brnow.com.br;database=brnow;uid=brnow;pwd=e7p5a7";
                conexao = new MySqlConnection(banco);

                conexao.Open();

                string          comando = "SELECT * FROM tb_BU_Categoria WHERE Ativo = 1";
                MySqlCommand    cmd     = new MySqlCommand(comando, conexao);
                MySqlDataReader reader  = cmd.ExecuteReader();

                //OdbcCommand cmd = new OdbcCommand(comando, conexao);
                //OdbcDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Ent = new Entidades.Produtos();

                    //Ent.IdCategoria = Convert.ToInt32(reader.GetString("idCategoria"));
                    //Ent.NomeCategoria = reader.GetString("NomeCategoria");

                    Ent.IdCategoria   = reader.GetInt32(0);
                    Ent.NomeCategoria = reader.GetString(1);

                    EntCol.Add(Ent);
                }

                conexao.Close();
                return(EntCol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
 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;
     }
 }
Exemple #5
0
        // --------------------------------------------------------------------------------------------
        public Entidades.ProdutosCollection CarregaFotos(Int32 produto)
        {
            try
            {
                Entidades.Produtos           Ent    = new Entidades.Produtos();
                Entidades.ProdutosCollection EntCol = new Entidades.ProdutosCollection();
                string banco = "server=mysql.brnow.com.br;database=brnow;uid=brnow;pwd=e7p5a7";
                conexao = new MySqlConnection(banco);

                //string banco = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=buffalobr.mysql.uhserver.com; DATABASE=buffalobr; UID=buffalobr;PASSWORD=gab97081@@--; OPTION=3";
                //OdbcConnection conexao = new OdbcConnection(banco);

                conexao.Open();
                string comando = @"SELECT * FROM `tb_BU_Imagens` WHERE IdProduto = " + produto + " AND Ativo = 1 ORDER BY idImagem;";

                //OdbcCommand cmd = new OdbcCommand(comando, conexao);

                MySqlCommand cmd = new MySqlCommand(comando, conexao);
                cmd.Parameters.AddWithValue("@produto", produto);
                MySqlDataReader reader = cmd.ExecuteReader();

                //OdbcDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Ent = new Entidades.Produtos();
                    //Ent.IdProduto = Convert.ToInt32(reader.GetString("idProduto"));
                    //Ent.Imagem = reader.GetString("Imagem");
                    Ent.idImagem = reader.GetInt32(0);;
                    Ent.Imagem   = reader.GetString(1);
                    EntCol.Add(Ent);
                }
                conexao.Close();
                return(EntCol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #6
0
        // --------------------------------------------------------------------------------------------
        public Entidades.ProdutosCollection CarregaProdutos()
        {
            try
            {
                Entidades.Produtos           Ent    = new Entidades.Produtos();
                Entidades.ProdutosCollection EntCol = new Entidades.ProdutosCollection();

                string banco = "server=mysql.brnow.com.br;database=brnow;uid=brnow;pwd=e7p5a7";
                conexao = new MySqlConnection(banco);

                //string banco = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=buffalobr.mysql.uhserver.com; DATABASE=buffalobr; UID=buffalobr;PASSWORD=gab97081@@--; OPTION=3";
                //OdbcConnection conexao = new OdbcConnection(banco);

                conexao.Open();

                string comando = @"SELECT
	                                TBP.idProduto,
	                                TBP.Codigo,
	                                TBP.NomeProduto,
	                                TBP.Descricao,
	                                TBP.Especificacoes,
	                                TBP.Categoria,
	                                TBC.NomeCategoria,
	                                TBP.Imagem
                                FROM
	                                `tb_BU_Produto` TBP INNER JOIN tb_BU_Categoria TBC ON TBP.Categoria = TBC.idCategoria
                                WHERE
	                                TBP.Ativo = 1 ORDER BY idProduto DESC;"    ;

                //OdbcCommand cmd = new OdbcCommand(comando, conexao);
                //OdbcDataReader reader = cmd.ExecuteReader();

                MySqlCommand    cmd    = new MySqlCommand(comando, conexao);
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Ent                = new Entidades.Produtos();
                    Ent.IdProduto      = reader.GetInt32(0);
                    Ent.CodProduto     = reader.GetString(1);
                    Ent.NomeProduto    = reader.GetString(2);
                    Ent.Descricao      = reader.GetString(3);
                    Ent.Especificacoes = reader.GetString(4);
                    Ent.IdCategoria    = reader.GetInt32(5);
                    Ent.NomeCategoria  = reader.GetString(6);
                    Ent.Imagem         = reader.GetString(7);
                    //Ent.IdProduto = Convert.ToInt32(reader.GetString("idProduto"));
                    //Ent.CodProduto = reader.GetString("Codigo");
                    //Ent.NomeProduto = reader.GetString("NomeProduto");
                    //Ent.Descricao = reader.GetString("Descricao");
                    //Ent.Especificacoes = reader.GetString("Especificacoes");
                    //Ent.IdCategoria = Convert.ToInt32(reader.GetString("Categoria"));
                    //Ent.NomeCategoria = reader.GetString("NomeCategoria");
                    //Ent.Imagem = reader.GetString("Imagem");

                    EntCol.Add(Ent);
                }
                conexao.Close();
                return(EntCol);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }