//   public static T FindChild<T>(DependencyObject parent, string childName)//查找控件
     //where T : DependencyObject
     //   {
     //       if (parent == null) return null;
     //       T foundChild = null;
     //       int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
     //       for (int i = 0; i < childrenCount; i++)
     //       {
     //           var child = VisualTreeHelper.GetChild(parent, i);
     //           // 如果子控件不是需查找的控件类型 
     //           T childType = child as T;
     //           if (childType == null)
     //           {
     //               // 在下一级控件中递归查找 
     //               foundChild = FindChild<T>(child, childName);
     //               // 找到控件就可以中断递归操作  
     //               if (foundChild != null) break;
     //           }
     //           else if (!string.IsNullOrEmpty(childName))
     //           {
     //               var frameworkElement = child as FrameworkElement;
     //               // 如果控件名称符合参数条件 
     //               if (frameworkElement != null && frameworkElement.Name == childName)
     //               {
     //                   foundChild = (T)child;
     //                   break;
     //               }
     //           }
     //           else
     //           {
     //               // 查找到了控件 
     //               foundChild = (T)child;
     //               break;
     //           }
     //       }
     //       return foundChild;
     //   }

       

        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")));


            Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedDataSetfixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter();
            fixedDataSetfixedTableAdapter.Fill(fixedDataSet._fixed);
            System.Windows.Data.CollectionViewSource fixedViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixedViewSource")));
            fixedViewSource.View.MoveCurrentToFirst();


            // 将数据加载到表 nature 中。可以根据需要修改此代码。
            Fixed_management.FixedDataSetTableAdapters.natureTableAdapter fixedDataSetnatureTableAdapter = new Fixed_management.FixedDataSetTableAdapters.natureTableAdapter();
            fixedDataSetnatureTableAdapter.Fill(fixedDataSet.nature);
            System.Windows.Data.CollectionViewSource natureViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("natureViewSource")));
            natureViewSource.View.MoveCurrentToFirst();



            Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter fixedDataSetcategoryTableAdapter = new Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter();
            fixedDataSetcategoryTableAdapter.Fill(fixedDataSet.category);
            System.Windows.Data.CollectionViewSource categoryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("categoryViewSource")));
            categoryViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.designationTableAdapter fixedDataSetdesignationTableAdapter = new Fixed_management.FixedDataSetTableAdapters.designationTableAdapter();
            fixedDataSetdesignationTableAdapter.Fill(fixedDataSet.designation);
            System.Windows.Data.CollectionViewSource designationViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("designationViewSource")));
            designationViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter fixedDataSetspecificationsTableAdapter = new Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter();
            fixedDataSetspecificationsTableAdapter.Fill(fixedDataSet.specifications);
            System.Windows.Data.CollectionViewSource specificationsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("specificationsViewSource")));
            specificationsViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.modelTableAdapter fixedDataSetmodelTableAdapter = new Fixed_management.FixedDataSetTableAdapters.modelTableAdapter();
            fixedDataSetmodelTableAdapter.Fill(fixedDataSet.model);
            System.Windows.Data.CollectionViewSource modelViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("modelViewSource")));
            modelViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.unitTableAdapter fixedDataSetunitTableAdapter = new Fixed_management.FixedDataSetTableAdapters.unitTableAdapter();
            fixedDataSetunitTableAdapter.Fill(fixedDataSet.unit);
            System.Windows.Data.CollectionViewSource unitViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("unitViewSource")));
            unitViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter fixedDataSetkeeperTableAdapter = new Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter();
            fixedDataSetkeeperTableAdapter.Fill(fixedDataSet.keeper);
            System.Windows.Data.CollectionViewSource keeperViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("keeperViewSource")));
            keeperViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter fixedDataSetsupplierTableAdapter = new Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter();
            fixedDataSetsupplierTableAdapter.Fill(fixedDataSet.supplier);
            System.Windows.Data.CollectionViewSource supplierViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("supplierViewSource")));
            supplierViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.positionTableAdapter fixedDataSetpositionTableAdapter = new Fixed_management.FixedDataSetTableAdapters.positionTableAdapter();
            fixedDataSetpositionTableAdapter.Fill(fixedDataSet.position);
            System.Windows.Data.CollectionViewSource positionViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("positionViewSource")));
            positionViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter fixedDataSetfixed_statusTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter();
            fixedDataSetfixed_statusTableAdapter.Fill(fixedDataSet.fixed_status);
            System.Windows.Data.CollectionViewSource fixed_statusViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixed_statusViewSource")));
            fixed_statusViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter fixedDataSetstorage_placeTableAdapter = new Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter();
            fixedDataSetstorage_placeTableAdapter.Fill(fixedDataSet.storage_place);
            System.Windows.Data.CollectionViewSource storage_placeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("storage_placeViewSource")));
            storage_placeViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter fixedDataSetpurchase_wayTableAdapter = new Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter();
            fixedDataSetpurchase_wayTableAdapter.Fill(fixedDataSet.purchase_way);
            System.Windows.Data.CollectionViewSource purchase_wayViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("purchase_wayViewSource")));
            purchase_wayViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter fixedDataSetaffiliatedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter();
            fixedDataSetaffiliatedTableAdapter.Fill(fixedDataSet.affiliated);
            System.Windows.Data.CollectionViewSource affiliatedViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("affiliatedViewSource")));
            affiliatedViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter fixedDataSetdepartmentTableAdapter = new Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter();
            fixedDataSetdepartmentTableAdapter.Fill(fixedDataSet.department);
            System.Windows.Data.CollectionViewSource departmentViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("departmentViewSource")));
            departmentViewSource.View.MoveCurrentToLast();


            Fixed_management.FixedDataSetTableAdapters.userTableAdapter fixedDataSetuserTableAdapter = new Fixed_management.FixedDataSetTableAdapters.userTableAdapter();
            fixedDataSetuserTableAdapter.Fill(fixedDataSet.user);
            System.Windows.Data.CollectionViewSource userViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("userViewSource")));
            userViewSource.View.MoveCurrentToLast();
        }
        //   public static T FindChild<T>(DependencyObject parent, string childName)//查找控件
        //where T : DependencyObject
        //   {
        //       if (parent == null) return null;
        //       T foundChild = null;
        //       int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
        //       for (int i = 0; i < childrenCount; i++)
        //       {
        //           var child = VisualTreeHelper.GetChild(parent, i);
        //           // 如果子控件不是需查找的控件类型
        //           T childType = child as T;
        //           if (childType == null)
        //           {
        //               // 在下一级控件中递归查找
        //               foundChild = FindChild<T>(child, childName);
        //               // 找到控件就可以中断递归操作
        //               if (foundChild != null) break;
        //           }
        //           else if (!string.IsNullOrEmpty(childName))
        //           {
        //               var frameworkElement = child as FrameworkElement;
        //               // 如果控件名称符合参数条件
        //               if (frameworkElement != null && frameworkElement.Name == childName)
        //               {
        //                   foundChild = (T)child;
        //                   break;
        //               }
        //           }
        //           else
        //           {
        //               // 查找到了控件
        //               foundChild = (T)child;
        //               break;
        //           }
        //       }
        //       return foundChild;
        //   }



        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")));


            Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedDataSetfixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter();
            fixedDataSetfixedTableAdapter.Fill(fixedDataSet._fixed);
            System.Windows.Data.CollectionViewSource fixedViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixedViewSource")));
            fixedViewSource.View.MoveCurrentToFirst();


            // 将数据加载到表 nature 中。可以根据需要修改此代码。
            Fixed_management.FixedDataSetTableAdapters.natureTableAdapter fixedDataSetnatureTableAdapter = new Fixed_management.FixedDataSetTableAdapters.natureTableAdapter();
            fixedDataSetnatureTableAdapter.Fill(fixedDataSet.nature);
            System.Windows.Data.CollectionViewSource natureViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("natureViewSource")));
            natureViewSource.View.MoveCurrentToFirst();



            Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter fixedDataSetcategoryTableAdapter = new Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter();
            fixedDataSetcategoryTableAdapter.Fill(fixedDataSet.category);
            System.Windows.Data.CollectionViewSource categoryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("categoryViewSource")));
            categoryViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.designationTableAdapter fixedDataSetdesignationTableAdapter = new Fixed_management.FixedDataSetTableAdapters.designationTableAdapter();
            fixedDataSetdesignationTableAdapter.Fill(fixedDataSet.designation);
            System.Windows.Data.CollectionViewSource designationViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("designationViewSource")));
            designationViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter fixedDataSetspecificationsTableAdapter = new Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter();
            fixedDataSetspecificationsTableAdapter.Fill(fixedDataSet.specifications);
            System.Windows.Data.CollectionViewSource specificationsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("specificationsViewSource")));
            specificationsViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.modelTableAdapter fixedDataSetmodelTableAdapter = new Fixed_management.FixedDataSetTableAdapters.modelTableAdapter();
            fixedDataSetmodelTableAdapter.Fill(fixedDataSet.model);
            System.Windows.Data.CollectionViewSource modelViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("modelViewSource")));
            modelViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.unitTableAdapter fixedDataSetunitTableAdapter = new Fixed_management.FixedDataSetTableAdapters.unitTableAdapter();
            fixedDataSetunitTableAdapter.Fill(fixedDataSet.unit);
            System.Windows.Data.CollectionViewSource unitViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("unitViewSource")));
            unitViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter fixedDataSetkeeperTableAdapter = new Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter();
            fixedDataSetkeeperTableAdapter.Fill(fixedDataSet.keeper);
            System.Windows.Data.CollectionViewSource keeperViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("keeperViewSource")));
            keeperViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter fixedDataSetsupplierTableAdapter = new Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter();
            fixedDataSetsupplierTableAdapter.Fill(fixedDataSet.supplier);
            System.Windows.Data.CollectionViewSource supplierViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("supplierViewSource")));
            supplierViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.positionTableAdapter fixedDataSetpositionTableAdapter = new Fixed_management.FixedDataSetTableAdapters.positionTableAdapter();
            fixedDataSetpositionTableAdapter.Fill(fixedDataSet.position);
            System.Windows.Data.CollectionViewSource positionViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("positionViewSource")));
            positionViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter fixedDataSetfixed_statusTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter();
            fixedDataSetfixed_statusTableAdapter.Fill(fixedDataSet.fixed_status);
            System.Windows.Data.CollectionViewSource fixed_statusViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixed_statusViewSource")));
            fixed_statusViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter fixedDataSetstorage_placeTableAdapter = new Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter();
            fixedDataSetstorage_placeTableAdapter.Fill(fixedDataSet.storage_place);
            System.Windows.Data.CollectionViewSource storage_placeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("storage_placeViewSource")));
            storage_placeViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter fixedDataSetpurchase_wayTableAdapter = new Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter();
            fixedDataSetpurchase_wayTableAdapter.Fill(fixedDataSet.purchase_way);
            System.Windows.Data.CollectionViewSource purchase_wayViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("purchase_wayViewSource")));
            purchase_wayViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter fixedDataSetaffiliatedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter();
            fixedDataSetaffiliatedTableAdapter.Fill(fixedDataSet.affiliated);
            System.Windows.Data.CollectionViewSource affiliatedViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("affiliatedViewSource")));
            affiliatedViewSource.View.MoveCurrentToLast();

            Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter fixedDataSetdepartmentTableAdapter = new Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter();
            fixedDataSetdepartmentTableAdapter.Fill(fixedDataSet.department);
            System.Windows.Data.CollectionViewSource departmentViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("departmentViewSource")));
            departmentViewSource.View.MoveCurrentToLast();


            Fixed_management.FixedDataSetTableAdapters.userTableAdapter fixedDataSetuserTableAdapter = new Fixed_management.FixedDataSetTableAdapters.userTableAdapter();
            fixedDataSetuserTableAdapter.Fill(fixedDataSet.user);
            System.Windows.Data.CollectionViewSource userViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("userViewSource")));
            userViewSource.View.MoveCurrentToLast();
        }
        private void checkmultitable()
        {
            Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet")));
            // 将数据加载到表 nature 中。可以根据需要修改此代码。
            Fixed_management.FixedDataSetTableAdapters.natureTableAdapter fixedDataSetnatureTableAdapter = new Fixed_management.FixedDataSetTableAdapters.natureTableAdapter();
            System.Windows.Data.CollectionViewSource natureViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("natureViewSource")));

            Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter fixedDataSetcategoryTableAdapter = new Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter();
            System.Windows.Data.CollectionViewSource categoryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("categoryViewSource")));

            Fixed_management.FixedDataSetTableAdapters.designationTableAdapter fixedDataSetdesignationTableAdapter = new Fixed_management.FixedDataSetTableAdapters.designationTableAdapter();
            System.Windows.Data.CollectionViewSource designationViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("designationViewSource")));

            Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter fixedDataSetspecificationsTableAdapter = new Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter();
            System.Windows.Data.CollectionViewSource specificationsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("specificationsViewSource")));

            Fixed_management.FixedDataSetTableAdapters.modelTableAdapter fixedDataSetmodelTableAdapter = new Fixed_management.FixedDataSetTableAdapters.modelTableAdapter();
            System.Windows.Data.CollectionViewSource modelViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("modelViewSource")));

            Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter fixedDataSetpurchase_wayTableAdapter = new Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter();
            System.Windows.Data.CollectionViewSource purchase_wayViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("purchase_wayViewSource")));

            Fixed_management.FixedDataSetTableAdapters.unitTableAdapter fixedDataSetunitTableAdapter = new Fixed_management.FixedDataSetTableAdapters.unitTableAdapter();
            System.Windows.Data.CollectionViewSource unitViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("unitViewSource")));

            Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter fixedDataSetkeeperTableAdapter = new Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter();
            System.Windows.Data.CollectionViewSource keeperViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("keeperViewSource")));

            Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter fixedDataSetsupplierTableAdapter = new Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter();
            System.Windows.Data.CollectionViewSource supplierViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("supplierViewSource")));

            Fixed_management.FixedDataSetTableAdapters.positionTableAdapter fixedDataSetpositionTableAdapter = new Fixed_management.FixedDataSetTableAdapters.positionTableAdapter();
            System.Windows.Data.CollectionViewSource positionViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("positionViewSource")));

            Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter fixedDataSetfixed_statusTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter();
            System.Windows.Data.CollectionViewSource fixed_statusViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixed_statusViewSource")));

            Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter fixedDataSetstorage_placeTableAdapter = new Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter();
            System.Windows.Data.CollectionViewSource storage_placeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("storage_placeViewSource")));

            Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter fixedDataSetaffiliatedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter();
            System.Windows.Data.CollectionViewSource affiliatedViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("affiliatedViewSource")));

            Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter fixedDataSetdepartmentTableAdapter = new Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter();
            System.Windows.Data.CollectionViewSource departmentViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("departmentViewSource")));

            Fixed_management.FixedDataSetTableAdapters.userTableAdapter fixedDataSetuserTableAdapter = new Fixed_management.FixedDataSetTableAdapters.userTableAdapter();
            System.Windows.Data.CollectionViewSource userViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("userViewSource")));

            var nature = (from c in fixedDataSet.nature where c.nature == natureC1ComboBox.Text select c).Count();
            var category = (from c in fixedDataSet.category where c.category == categoryC1ComboBox.Text select c).Count();
            var designation = (from c in fixedDataSet.designation where c.designation == designationC1ComboBox.Text select c).Count();
            var specifications = (from c in fixedDataSet.specifications where c.specifications == specifications_IDC1ComboBox.Text select c).Count();
            var model = (from c in fixedDataSet.model where c.model == model_IDC1ComboBox.Text select c).Count();
            var purchase_way = (from c in fixedDataSet.purchase_way where c.purchase_way == purchase_way_IDC1ComboBox.Text select c).Count();
            var unit = (from c in fixedDataSet.unit where c.unit == unit_IDC1ComboBox.Text select c).Count();
            var keeper = (from c in fixedDataSet.keeper where c.keeper == keeper_IDC1ComboBox.Text select c).Count();
            var supplier = (from c in fixedDataSet.supplier where c.supplier == supplier_IDC1ComboBox.Text select c).Count();
            var position = (from c in fixedDataSet.position where c.position == position_IDC1ComboBox.Text select c).Count();
            var fixed_status = (from c in fixedDataSet.fixed_status where c.fixed_status == fixed_status_IDC1ComboBox.Text select c).Count();
            var storage_place = (from c in fixedDataSet.storage_place where c.storage_place == storage_place_IDC1ComboBox.Text select c).Count();
            var affiliated = (from c in fixedDataSet.affiliated where c.affiliated == affiliated_IDC1ComboBox.Text select c).Count();
            var department = (from c in fixedDataSet.department where c.department == department_IDC1ComboBox.Text select c).Count();
            var user = (from c in fixedDataSet.user where c.user == user_IDC1ComboBox.Text select c).Count();
            if (nature == 0)
            {
                fixedDataSet.nature.AddnatureRow(natureC1ComboBox.Text);
                fixedDataSetnatureTableAdapter.Update(fixedDataSet.nature);
                fixedDataSetnatureTableAdapter.Fill(fixedDataSet.nature);
                natureViewSource.View.MoveCurrentToLast();
                
            }
            
            if (category == 0)
            {
                fixedDataSet.category.AddcategoryRow(categoryC1ComboBox.Text);
                fixedDataSetcategoryTableAdapter.Update(fixedDataSet.category);
                fixedDataSetcategoryTableAdapter.Fill(fixedDataSet.category);
                categoryViewSource.View.MoveCurrentToLast();
            }
            if (designation == 0)
            {
                fixedDataSet.designation.AdddesignationRow(designationC1ComboBox.Text);
                fixedDataSetdesignationTableAdapter.Update(fixedDataSet.designation);
                fixedDataSetdesignationTableAdapter.Fill(fixedDataSet.designation);
                designationViewSource.View.MoveCurrentToLast();
            }
            if (specifications == 0)
            {
                fixedDataSet.specifications.AddspecificationsRow(specifications_IDC1ComboBox.Text);
                fixedDataSetspecificationsTableAdapter.Update(fixedDataSet.specifications);
                fixedDataSetspecificationsTableAdapter.Fill(fixedDataSet.specifications);
                specificationsViewSource.View.MoveCurrentToLast();
            }
            if (model == 0)
            {
                fixedDataSet.model.AddmodelRow(model_IDC1ComboBox.Text);
                fixedDataSetmodelTableAdapter.Update(fixedDataSet.model);
                fixedDataSetmodelTableAdapter.Fill(fixedDataSet.model);
                modelViewSource.View.MoveCurrentToLast();
            }
            if (purchase_way == 0)
            {
                fixedDataSet.purchase_way.Addpurchase_wayRow(purchase_way_IDC1ComboBox.Text);
                fixedDataSetpurchase_wayTableAdapter.Update(fixedDataSet.purchase_way);
                fixedDataSetpurchase_wayTableAdapter.Fill(fixedDataSet.purchase_way);
                purchase_wayViewSource.View.MoveCurrentToLast();
            }
            if (unit == 0)
            {
                fixedDataSet.unit.AddunitRow(unit_IDC1ComboBox.Text);
                fixedDataSetunitTableAdapter.Update(fixedDataSet.unit);
                fixedDataSetunitTableAdapter.Fill(fixedDataSet.unit);
                unitViewSource.View.MoveCurrentToLast();
            }
            if (keeper == 0)
            {
                fixedDataSet.keeper.AddkeeperRow(keeper_IDC1ComboBox.Text);
                fixedDataSetkeeperTableAdapter.Update(fixedDataSet.keeper);
                fixedDataSetkeeperTableAdapter.Fill(fixedDataSet.keeper);
                keeperViewSource.View.MoveCurrentToLast();
            }
            if (supplier == 0)
            {
                fixedDataSet.supplier.AddsupplierRow(supplier_IDC1ComboBox.Text);
                fixedDataSetsupplierTableAdapter.Update(fixedDataSet.supplier);
                fixedDataSetsupplierTableAdapter.Fill(fixedDataSet.supplier);
                supplierViewSource.View.MoveCurrentToLast();
            }
            if (position == 0)
            {
                fixedDataSet.position.AddpositionRow(position_IDC1ComboBox.Text);
                fixedDataSetpositionTableAdapter.Update(fixedDataSet.position);
                fixedDataSetpositionTableAdapter.Fill(fixedDataSet.position);
                positionViewSource.View.MoveCurrentToLast();
            }
            if (fixed_status == 0)
            {
                fixedDataSet.fixed_status.Addfixed_statusRow(fixed_status_IDC1ComboBox.Text);
                fixedDataSetfixed_statusTableAdapter.Update(fixedDataSet.fixed_status);
                fixedDataSetfixed_statusTableAdapter.Fill(fixedDataSet.fixed_status);
                fixed_statusViewSource.View.MoveCurrentToLast();
            }
            if (storage_place == 0)
            {
                fixedDataSet.storage_place.Addstorage_placeRow(storage_place_IDC1ComboBox.Text);
                fixedDataSetstorage_placeTableAdapter.Update(fixedDataSet.storage_place);
                fixedDataSetstorage_placeTableAdapter.Fill(fixedDataSet.storage_place);
                storage_placeViewSource.View.MoveCurrentToLast();
            }
            if (affiliated == 0)
            {
                fixedDataSet.affiliated.AddaffiliatedRow(1,affiliated_IDC1ComboBox.Text);
                fixedDataSetaffiliatedTableAdapter.Update(fixedDataSet.affiliated);
                fixedDataSetaffiliatedTableAdapter.Fill(fixedDataSet.affiliated);
                affiliatedViewSource.View.MoveCurrentToLast();
            }
            if (department == 0)
            {
                fixedDataSet.department.AdddepartmentRow(1,department_IDC1ComboBox.Text);
                fixedDataSetdepartmentTableAdapter.Update(fixedDataSet.department);
                fixedDataSetdepartmentTableAdapter.Fill(fixedDataSet.department);
                departmentViewSource.View.MoveCurrentToLast();
            }

            if (user == 0)
            {
                fixedDataSet.user.AdduserRow(user_IDC1ComboBox.Text);
                fixedDataSetuserTableAdapter.Update(fixedDataSet.user);
                fixedDataSetuserTableAdapter.Fill(fixedDataSet.user);
                userViewSource.View.MoveCurrentToLast();
            }

        }
        private void checkmultitable()
        {
            Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet")));
            // 将数据加载到表 nature 中。可以根据需要修改此代码。
            Fixed_management.FixedDataSetTableAdapters.natureTableAdapter fixedDataSetnatureTableAdapter = new Fixed_management.FixedDataSetTableAdapters.natureTableAdapter();
            System.Windows.Data.CollectionViewSource natureViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("natureViewSource")));

            Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter fixedDataSetcategoryTableAdapter = new Fixed_management.FixedDataSetTableAdapters.categoryTableAdapter();
            System.Windows.Data.CollectionViewSource categoryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("categoryViewSource")));

            Fixed_management.FixedDataSetTableAdapters.designationTableAdapter fixedDataSetdesignationTableAdapter = new Fixed_management.FixedDataSetTableAdapters.designationTableAdapter();
            System.Windows.Data.CollectionViewSource designationViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("designationViewSource")));

            Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter fixedDataSetspecificationsTableAdapter = new Fixed_management.FixedDataSetTableAdapters.specificationsTableAdapter();
            System.Windows.Data.CollectionViewSource specificationsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("specificationsViewSource")));

            Fixed_management.FixedDataSetTableAdapters.modelTableAdapter fixedDataSetmodelTableAdapter = new Fixed_management.FixedDataSetTableAdapters.modelTableAdapter();
            System.Windows.Data.CollectionViewSource modelViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("modelViewSource")));

            Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter fixedDataSetpurchase_wayTableAdapter = new Fixed_management.FixedDataSetTableAdapters.purchase_wayTableAdapter();
            System.Windows.Data.CollectionViewSource purchase_wayViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("purchase_wayViewSource")));

            Fixed_management.FixedDataSetTableAdapters.unitTableAdapter fixedDataSetunitTableAdapter = new Fixed_management.FixedDataSetTableAdapters.unitTableAdapter();
            System.Windows.Data.CollectionViewSource unitViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("unitViewSource")));

            Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter fixedDataSetkeeperTableAdapter = new Fixed_management.FixedDataSetTableAdapters.keeperTableAdapter();
            System.Windows.Data.CollectionViewSource keeperViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("keeperViewSource")));

            Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter fixedDataSetsupplierTableAdapter = new Fixed_management.FixedDataSetTableAdapters.supplierTableAdapter();
            System.Windows.Data.CollectionViewSource supplierViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("supplierViewSource")));

            Fixed_management.FixedDataSetTableAdapters.positionTableAdapter fixedDataSetpositionTableAdapter = new Fixed_management.FixedDataSetTableAdapters.positionTableAdapter();
            System.Windows.Data.CollectionViewSource positionViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("positionViewSource")));

            Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter fixedDataSetfixed_statusTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixed_statusTableAdapter();
            System.Windows.Data.CollectionViewSource fixed_statusViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixed_statusViewSource")));

            Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter fixedDataSetstorage_placeTableAdapter = new Fixed_management.FixedDataSetTableAdapters.storage_placeTableAdapter();
            System.Windows.Data.CollectionViewSource storage_placeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("storage_placeViewSource")));

            Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter fixedDataSetaffiliatedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.affiliatedTableAdapter();
            System.Windows.Data.CollectionViewSource affiliatedViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("affiliatedViewSource")));

            Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter fixedDataSetdepartmentTableAdapter = new Fixed_management.FixedDataSetTableAdapters.departmentTableAdapter();
            System.Windows.Data.CollectionViewSource departmentViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("departmentViewSource")));

            Fixed_management.FixedDataSetTableAdapters.userTableAdapter fixedDataSetuserTableAdapter = new Fixed_management.FixedDataSetTableAdapters.userTableAdapter();
            System.Windows.Data.CollectionViewSource userViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("userViewSource")));

            var nature         = (from c in fixedDataSet.nature where c.nature == natureC1ComboBox.Text select c).Count();
            var category       = (from c in fixedDataSet.category where c.category == categoryC1ComboBox.Text select c).Count();
            var designation    = (from c in fixedDataSet.designation where c.designation == designationC1ComboBox.Text select c).Count();
            var specifications = (from c in fixedDataSet.specifications where c.specifications == specifications_IDC1ComboBox.Text select c).Count();
            var model          = (from c in fixedDataSet.model where c.model == model_IDC1ComboBox.Text select c).Count();
            var purchase_way   = (from c in fixedDataSet.purchase_way where c.purchase_way == purchase_way_IDC1ComboBox.Text select c).Count();
            var unit           = (from c in fixedDataSet.unit where c.unit == unit_IDC1ComboBox.Text select c).Count();
            var keeper         = (from c in fixedDataSet.keeper where c.keeper == keeper_IDC1ComboBox.Text select c).Count();
            var supplier       = (from c in fixedDataSet.supplier where c.supplier == supplier_IDC1ComboBox.Text select c).Count();
            var position       = (from c in fixedDataSet.position where c.position == position_IDC1ComboBox.Text select c).Count();
            var fixed_status   = (from c in fixedDataSet.fixed_status where c.fixed_status == fixed_status_IDC1ComboBox.Text select c).Count();
            var storage_place  = (from c in fixedDataSet.storage_place where c.storage_place == storage_place_IDC1ComboBox.Text select c).Count();
            var affiliated     = (from c in fixedDataSet.affiliated where c.affiliated == affiliated_IDC1ComboBox.Text select c).Count();
            var department     = (from c in fixedDataSet.department where c.department == department_IDC1ComboBox.Text select c).Count();
            var user           = (from c in fixedDataSet.user where c.user == user_IDC1ComboBox.Text select c).Count();

            if (nature == 0)
            {
                fixedDataSet.nature.AddnatureRow(natureC1ComboBox.Text);
                fixedDataSetnatureTableAdapter.Update(fixedDataSet.nature);
                fixedDataSetnatureTableAdapter.Fill(fixedDataSet.nature);
                natureViewSource.View.MoveCurrentToLast();
            }

            if (category == 0)
            {
                fixedDataSet.category.AddcategoryRow(categoryC1ComboBox.Text);
                fixedDataSetcategoryTableAdapter.Update(fixedDataSet.category);
                fixedDataSetcategoryTableAdapter.Fill(fixedDataSet.category);
                categoryViewSource.View.MoveCurrentToLast();
            }
            if (designation == 0)
            {
                fixedDataSet.designation.AdddesignationRow(designationC1ComboBox.Text);
                fixedDataSetdesignationTableAdapter.Update(fixedDataSet.designation);
                fixedDataSetdesignationTableAdapter.Fill(fixedDataSet.designation);
                designationViewSource.View.MoveCurrentToLast();
            }
            if (specifications == 0)
            {
                fixedDataSet.specifications.AddspecificationsRow(specifications_IDC1ComboBox.Text);
                fixedDataSetspecificationsTableAdapter.Update(fixedDataSet.specifications);
                fixedDataSetspecificationsTableAdapter.Fill(fixedDataSet.specifications);
                specificationsViewSource.View.MoveCurrentToLast();
            }
            if (model == 0)
            {
                fixedDataSet.model.AddmodelRow(model_IDC1ComboBox.Text);
                fixedDataSetmodelTableAdapter.Update(fixedDataSet.model);
                fixedDataSetmodelTableAdapter.Fill(fixedDataSet.model);
                modelViewSource.View.MoveCurrentToLast();
            }
            if (purchase_way == 0)
            {
                fixedDataSet.purchase_way.Addpurchase_wayRow(purchase_way_IDC1ComboBox.Text);
                fixedDataSetpurchase_wayTableAdapter.Update(fixedDataSet.purchase_way);
                fixedDataSetpurchase_wayTableAdapter.Fill(fixedDataSet.purchase_way);
                purchase_wayViewSource.View.MoveCurrentToLast();
            }
            if (unit == 0)
            {
                fixedDataSet.unit.AddunitRow(unit_IDC1ComboBox.Text);
                fixedDataSetunitTableAdapter.Update(fixedDataSet.unit);
                fixedDataSetunitTableAdapter.Fill(fixedDataSet.unit);
                unitViewSource.View.MoveCurrentToLast();
            }
            if (keeper == 0)
            {
                fixedDataSet.keeper.AddkeeperRow(keeper_IDC1ComboBox.Text);
                fixedDataSetkeeperTableAdapter.Update(fixedDataSet.keeper);
                fixedDataSetkeeperTableAdapter.Fill(fixedDataSet.keeper);
                keeperViewSource.View.MoveCurrentToLast();
            }
            if (supplier == 0)
            {
                fixedDataSet.supplier.AddsupplierRow(supplier_IDC1ComboBox.Text);
                fixedDataSetsupplierTableAdapter.Update(fixedDataSet.supplier);
                fixedDataSetsupplierTableAdapter.Fill(fixedDataSet.supplier);
                supplierViewSource.View.MoveCurrentToLast();
            }
            if (position == 0)
            {
                fixedDataSet.position.AddpositionRow(position_IDC1ComboBox.Text);
                fixedDataSetpositionTableAdapter.Update(fixedDataSet.position);
                fixedDataSetpositionTableAdapter.Fill(fixedDataSet.position);
                positionViewSource.View.MoveCurrentToLast();
            }
            if (fixed_status == 0)
            {
                fixedDataSet.fixed_status.Addfixed_statusRow(fixed_status_IDC1ComboBox.Text);
                fixedDataSetfixed_statusTableAdapter.Update(fixedDataSet.fixed_status);
                fixedDataSetfixed_statusTableAdapter.Fill(fixedDataSet.fixed_status);
                fixed_statusViewSource.View.MoveCurrentToLast();
            }
            if (storage_place == 0)
            {
                fixedDataSet.storage_place.Addstorage_placeRow(storage_place_IDC1ComboBox.Text);
                fixedDataSetstorage_placeTableAdapter.Update(fixedDataSet.storage_place);
                fixedDataSetstorage_placeTableAdapter.Fill(fixedDataSet.storage_place);
                storage_placeViewSource.View.MoveCurrentToLast();
            }
            if (affiliated == 0)
            {
                fixedDataSet.affiliated.AddaffiliatedRow(1, affiliated_IDC1ComboBox.Text);
                fixedDataSetaffiliatedTableAdapter.Update(fixedDataSet.affiliated);
                fixedDataSetaffiliatedTableAdapter.Fill(fixedDataSet.affiliated);
                affiliatedViewSource.View.MoveCurrentToLast();
            }
            if (department == 0)
            {
                fixedDataSet.department.AdddepartmentRow(1, department_IDC1ComboBox.Text);
                fixedDataSetdepartmentTableAdapter.Update(fixedDataSet.department);
                fixedDataSetdepartmentTableAdapter.Fill(fixedDataSet.department);
                departmentViewSource.View.MoveCurrentToLast();
            }

            if (user == 0)
            {
                fixedDataSet.user.AdduserRow(user_IDC1ComboBox.Text);
                fixedDataSetuserTableAdapter.Update(fixedDataSet.user);
                fixedDataSetuserTableAdapter.Fill(fixedDataSet.user);
                userViewSource.View.MoveCurrentToLast();
            }
        }