Пример #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;
            }
        }
Пример #2
0
        public void CarregaImovel(int imovel)
        {
            try
            {
                Entidades.Imovel Ent = new Entidades.Imovel();
                BLL.Imovel       BLL = new BLL.Imovel();
                Ent = BLL.CarregaImovelGetSelected(imovel);
                string Nume = Ent.Numero.ToString();
                string Prec = Ent.Numero.ToString();

                Nume = Nume.Replace("<BR>", "\r\n");
                Prec = Prec.Replace("BR", "\r\n");

                Numero.Text = Ent.Numero.ToString();
                Preco.Text  = Ent.Preco.ToString();

                Numero.Text = Nume;
                Preco.Text  = Prec;

                ddlCategoria.SelectedValue = Convert.ToString(Ent.Categoria);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        }// --------------------------------------------------------------------------------------------

        public Entidades.Imovel CarregaImovelGetSelected(Int32 imovel)
        {
            try
            {
                Entidades.Imovel Ent   = new Entidades.Imovel();
                string           banco = "server=mysql.brnow.com.br,database=brnow;uid=brnow;pwd=e7p5a7";
                conexao = new MySqlConnection(banco);
                conexao.Open();
                string       comando = @"SELECT * FROM TB_Imovel WHERE ID_Imovel = '" + imovel + "' AND Ativo = 1;";
                MySqlCommand cmd     = new MySqlCommand(comando, conexao);
                cmd.Parameters.AddWithValue("@imovel", imovel);
                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);
                }
                conexao.Close();
                return(Ent);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Пример #4
0
        protected void Atualizar_Click(object sender, EventArgs e)
        {
            try
            {
                int imovel = Convert.ToInt32(Request.QueryString["prt"]);

                Entidades.Imovel Ent = new Entidades.Imovel();
                BLL.Imovel       BLL = new global::BLL.Imovel();

                string NomeImo   = NomeImov.Text.Replace("\r\n", "<BR>");
                string NumeroImo = Numero.Text.Replace("\r\n", "<BR>");

                Ent.Nome         = NomeImov.Text;
                Ent.Numero       = Convert.ToInt32(Numero.Text);
                Ent.Preco        = Convert.ToDouble(Preco.Text);
                Ent.Categoria    = Convert.ToInt32(ddlCategoria);
                Ent.SubCategoria = Convert.ToInt32(ddlSubCat);
                BLL.AlteraImovel(imovel, Ent);
                Response.Redirect("Produto_Lista.aspx");
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #5
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;
            }
        }// --------------------------------------------------------------------------------------------
Пример #6
0
 public void InserirImovel(Entidades.Imovel Ent)
 {
     try
     {
         DAL.Imovel DAL = new DAL.Imovel();
         DAL.InserirImovel(Ent);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }// --------------------------------------------------------------------------------------------
Пример #7
0
        }// --------------------------------------------------------------------------------------------

        public void AlteraImovel(Int32 Imovel, Entidades.Imovel Ent)
        {
            try
            {
                DAL.Imovel DAL = new DAL.Imovel();
                DAL.AlteraImovel(Imovel, Ent);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Пример #8
0
        protected void Gravar_Click(object sender, EventArgs e)
        {
            try
            {
                var mensagem = string.Empty;

                Entidades.Imovel Ent = new Entidades.Imovel();
                BLL.Imovel       BLL = new global::BLL.Imovel();

                Ent.Nome_Imovel = Nome_Imovel.Text;
                Ent.Numero      = Convert.ToInt32(Numero.Text.ToString());
                Ent.Preco       = Convert.ToDouble(Preco.Text.ToString());
                //Ent.Ativo = Convert.ToInt32(Ativo.Text.ToString());
                Ent.Categoria    = Convert.ToInt32(ddlCategoria.SelectedValue.ToString());
                Ent.SubCategoria = Convert.ToInt32(SubCategoria.Text.ToString());
                BLL.InserirImovel(Ent);
                //Response.Redirect("Default.aspx");

                //if (this.IMG.HasFile)
                //{
                //    this.IMG.SaveAs(Server.MapPath("images/thumb/" + IMG.FileName));
                //    mensagem = "Imagem gravada com sucesso!";
                //    Entidades.Produtos Ent = new Entidades.Produtos();
                //    BLL.Produtos BLL = new global::BLL.Produtos();
                //    string Descri = Descricao.Text.Replace("\r\n", "<br>");
                //    string Especi = Especificacoes.Text.Replace("\r\n", "<br>");
                //string Descri = Descricao.Text.Replace("<br>", System.Environment.NewLine);
                //string Especi = Especificacoes.Text.Replace("<br>", System.Environment.NewLine);
                //string Descri = Descricao.Text.Replace(vbCrLf, "<br>");
                //string Especi = Especificacoes.Text.Replace(vbCrLf, "<br>");
                //    Ent.CodProduto = CodProd.Text;
                //    Ent.NomeProduto = NomeProd.Text;
                //    Ent.Descricao = Descri;
                //    Ent.Especificacoes = Especi;
                //    Ent.Categoria = Convert.ToInt32(ddlCategoria.SelectedValue.ToString());
                //    Ent.Imagem = IMG.FileName;
                //    BLL.InseriProduto(Ent);
                //    Response.Redirect("Default.aspx");
                //}
                //else
                //{

                //}
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
Пример #9
0
        }// --------------------------------------------------------------------------------------------

        public void AlteraImovel(Int32 Imovel, Entidades.Imovel Ent)
        {
            string         banco   = "server=mysql.brnow.com.br;database=brnow01;uid=brnow01;pwd=buffalo";
            OdbcConnection conexao = new OdbcConnection(banco);

            try
            {
                conexao.Open();
                string      comando = "UPDATE TB_Imovel SET Nome_Imovel = '" + Ent.Nome_Imovel + "', Numero = " + Ent.Numero + "', Preco = " + Ent.Preco + "', Categoria = " + Ent.Categoria + "', SubCategoria = " + Ent.SubCategoria + " WHERE ID_Imovel = " + Imovel + "";
                OdbcCommand cmd     = new OdbcCommand(comando, conexao);
                cmd.ExecuteReader();
                conexao.Close();
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }// --------------------------------------------------------------------------------------------
Пример #10
0
 public void InserirImovel(Entidades.Imovel Ent)
 {
     try
     {
         string banco = "server=mysql.brnow.com.br;database=brnow;uid=brnow;pwd=e7p5a7";
         conexao = new MySqlConnection(banco);
         conexao.Open();
         string       comando = "INSERT INTO TB_Imovel (Nome_Imovel,Numero,Preco,Ativo,Categoria,SubCategoria)VALUES(@Nome_Imovel,@Numero,@Preco,@Ativo,@Categoria,@SubCategoria)";
         MySqlCommand cmd     = new MySqlCommand(comando, conexao);
         cmd.Parameters.AddWithValue("@Nome_Imovel", Ent.Nome_Imovel);
         cmd.Parameters.AddWithValue("@Numero", Ent.Numero);
         cmd.Parameters.AddWithValue("@Preco", Ent.Preco);
         cmd.Parameters.AddWithValue("@Ativo", Ent.Ativo);
         cmd.Parameters.AddWithValue("@Categoria", Ent.Categoria);
         cmd.Parameters.AddWithValue("@SubCategoria", Ent.SubCategoria);
         cmd.ExecuteNonQuery();
         conexao.Close();
     }
     catch (global::System.Exception ex)
     {
         throw ex;
     }
 }