private void buscar(string busqueda) { Services.Inmueble inmueble = new Services.Inmueble(); List <Entities.Inmueble> inmuebles = inmueble.TraerInmuebles(busqueda); List <Card> cards = new List <Card>(); if (inmuebles.Count == 0) { panel1.Visible = true; } else { panel1.Visible = false; } foreach (Entities.Inmueble _inmueble in inmuebles) { cards.Add(new Card(_inmueble.Id, _inmueble.Uri, _inmueble.Title, _inmueble.Ubication, _inmueble.Description, _inmueble.Stars, false)); } flowLayoutPanel1.Controls.Clear(); flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; flowLayoutPanel1.WrapContents = false; flowLayoutPanel1.Height = cards.Count * 270; foreach (Control control in cards) { flowLayoutPanel1.Controls.Add(control); } }
private void AlquilerForm_Load(object sender, EventArgs e) { Services.Inmueble inmueble = new Services.Inmueble(); try { ubicacion.Items.AddRange(inmueble.TraerPaises().ToArray()); } catch (Exception error) { MessageBox.Show(error.Message); } }
private void pictureBox2_Click(object sender, EventArgs e) { Services.Inmueble inmueble = new Services.Inmueble(); try { string msg = inmueble.BorrarFavoritos(id); this.Hide(); MessageBox.Show(msg); }catch (Exception error) { MessageBox.Show(error.Message, "Erro"); } }
private void Favoritos_Load(object sender, EventArgs e) { Services.Inmueble inmueble = new Services.Inmueble(); List <Entities.Inmueble> inmuebles = inmueble.TraerFavoritos(); List <Card> cards = new List <Card>(); foreach (Entities.Inmueble _inmueble in inmuebles) { cards.Add(new Card(_inmueble.Id, _inmueble.Uri, _inmueble.Title, _inmueble.Ubication, _inmueble.Description, _inmueble.Stars, true)); } flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; flowLayoutPanel1.WrapContents = false; flowLayoutPanel1.Height = cards.Count * 260; foreach (Control control in cards) { flowLayoutPanel1.Controls.Add(control); } if (cards.Count == 0) { panel1.Visible = true; } Entities.Session.sessionListener += Session_Listener; Services.Usuario usuario = new Services.Usuario(); try { if (usuario.isLogged()) { loggedTab.Visible = true; button1.Visible = false; button2.Visible = false; } else { loggedTab.Visible = false; button1.Visible = true; button2.Visible = true; } } catch { } }
private void button1_Click(object sender, EventArgs e) { Services.Inmueble inmueble = new Services.Inmueble(); try { MemoryStream ms = new MemoryStream(); bitmap.Save(ms, ImageFormat.Png); byte[] byteImg = ms.ToArray(); string msg = inmueble.CrearAlquiler( titulo.Text, descripcion.Text, direccion.Text, ubicacion.Text, float.Parse(precio.Text), Convert.ToBase64String(byteImg)); MessageBox.Show(msg); this.Close(); } catch (Exception error) { MessageBox.Show(error.Message, "Error"); } }