private void Button_Click_7(object sender, RoutedEventArgs e)
 {
     string[] or = client.SelectedItem.ToString().Split('\t');
     using (Estate_agancyEntities1 db = new Estate_agancyEntities1())
     {
         db.Delete_client(Convert.ToInt32(or[1]));
         db.SaveChanges();
         MessageBox.Show("Объект удалён");
         fill_clients();
     }
 }
        private void Del_Click(object sender, RoutedEventArgs e)
        {
            if (type.SelectedValue.ToString() == "Квартира")
            {
                string[] ord = list.SelectedValue.ToString().Split('\t');
                string   key = client.SelectedValue.ToString();
                using (Estate_agancyEntities1 db = new Estate_agancyEntities1())
                {
                    var client_ID = db.client.Where(p => p.Full_name == key.ToString()).FirstOrDefault().ID_client;
                    int id        = Convert.ToInt32(client_ID);
                    db.Add_deal_with_appartent(Convert.ToInt32(ord[13]), Convert.ToDouble(ord[1]), Convert.ToInt32(ord[5]), Convert.ToInt32(3), client.SelectedValue.ToString(), ord[9], Convert.ToDouble(ord[7]));
                    db.Delete_client(id);
                    db.Delete_apaetament(Convert.ToInt32(ord[13]));
                    db.SaveChanges();
                    MessageBox.Show("add");
                }
                fill_apartaments();
            }
            if (type.SelectedValue.ToString() == "Дом")
            {
                string[] ord = list.SelectedValue.ToString().Split('\t');
                string   key = client.SelectedValue.ToString();

                using (Estate_agancyEntities1 db = new Estate_agancyEntities1())
                {
                    var client_ID = db.client.Where(p => p.Full_name == key.ToString()).FirstOrDefault().ID_client;
                    int id        = Convert.ToInt32(client_ID);

                    db.Add_deal_with_house(Convert.ToInt32(ord[15]), Convert.ToInt32(ord[5]), Convert.ToInt32(ord[7]), Convert.ToDouble(ord[3]), client.SelectedValue.ToString(), ord[11], Convert.ToDouble(ord[9]));
                    db.Delete_client(id);
                    db.Delete_house(Convert.ToInt32(ord[17]));
                    db.SaveChanges();
                    MessageBox.Show("add");
                }
                fill_house();
            }
        }