예제 #1
0
        private void SearchByAdress_Click(object sender, RoutedEventArgs e)
        {
            BindingList <IRealty> sr = new BindingList <IRealty>();

            searchGrid.ItemsSource = sr;
            sr.Clear();
            ArrayList result = new ArrayList();
            ArrayList all    = new ArrayList();

            all.AddRange(db.Lands.Local.ToList());
            all.AddRange(db.Apartments.Local.ToList());
            all.AddRange(db.Houses.Local.ToList());
            db.Houses.Where(p => p.city == "city");

            string adress = cityText.Text.Trim().ToLower() + streetText.Text.Trim().ToLower() + houseNumberText.Text.Trim().ToLower() + apartmentNumberText.Text.Trim().ToLower();

            //string fioSearch = name.Text.Trim().ToLower() + lastName.Text.Trim().ToLower() + patronymic.Text.Trim().ToLower();
            foreach (var item in all)
            {
                if (item != null)
                {
                    if (item is IRealty)
                    {
                        string[] data = Levi.GetLeviData(cityText.Text, streetText.Text, houseNumberText.Text, apartmentNumberText.Text, (IRealty)item);
                        if (Levi.LevenshteinDistance(data[0], data[1]) <= 3)
                        {
                            sr.Add(item as IRealty);
                        }
                    }
                }
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ol.Clear();

            ArrayList all = new ArrayList();

            all.AddRange(db.Users.Local.ToList());
            all.AddRange(realtorContext.Realtors.Local.ToList());
            string fioSearch = name.Text.Trim().ToLower() + lastName.Text.Trim().ToLower() + patronymic.Text.Trim().ToLower();

            foreach (var item in all)
            {
                if (item != null)
                {
                    if (item is IFIO)
                    {
                        string[] data = Levi.GetLeviData(lastName.Text, name.Text, patronymic.Text, (IFIO)item);
                        if (Levi.LevenshteinDistance(data[0], data[1]) <= 3)
                        {
                            ol.Add(item as IFIO);
                        }
                    }
                }
            }
        }