private void del_assets_Click(object sender, RoutedEventArgs e) { Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet"))); Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter(); fixedTableAdapter.Fill(fixedDataSet._fixed); for (int i = 0; i < fixed_delDataGrid.Items.Count; i++) { DataGridTemplateColumn templeColumn = fixed_delDataGrid.Columns[0] as DataGridTemplateColumn; FrameworkElement s = fixed_delDataGrid.Columns[0].GetCellContent(fixed_delDataGrid.Items[i]); CheckBox tbOper = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox; DataRowView mySelectedElement = (DataRowView)fixed_delDataGrid.Items[i]; int fixed_del_id = int.Parse(mySelectedElement.Row[31].ToString()); if ((bool)tbOper.IsChecked) { var Vdel_status = from c in fixedDataSet._fixed where c.fixed_ID == fixed_del_id select c; foreach (var a in Vdel_status) { a.del_status = "2"; } } } fixedTableAdapter.Update(fixedDataSet._fixed); fixedDataSet._fixed.AcceptChanges(); fixedTableAdapter.Fill(fixedDataSet._fixed); Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter fixed_delTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter(); fixedDataSet.fixedname.AcceptChanges(); fixed_delTableAdapter.Fill(fixedDataSet.fixed_del); }
private void del_assets_Click(object sender, RoutedEventArgs e) { Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet"))); Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter(); fixedTableAdapter.Fill(fixedDataSet._fixed); for (int i = 0; i < fixed_delDataGrid.Items.Count; i++) { DataGridTemplateColumn templeColumn = fixed_delDataGrid.Columns[0] as DataGridTemplateColumn; FrameworkElement s = fixed_delDataGrid.Columns[0].GetCellContent(fixed_delDataGrid.Items[i]); CheckBox tbOper = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox; DataRowView mySelectedElement = (DataRowView)fixed_delDataGrid.Items[i]; int fixed_del_id = int.Parse(mySelectedElement.Row[31].ToString()); if ((bool)tbOper.IsChecked) { var Vdel_status = from c in fixedDataSet._fixed where c.fixed_ID == fixed_del_id select c; foreach (var a in Vdel_status) { a.del_status = "2"; } } } fixedTableAdapter.Update(fixedDataSet._fixed); fixedDataSet._fixed.AcceptChanges(); fixedTableAdapter.Fill(fixedDataSet._fixed); Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter fixed_delTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter(); fixedDataSet.fixedname.AcceptChanges(); fixed_delTableAdapter.Fill(fixedDataSet.fixed_del); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // 不要在设计时加载数据。 // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) // { // //在此处加载数据并将结果指派给 CollectionViewSource。 // System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"]; // myCollectionViewSource.Source = your data // } Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet"))); // 将数据加载到表 nature 中。可以根据需要修改此代码。 Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter fixed_delTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter(); fixed_delTableAdapter.Fill(fixedDataSet.fixed_del); fixed_delDataGrid.CanUserAddRows = false; del_select.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 100, 10, 0, 0); textBox1.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 230, 10, 0, 0); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // 不要在设计时加载数据。 // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) // { // //在此处加载数据并将结果指派给 CollectionViewSource。 // System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"]; // myCollectionViewSource.Source = your data // } Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet"))); // 将数据加载到表 nature 中。可以根据需要修改此代码。 Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter fixed_delTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_delTableAdapter(); fixed_delTableAdapter.Fill(fixedDataSet.fixed_del); fixed_delDataGrid.CanUserAddRows = false; del_select.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 100, 10, 0, 0); textBox1.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 230, 10, 0, 0); }