private void bAddContract_Click(object sender, RoutedEventArgs e)
 {//обработчик кнопки Оформить заявку
     Windows.contractWindow w = new Windows.contractWindow(dbGridClients.SelectedItem as client);
     w.ShowDialog();
     if (w.DialogResult == true)
     {
         core.serviceCenterDB.contracts.Add(w.Contract);
         core.serviceCenterDB.SaveChanges();
         updateGBGridContracts();
     }
 }
        private void bEditContract_Click(object sender, RoutedEventArgs e)
        {
            Int32    id      = (dbGridContracts.SelectedItem as VIew_contractsExecution).Id;
            contract current = core.serviceCenterDB.contracts.Where(c => c.Id == id).First();

            Windows.contractWindow w = new Windows.contractWindow(current);
            w.ShowDialog();
            if (w.DialogResult == true)
            {
                core.serviceCenterDB.SaveChanges();
            }
            updateGBGridContracts();
        }
        private void bShowContract_Click(object sender, RoutedEventArgs e)
        {
            Int32    id      = (dbGridContracts.SelectedItem as VIew_contractsExecution).Id;
            contract current = core.serviceCenterDB.contracts.Where(c => c.Id == id).First();

            Windows.contractWindow w = new Windows.contractWindow(current);
            w.bOk.Visibility        = Visibility.Collapsed;
            w.bCancel.Content       = "Закрыть";
            w.bAddService.IsEnabled = w.bAddDevice.IsEnabled = false;
            w.bEditDevice.IsEnabled = w.bEditService.IsEnabled = false;
            w.ReadOnly = true;
            w.Width   += 500;
            w.Height  += 200;
            w.ShowDialog();
        }