Example #1
0
        }// --------------------------------------------------------------------------------------------

        public Entidades.ImovelColletion CarregaSubCategorias()
        {
            try
            {
                Entidades.Imovel          Ent    = new Entidades.Imovel();
                Entidades.ImovelColletion EntCol = new Entidades.ImovelColletion();

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

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

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

                    Ent.Id_SubCategoria = reader.GetInt32(0);
                    Ent.Nome            = reader.GetString(1);

                    EntCol.Add(Ent);
                }

                conexao.Close();
                return(EntCol);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public void CarregaImovel()
        {
            try
            {
                System.Text.StringBuilder sb      = new System.Text.StringBuilder();
                Entidades.ImovelColletion EntColl = new Entidades.ImovelColletion();
                BLL.Imovel Bll = new BLL.Imovel();
                EntColl = Bll.CarregaImovel();
                sb.AppendLine(@"<div class='table-responsive'>
                            <table class='table' id='table2'>
                                <thead>
                                    <tr>
                                        <th width='20%'>Nome Imóvel</th>
                                        <th width='7%'>Número</th>
                                        <th>Preço</th>
                                        <th width='15%'>Categoria</th>
                                        <th width='10%'>Ações</th>
                                    </tr>
                                </thead>
                                <tbody>");
                string cssli = "";

                foreach (var imovel in EntColl)
                {
                    if (cssli == "odd")
                    {
                        cssli = "even";
                    }
                    else
                    {
                        cssli = "odd";
                    }
                    sb.AppendLine(@"
                        <tr class='" + cssli + @" gradeA'>
                            <td>" + imovel.Nome_Imovel + @"</td>
                            <td>" + imovel.Numero + @"</td>
                            <td>" + imovel.Preco + @" </td>");
                    string descri = imovel.Categoria.ToString();
                    //descri.Substring(0, descri.IndexOf(' ', 48));
                    //sb.AppendLine("<td>" + descri + "</td>");
                    sb.AppendLine("<td>" + imovel.Categoria + @"</td>");
                    sb.AppendLine("<td class='center'>");
                    //sb.AppendLine("<a href='Cadastro_Imagens.aspx?prt=" + imovel.IdProduto + "'><img src='images/adicionar.png' /></a>");
                    sb.AppendLine("<img style='cursor:pointer;' onclick=\"return RemoveImovel('" + imovel.ID_Imovel + "')\" src='images/remover.png' />");
                    sb.AppendLine("<a href='Editar_Imovel.aspx?prt=" + imovel.ID_Imovel + "'><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;
            }
        }
Example #3
0
        // --------------------------------------------------------------------------------------------
        public Entidades.ImovelColletion CarregaImovel()
        {
            try
            {
                Entidades.Imovel          Ent    = new Entidades.Imovel();
                Entidades.ImovelColletion EntCol = new Entidades.ImovelColletion();
                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.ID_Imovel,
	                                TBP.Nome_Imovel,
	                                TBP.Numero,
	                                TBP.Preco,
	                                TBP.Categoria,
	                                TBP.SubCategoria,
	                                TBC.tipoImovel
                                FROM
	                                `TB_Imovel` TBP INNER JOIN tb_Categoria TBC ON TBP.Categoria = TBC.idTipoImovel
                                WHERE
	                                TBP.Ativo = 1 ORDER BY ID_Imovel DESC;"    ;
                MySqlCommand    cmd     = new MySqlCommand(comando, conexao);
                MySqlDataReader reader  = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Ent              = new Entidades.Imovel();
                    Ent.ID_Imovel    = reader.GetInt32(0);
                    Ent.Nome_Imovel  = reader.GetString(1);
                    Ent.Numero       = reader.GetInt32(2);
                    Ent.Preco        = reader.GetDouble(3);
                    Ent.Categoria    = reader.GetInt32(4);
                    Ent.SubCategoria = reader.GetInt32(5);
                    Ent.TipoImovel   = 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;
            }
        }// --------------------------------------------------------------------------------------------
Example #4
0
        public void CarregaSubCategorias()
        {
            try
            {
                Entidades.ImovelColletion EntColl = new Entidades.ImovelColletion();
                BLL.Imovel BLL = new BLL.Imovel();
                EntColl = BLL.CarregaSubCategorias();

                ddlSubCategoria.DataTextField  = "Nome";
                ddlSubCategoria.DataValueField = "id_SubCategoria";

                ddlSubCategoria.DataSource = EntColl;
                ddlSubCategoria.DataBind();

                ddlSubCategoria.Items.Insert(0, "Selecione");
                ddlSubCategoria.SelectedIndex = 0;
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }