123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace Agency.Windows
- {
- /// <summary>
- /// Логика взаимодействия для RentProperty.xaml
- /// </summary>
- public partial class RentProperty : Window
- {
- public RentProperty()
- {
- InitializeComponent();
- gr606_midvlContext context = new gr606_midvlContext();
- var address = context.Addreses;
- var property = context.TheProperties;
- foreach (var item in address)
- {
- if (CityRent.Items.Contains(item.City)) { }
- else
- {
- CityRent.Items.Add(item.City);
- }
- }
- foreach (var prpIt in property)
- {
- if (TypeProperty.Items.Contains(prpIt.PropertyType)) { }
- else
- {
- TypeProperty.Items.Add(prpIt.PropertyType);
- }
- if (RayonProperty.Items.Contains(prpIt.District)) { }
- else
- {
- RayonProperty.Items.Add(prpIt.District);
- }
- }
- }
- private void Search(object sender, RoutedEventArgs e)
- {
- try
- {
- ListProperty.Items.Clear();
- gr606_midvlContext context = new gr606_midvlContext();
- var items = context.TheProperties.Where(x => x.TypeRent == "Сдаётся" && x.Price <= Convert.ToInt32(BorderPrice.Text)
- && x.PropertyType == TypeProperty.Text && x.District == RayonProperty.Text);
- var adreses = context.Addreses;
- //string[] itemsList;
- string post;
- foreach (var item in items)
- {
-
- //var adr = adreses.SingleOrDefault(x => x.Id == item.Address);
- post = $"Описание: {item.Name}\n" +
- $"Стоимость: {item.Price}р\n" +
- $"Район: {item.District}\n" +
- $"Тип нидвижимости: {item.PropertyType}\n" +
- $"Этаж: {item.Floor}\n" +
- $"Кол-во комнат: {item.Rooms}\n" +
- $"Плащадь: {item.Area} м2\n" +
- $"*************************************\n" +
- $"Если заинтересовала недвижимость то обезательно\n" +
- $"Звоните в Агенство! Номер этой недвижимости: ({item.Id})\n" +
- $"Номер Агенства: (Тут уже будет номер)\n" +
- $"*************************************";
- ListProperty.Items.Add(post);
- }
- if (ListProperty.Items.Count == 0)
- {
- ListProperty.Items.Add("Увы по вашим критериям недвижимости нет!");
- }
- }
- catch (Exception)
- {
- ListProperty.Items.Add("Увы по вашим критериям недвижимости нет!");
-
- }
- }
- void ListProperty_Click(object sender, EventArgs e)
- {
- MessageBox.Show(ListProperty.SelectedItem.ToString());
- }
- private void Close(object sender, RoutedEventArgs e)
- {
- Windows.HomeWindow home = new Windows.HomeWindow();
- home.Show();
- this.Hide();
- }
- }
- }
|