示例#1
0
        }     // Update_Click

        // обработчик клика по кнопке "Удалить"
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            try {
                // Если выбранных строк нет - выход
                if (WheathersGrid.SelectedItems.Count == 0)
                {
                    return;
                }

                // Для каждой выбранной строки сетки отображения данных удалить из копии таблицы
                // (т.е. из коллекции в  контексте - в объекте класса WheatherReportLVDataContext)
                foreach (object t in WheathersGrid.SelectedItems)
                {
                    Wheathers w = t as Wheathers;
                    if (w != null)
                    {
                        _db.Wheathers.DeleteOnSubmit(w);
                    }
                } // foreach

                // обновить БД  т.е. выполнить удаление
                _db.SubmitChanges();

                // обновить привязку к элементам управления
                WheathersGrid.ItemsSource = _db.Wheathers.GetNewBindingList();
                // Эти привязки к чек-боксам избыточны
                // PrecipitationsCb.ItemsSource = _db.Precipitations.GetNewBindingList();
                // RegionsCb.ItemsSource = _db.Regions.GetNewBindingList();
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            } // try-catch
        }     // Delete_Click
示例#2
0
 private void detach_Wheathers(Wheathers entity)
 {
     this.SendPropertyChanging();
     entity.Regions = null;
 }
示例#3
0
 private void attach_Wheathers(Wheathers entity)
 {
     this.SendPropertyChanging();
     entity.Regions = this;
 }
示例#4
0
 partial void DeleteWheathers(Wheathers instance);
示例#5
0
 partial void UpdateWheathers(Wheathers instance);
示例#6
0
 partial void InsertWheathers(Wheathers instance);