Пример #1
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.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);
            System.Windows.Data.CollectionViewSource fixednameViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixednameViewSource")));
            fixednameViewSource.View.MoveCurrentToFirst();

            Fixed_management.FixedDataSetTableAdapters.exit_wayTableAdapter fixedDataSetexit_wayTableAdapter = new Fixed_management.FixedDataSetTableAdapters.exit_wayTableAdapter();
            fixedDataSetexit_wayTableAdapter.Fill(fixedDataSet.exit_way);
            System.Windows.Data.CollectionViewSource exit_wayViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("exit_wayViewSource")));
            exit_wayViewSource.View.MoveCurrentToFirst();

            Fixed_management.FixedDataSetTableAdapters.operatorTableAdapter fixedDataSetoperatorableAdapter = new Fixed_management.FixedDataSetTableAdapters.operatorTableAdapter();
            fixedDataSetoperatorableAdapter.Fill(fixedDataSet._operator);
            System.Windows.Data.CollectionViewSource operatorViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("operatorViewSource")));
            operatorViewSource.View.MoveCurrentToFirst();


            fixednameDataGrid.CanUserAddRows = false;
            exit_dateDatePicker.SelectedDate = DateTime.Now;

            exit_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.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);
            System.Windows.Data.CollectionViewSource fixednameViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixednameViewSource")));
            fixednameViewSource.View.MoveCurrentToFirst();

            Fixed_management.FixedDataSetTableAdapters.exit_wayTableAdapter fixedDataSetexit_wayTableAdapter = new Fixed_management.FixedDataSetTableAdapters.exit_wayTableAdapter();
            fixedDataSetexit_wayTableAdapter.Fill(fixedDataSet.exit_way);
            System.Windows.Data.CollectionViewSource exit_wayViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("exit_wayViewSource")));
            exit_wayViewSource.View.MoveCurrentToFirst();

            Fixed_management.FixedDataSetTableAdapters.operatorTableAdapter fixedDataSetoperatorableAdapter = new Fixed_management.FixedDataSetTableAdapters.operatorTableAdapter();
            fixedDataSetoperatorableAdapter.Fill(fixedDataSet._operator);
            System.Windows.Data.CollectionViewSource operatorViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("operatorViewSource")));
            operatorViewSource.View.MoveCurrentToFirst();


            fixednameDataGrid.CanUserAddRows = false;
            exit_dateDatePicker.SelectedDate = DateTime.Now;

            exit_select.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 100, 10, 0, 0);
            textBox1.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 230, 10, 0, 0);
        }
Пример #3
0
        private void fix_outtool_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);

            if (checknull())
            {
                checkmultitable();


                for (int i = 0; i < fixednameDataGrid.Items.Count; i++)
                {
                    DataGridTemplateColumn templeColumn = fixednameDataGrid.Columns[0] as DataGridTemplateColumn;
                    FrameworkElement       s            = fixednameDataGrid.Columns[0].GetCellContent(fixednameDataGrid.Items[i]);
                    CheckBox    tbOper            = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox;
                    DataRowView mySelectedElement = (DataRowView)fixednameDataGrid.Items[i];
                    int         fixedname_id      = int.Parse(mySelectedElement.Row[32].ToString());
                    if ((bool)tbOper.IsChecked)
                    {
                        var Voperator = from c in fixedDataSet._operator where c._operator == operator_IDC1ComboBox.Text select c;

                        int Ioperator = 0;
                        foreach (var a in Voperator)
                        {
                            Ioperator = a.operator_ID;
                            break;
                        }

                        var Vexit_way = from c in fixedDataSet.exit_way where c.way == exit_way_IDC1ComboBox.Text select c;
                        int Iexit_way = 0;
                        foreach (var a in Vexit_way)
                        {
                            Iexit_way = a.exit_way_ID;
                            break;
                        }

                        var select_count = from c in fixedDataSet._fixed where c.fixed_ID == fixedname_id select c;
                        foreach (var enable in select_count)
                        {
                            enable.enable_status = "2";
                            enable.exit_date     = DateTime.Parse(exit_dateDatePicker.Text);
                            enable.operator_ID   = Ioperator;
                            enable.exit_way_ID   = Iexit_way;
                        }
                    }
                }
                fixedTableAdapter.Update(fixedDataSet._fixed);
                fixedDataSet._fixed.AcceptChanges();
                fixedTableAdapter.Fill(fixedDataSet._fixed);
            }
            Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixedDataSet.fixedname.AcceptChanges();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            fixednameDataGrid.CanUserAddRows = false;


            // 不要在设计时加载数据。
            // 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.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);
            System.Windows.Data.CollectionViewSource fixednameViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixednameViewSource")));
            fixednameViewSource.View.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

           transfer_dateDatePicker.SelectedDate = DateTime.Now;
           transfer_select.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 100, 70, 0, 0);
           textBox1.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 230, 70, 0, 0);
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            fixednameDataGrid.CanUserAddRows = false;


            // 不要在设计时加载数据。
            // 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.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);
            System.Windows.Data.CollectionViewSource fixednameViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("fixednameViewSource")));
            fixednameViewSource.View.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            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.MoveCurrentToFirst();

            transfer_dateDatePicker.SelectedDate = DateTime.Now;
            transfer_select.Margin = new Thickness(SystemParameters.PrimaryScreenWidth - 100, 70, 0, 0);
            textBox1.Margin        = new Thickness(SystemParameters.PrimaryScreenWidth - 230, 70, 0, 0);
        }
        private void reductive_transfer_Click(object sender, RoutedEventArgs e)
        {
            Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet")));
            Fixed_management.FixedDataSetTableAdapters.transfer_detailTableAdapter transfer_detailTableAdapter = new Fixed_management.FixedDataSetTableAdapters.transfer_detailTableAdapter();

            Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter();
            fixedTableAdapter.Fill(fixedDataSet._fixed);



            string affiliated    = "";
            string department    = "";
            string keeper        = "";
            string storage_place = "";
            string fixedname_bar = "";

            List <int> trn_id = new List <int>();

            for (int i = 0; i < transfer_detailDataGrid.Items.Count; i++)
            {
                DataGridTemplateColumn templeColumn = transfer_detailDataGrid.Columns[0] as DataGridTemplateColumn;
                FrameworkElement       s            = transfer_detailDataGrid.Columns[0].GetCellContent(transfer_detailDataGrid.Items[i]);
                CheckBox    tbOper            = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox;
                DataRowView mySelectedElement = (DataRowView)transfer_detailDataGrid.Items[i];
                fixedname_bar = mySelectedElement.Row[2].ToString();
                if ((bool)tbOper.IsChecked)
                {
                    var v = from c in fixedDataSet.transfer_detail where c.barcode == fixedname_bar select c;
                    foreach (var t in v)
                    {
                        // bar=t.barcode;
                        affiliated    = t.old_affiliated;
                        department    = t.old_department;
                        keeper        = t.old_keeper;
                        storage_place = t.old_storage_place;
                        trn_id.Add(t.transfer_detail_ID);
                    }

                    var Vaffiliated = from c in fixedDataSet.affiliated where c.affiliated == affiliated select c;
                    int Iaffiliated = 0;
                    foreach (var a in Vaffiliated)
                    {
                        Iaffiliated = a.affiliated_ID;
                        break;
                    }

                    var Vdepartment = from c in fixedDataSet.department where c.department == department select c;
                    int Idepartment = 0;
                    foreach (var a in Vdepartment)
                    {
                        Idepartment = a.department_ID;
                        break;
                    }

                    var Vstorage_place = from c in fixedDataSet.storage_place where c.storage_place == storage_place select c;
                    int Istorage_place = 0;
                    foreach (var a in Vstorage_place)
                    {
                        Istorage_place = a.storage_place_ID;
                        break;
                    }


                    var Vkeeper = from c in fixedDataSet.keeper where c.keeper == keeper select c;
                    int Ikeeper = 0;
                    foreach (var a in Vkeeper)
                    {
                        Ikeeper = a.keeper_ID;
                        break;
                    }


                    var f = from c in fixedDataSet._fixed where c.barcode == fixedname_bar select c;

                    foreach (var id in f)
                    {
                        id.affiliated_ID    = Iaffiliated;
                        id.department_ID    = Idepartment;
                        id.storage_place_ID = Istorage_place;
                        id.keeper_ID        = Ikeeper;
                    }


                    fixedTableAdapter.Update(fixedDataSet._fixed);
                    fixedDataSet._fixed.AcceptChanges();
                    //fixedTableAdapter.Fill(fixedDataSet._fixed);
                }
            }



            Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixedDataSet.fixedname.AcceptChanges();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);


            foreach (int a in trn_id)
            {
                fixedDataSet.transfer_detail.FindBytransfer_detail_ID(a).Delete();
            }
            transfer_detailTableAdapter.Update(fixedDataSet.transfer_detail);
            fixedDataSet.transfer_detail.AcceptChanges();
        }
        private void fix_outtool_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);

            if (checknull())
            {
                checkmultitable();


                for (int i = 0; i < fixednameDataGrid.Items.Count; i++)
                {
                    DataGridTemplateColumn templeColumn = fixednameDataGrid.Columns[0] as DataGridTemplateColumn;
                    FrameworkElement s = fixednameDataGrid.Columns[0].GetCellContent(fixednameDataGrid.Items[i]);
                    CheckBox tbOper = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox;
                    DataRowView mySelectedElement = (DataRowView)fixednameDataGrid.Items[i];
                    int fixedname_id = int.Parse(mySelectedElement.Row[32].ToString());
                    if ((bool)tbOper.IsChecked)
                    {

                        var Voperator = from c in fixedDataSet._operator where c._operator == operator_IDC1ComboBox.Text select c;

                        int Ioperator = 0;
                        foreach (var a in Voperator)
                        {
                            Ioperator = a.operator_ID;
                            break;
                        }

                        var Vexit_way = from c in fixedDataSet.exit_way where c.way == exit_way_IDC1ComboBox.Text select c;
                        int Iexit_way = 0;
                        foreach (var a in Vexit_way)
                        {
                            Iexit_way = a.exit_way_ID;
                            break;
                        }

                        var select_count = from c in fixedDataSet._fixed where c.fixed_ID == fixedname_id select c;
                        foreach (var enable in select_count)
                        {
                            enable.enable_status = "2";
                            enable.exit_date = DateTime.Parse(exit_dateDatePicker.Text);
                            enable.operator_ID = Ioperator;
                            enable.exit_way_ID = Iexit_way;
                        }

                    }
                }
                fixedTableAdapter.Update(fixedDataSet._fixed);
                fixedDataSet._fixed.AcceptChanges();
                fixedTableAdapter.Fill(fixedDataSet._fixed);

            }
            Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixedDataSet.fixedname.AcceptChanges();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);
        }
        private void reductive_transfer_Click(object sender, RoutedEventArgs e)
        {
            Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet")));
            Fixed_management.FixedDataSetTableAdapters.transfer_detailTableAdapter transfer_detailTableAdapter = new Fixed_management.FixedDataSetTableAdapters.transfer_detailTableAdapter();

            Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter();
            fixedTableAdapter.Fill(fixedDataSet._fixed);



            string affiliated= "";
            string department="";
            string keeper="";
            string storage_place="";
            string fixedname_bar = "";
           
            List<int> trn_id=new List<int>();
            for (int i = 0; i < transfer_detailDataGrid.Items.Count;i++)
            {
                DataGridTemplateColumn templeColumn = transfer_detailDataGrid.Columns[0] as DataGridTemplateColumn;
                FrameworkElement s = transfer_detailDataGrid.Columns[0].GetCellContent(transfer_detailDataGrid.Items[i]);
                CheckBox tbOper = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox;
                DataRowView mySelectedElement = (DataRowView)transfer_detailDataGrid.Items[i];
                 fixedname_bar = mySelectedElement.Row[2].ToString();
                if ((bool)tbOper.IsChecked)
                {
                    var v = from c in fixedDataSet.transfer_detail where c.barcode == fixedname_bar select c;
                    foreach (var t in v)
                    {
                        // bar=t.barcode;
                         affiliated = t.old_affiliated;
                         department = t.old_department;
                         keeper = t.old_keeper;
                         storage_place = t.old_storage_place;
                         trn_id.Add(t.transfer_detail_ID);
                        
                    }

                        var Vaffiliated = from c in fixedDataSet.affiliated where c.affiliated == affiliated select c;
                        int Iaffiliated = 0;
                        foreach (var a in Vaffiliated)
                        {
                            Iaffiliated = a.affiliated_ID;
                            break;
                        }

                        var Vdepartment = from c in fixedDataSet.department where c.department == department select c;
                        int Idepartment = 0;
                        foreach (var a in Vdepartment)
                        {
                            Idepartment = a.department_ID;
                            break;
                        }

                        var Vstorage_place = from c in fixedDataSet.storage_place where c.storage_place == storage_place select c;
                        int Istorage_place = 0;
                        foreach (var a in Vstorage_place)
                        {
                            Istorage_place = a.storage_place_ID;
                            break;
                        }


                        var Vkeeper = from c in fixedDataSet.keeper where c.keeper == keeper select c;
                        int Ikeeper = 0;
                        foreach (var a in Vkeeper)
                        {
                            Ikeeper = a.keeper_ID;
                            break;
                        }


                      var f = from c in fixedDataSet._fixed where c.barcode ==  fixedname_bar select c;

                    foreach (var id in f)
                    {
                        id.affiliated_ID = Iaffiliated;
                        id.department_ID = Idepartment;
                        id.storage_place_ID = Istorage_place;
                        id.keeper_ID = Ikeeper;
                    }
                   

                    fixedTableAdapter.Update(fixedDataSet._fixed);
                    fixedDataSet._fixed.AcceptChanges();
                    //fixedTableAdapter.Fill(fixedDataSet._fixed);

        
                }

              
            }

         


            Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
            fixedDataSet.fixedname.AcceptChanges();
            fixednameTableAdapter.Fill(fixedDataSet.fixedname);


            foreach(int a in trn_id)
            {

                fixedDataSet.transfer_detail.FindBytransfer_detail_ID(a).Delete();
            }
            transfer_detailTableAdapter.Update(fixedDataSet.transfer_detail);
            fixedDataSet.transfer_detail.AcceptChanges();

        }
        private void transfer_btn_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);
          
            if (checknull())
            {
                checkmultitable();



                for (int i = 0; i < fixednameDataGrid.Items.Count; i++)
                {
                    DataGridTemplateColumn templeColumn = fixednameDataGrid.Columns[0] as DataGridTemplateColumn;
                    FrameworkElement s = fixednameDataGrid.Columns[0].GetCellContent(fixednameDataGrid.Items[i]);
                    CheckBox tbOper = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox;
                    DataRowView mySelectedElement = (DataRowView)fixednameDataGrid.Items[i];
                    int fixedname_id = int.Parse(mySelectedElement.Row[32].ToString());
                    if ((bool)tbOper.IsChecked && check_repat(fixedname_id))
                    {
                        

                        barcode = mySelectedElement.Row[0].ToString();
                        old_affiliated = mySelectedElement.Row[28].ToString();
                        old_department = mySelectedElement.Row[29].ToString();
                        old_keeper = mySelectedElement.Row[22].ToString();
                        old_storage_place = mySelectedElement.Row[31].ToString();


                        var Vaffiliated = from c in fixedDataSet.affiliated where c.affiliated == affiliated_IDC1ComboBox.Text select c;
                        int Iaffiliated = 0;
                        foreach (var a in Vaffiliated)
                        {
                            Iaffiliated = a.affiliated_ID;
                            break;
                        }

                        var Vdepartment = from c in fixedDataSet.department where c.department == department_IDC1ComboBox.Text select c;
                        int Idepartment = 0;
                        foreach (var a in Vdepartment)
                        {
                            Idepartment = a.department_ID;
                            break;
                        }

                        var Vstorage_place = from c in fixedDataSet.storage_place where c.storage_place == storage_place_IDC1ComboBox.Text select c;
                        int Istorage_place = 0;
                        foreach (var a in Vstorage_place)
                        {
                            Istorage_place = a.storage_place_ID;
                            break;
                        }


                        var Vkeeper = from c in fixedDataSet.keeper where c.keeper == keeper_IDC1ComboBox.Text select c;
                        int Ikeeper = 0;
                        foreach (var a in Vkeeper)
                        {
                            Ikeeper = a.keeper_ID;
                            break;
                        }



                        var t = from c in fixedDataSet._fixed where c.fixed_ID == fixedname_id select c;
                        foreach (var n in t)
                        {
                           
                            n.affiliated_ID = Iaffiliated;
                            n.department_ID = Idepartment;
                            n.keeper_ID = Ikeeper;
                            n.storage_place_ID = Istorage_place;
                        }
                        transfer_detail();
                    }
                    fixedTableAdapter.Update(fixedDataSet._fixed);
                    fixedDataSet._fixed.AcceptChanges();

                }
              

                Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
                fixedDataSet.fixedname.AcceptChanges();
                fixednameTableAdapter.Fill(fixedDataSet.fixedname);

                //transfer_detail();

            }
              

        }
        private void transfer_btn_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);

            if (checknull())
            {
                checkmultitable();



                for (int i = 0; i < fixednameDataGrid.Items.Count; i++)
                {
                    DataGridTemplateColumn templeColumn = fixednameDataGrid.Columns[0] as DataGridTemplateColumn;
                    FrameworkElement       s            = fixednameDataGrid.Columns[0].GetCellContent(fixednameDataGrid.Items[i]);
                    CheckBox    tbOper            = templeColumn.CellTemplate.FindName("checkbox", s) as CheckBox;
                    DataRowView mySelectedElement = (DataRowView)fixednameDataGrid.Items[i];
                    int         fixedname_id      = int.Parse(mySelectedElement.Row[32].ToString());
                    if ((bool)tbOper.IsChecked && check_repat(fixedname_id))
                    {
                        barcode           = mySelectedElement.Row[0].ToString();
                        old_affiliated    = mySelectedElement.Row[28].ToString();
                        old_department    = mySelectedElement.Row[29].ToString();
                        old_keeper        = mySelectedElement.Row[22].ToString();
                        old_storage_place = mySelectedElement.Row[31].ToString();


                        var Vaffiliated = from c in fixedDataSet.affiliated where c.affiliated == affiliated_IDC1ComboBox.Text select c;
                        int Iaffiliated = 0;
                        foreach (var a in Vaffiliated)
                        {
                            Iaffiliated = a.affiliated_ID;
                            break;
                        }

                        var Vdepartment = from c in fixedDataSet.department where c.department == department_IDC1ComboBox.Text select c;
                        int Idepartment = 0;
                        foreach (var a in Vdepartment)
                        {
                            Idepartment = a.department_ID;
                            break;
                        }

                        var Vstorage_place = from c in fixedDataSet.storage_place where c.storage_place == storage_place_IDC1ComboBox.Text select c;
                        int Istorage_place = 0;
                        foreach (var a in Vstorage_place)
                        {
                            Istorage_place = a.storage_place_ID;
                            break;
                        }


                        var Vkeeper = from c in fixedDataSet.keeper where c.keeper == keeper_IDC1ComboBox.Text select c;
                        int Ikeeper = 0;
                        foreach (var a in Vkeeper)
                        {
                            Ikeeper = a.keeper_ID;
                            break;
                        }



                        var t = from c in fixedDataSet._fixed where c.fixed_ID == fixedname_id select c;
                        foreach (var n in t)
                        {
                            n.affiliated_ID    = Iaffiliated;
                            n.department_ID    = Idepartment;
                            n.keeper_ID        = Ikeeper;
                            n.storage_place_ID = Istorage_place;
                        }
                        transfer_detail();
                    }
                    fixedTableAdapter.Update(fixedDataSet._fixed);
                    fixedDataSet._fixed.AcceptChanges();
                }


                Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter fixednameTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixednameTableAdapter();
                fixedDataSet.fixedname.AcceptChanges();
                fixednameTableAdapter.Fill(fixedDataSet.fixedname);

                //transfer_detail();
            }
        }