private void confirm_Click(object sender, RoutedEventArgs e)
        {
            Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet")));
            // 将数据加载到表 nature 中。可以根据需要修改此代码。
            Fixed_management.FixedDataSetTableAdapters.employeesTableAdapter fixedDataSetemployeesTableAdapter = new Fixed_management.FixedDataSetTableAdapters.employeesTableAdapter();
            fixedDataSetemployeesTableAdapter.Fill(fixedDataSet.employees);
            System.Windows.Data.CollectionViewSource employeesViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("employeesViewSource")));
            //employeesViewSource.View.MoveCurrentToFirst();


            if (isnull())
            {
                ischeck();

                if (u_id < 1)
                {
                    var s = from c in fixedDataSet.employees where c.number == numberTextBox.Text select c;


                    if (s.Count() > 0)
                    {
                        MessageBox.Show("员工编号已存在", "提示");
                    }
                    else
                    {
                        if (confirm_passwordTextBox.Text != passwordTextBox.Text)
                        {
                            MessageBox.Show("密码前后不一致", "提示");
                        }
                        else
                        {
                            string sex = "";
                            if ((bool)radioButton1.IsChecked)
                            {
                                sex = "男";
                            }
                            else
                            {
                                sex = "女";
                            }

                            fixedDataSet.employees.AddemployeesRow(numberTextBox.Text, em_nameTextBox.Text, passwordTextBox.Text, sex, DateTime.Now, "123456789", phoneTextBox.Text, addressTextBox.Text, contentTextBox.Text, permsis);
                            fixedDataSetemployeesTableAdapter.Update(fixedDataSet.employees);
                            fixedDataSet.AcceptChanges();
                            fixedDataSetemployeesTableAdapter.Fill(fixedDataSet.employees);
                            MessageBox.Show("添加成功!", "提示");

                            C1.WPF.C1Window findfixed = MainWindow.FindChild <C1.WPF.C1Window>(Application.Current.MainWindow, "employeeswindow1");
                            if (findfixed != null)
                            {
                                findfixed.Close();
                            }
                        }
                    }
                }
                else
                {
                    //employeesViewSource.View.MoveCurrentToNext();
                    //fixedDataSetemployeesTableAdapter.Update(fixedDataSet.employees);
                    var q = from c in fixedDataSet.employees where c.employees_ID == u_id select c;
                    foreach (var t in q)
                    {
                        t.number   = numberTextBox.Text;
                        t.em_name  = em_nameTextBox.Text;
                        t.password = passwordTextBox.Text;
                        if ((bool)radioButton1.IsChecked)
                        {
                            t.sex = "男";
                        }
                        else
                        {
                            t.sex = "女";
                        }
                        t.phone      = phoneTextBox.Text;
                        t.address    = addressTextBox.Text;
                        t.content    = contentTextBox.Text;
                        t.pemissions = permsis;
                    }
                    //confirm_passwordTextBox.Text = passwordTextBox.Text;
                    if (confirm_passwordTextBox.Text != passwordTextBox.Text)
                    {
                        MessageBox.Show("密码前后不一致", "提示");
                    }
                    else
                    {
                        fixedDataSetemployeesTableAdapter.Update(fixedDataSet.employees);

                        C1.WPF.C1Window findfixed = MainWindow.FindChild <C1.WPF.C1Window>(Application.Current.MainWindow, "employeeswindow2");
                        if (findfixed != null)
                        {
                            findfixed.Close();
                        }
                    }
                }

                //Expander ed = sender as Expander;
                //C1.WPF.C1Window findfixed = ed.Parent as C1.WPF.C1Window;
                //if (findfixed != null)
                //{
                //    findfixed.Close();
                //}



                //Userlist list = MainWindow.FindChild<Userlist>(Application.Current.MainWindow, "newuserlist");
                //var a = from c in fixedDataSet.employees select c;
                //if (list != null)
                //{

                //    list.employeesDataGrid.ItemsSource = a;
                //    //list.UpdateLayout();
                //    list.employeesDataGrid.UpdateLayout();
                //}



                //RoutedPropertyChangedEventArgs<object> args = new RoutedPropertyChangedEventArgs<object>(this, e);
                //args.RoutedEvent = userdetail.C1WindowEvent;
                //this.RaiseEvent(args);
            }
        }
        private void fixed_add_Click(object sender, RoutedEventArgs e)
        {
            Fixed_management.FixedDataSet fixedDataSet = ((Fixed_management.FixedDataSet)(this.FindResource("fixedDataSet")));
            Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter fixedDataSetfixedTableAdapter = new Fixed_management.FixedDataSetTableAdapters.fixedTableAdapter();
            if (checknull())
            {
                checkmultitable();
            }
            var Vnature = from c in fixedDataSet.nature where c.nature == natureC1ComboBox.Text select c;
            int Inature = 0;

            foreach (var s in Vnature)
            {
                Inature = s.nature_ID;
                break;
            }
            var Vcategory = from c in fixedDataSet.category where c.category == categoryC1ComboBox.Text select c;
            int Icategory = 0;

            foreach (var s in Vcategory)
            {
                Icategory = s.category_ID;
                break;
            }
            var Vdesignation = from c in fixedDataSet.designation where c.designation == designationC1ComboBox.Text select c;
            int Idesignation = 0;

            foreach (var s in Vdesignation)
            {
                Idesignation = s.designation_ID;
                break;
            }
            var Vspecifications = from c in fixedDataSet.specifications where c.specifications == specifications_IDC1ComboBox.Text select c;
            int Ispecifications = 0;

            foreach (var s in Vspecifications)
            {
                Ispecifications = s.specifications_ID;
                break;
            }
            var Vmodel = from c in fixedDataSet.model where c.model == model_IDC1ComboBox.Text select c;
            int Imodel = 0;

            foreach (var s in Vmodel)
            {
                Imodel = s.model_ID;
                break;
            }


            var Vpurchase_way = from c in fixedDataSet.purchase_way where c.purchase_way == purchase_way_IDC1ComboBox.Text select c;

            int Ipurchase_way = 0;

            foreach (var s in Vpurchase_way)
            {
                Ipurchase_way = s.purchase_way_ID;
                break;
            }
            var Vunit = from c in fixedDataSet.unit where c.unit == unit_IDC1ComboBox.Text select c;
            int Iunit = 0;

            foreach (var s in Vunit)
            {
                Iunit = s.unit_ID;
                break;
            }
            var Vaffiliated = from c in fixedDataSet.affiliated where c.affiliated == affiliated_IDC1ComboBox.Text select c;
            int Iaffiliated = 0;

            foreach (var s in Vaffiliated)
            {
                Iaffiliated = s.affiliated_ID;
                break;
            }
            var Vdepartment = from c in fixedDataSet.department where c.department == department_IDC1ComboBox.Text select c;
            int Idepartment = 0;

            foreach (var s in Vdepartment)
            {
                Idepartment = s.department_ID;
                break;
            }
            var Vkeeper = from c in fixedDataSet.keeper where c.keeper == keeper_IDC1ComboBox.Text select c;
            int Ikeeper = 0;

            foreach (var s in Vkeeper)
            {
                Ikeeper = s.keeper_ID;
                break;
            }
            var Vsupplier = from c in fixedDataSet.supplier where c.supplier == supplier_IDC1ComboBox.Text select c;
            int Isupplier = 0;

            foreach (var s in Vsupplier)
            {
                Isupplier = s.supplier_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 s in Vstorage_place)
            {
                Istorage_place = s.storage_place_ID;
                break;
            }


            var Vposition = from c in fixedDataSet.position where c.position == position_IDC1ComboBox.Text select c;

            int Iposition = 0;

            foreach (var s in Vposition)
            {
                Iposition = s.position_ID;
                break;
            }
            var Vfixed_status = from c in fixedDataSet.fixed_status where c.fixed_status == fixed_status_IDC1ComboBox.Text select c;
            int Ifixed_status = 0;

            foreach (var s in Vfixed_status)
            {
                Ifixed_status = s.fixed_status_ID;
                break;
            }
            var Vuser = from c in fixedDataSet.user where c.user == user_IDC1ComboBox.Text select c;
            int Iuser = 0;

            foreach (var s in Vuser)
            {
                Iuser = s.user_ID;
                break;
            }


            fixedDataSet._fixed.AddfixedRow(barcode.Text, Inature, Icategory, Idesignation, Ispecifications, Imodel, DateTime.Now, int.Parse(limitTextBox.Text), Ipurchase_way, int.Parse(fixed_numberTextBox.Text), Iunit, fixed_valeTextBox.Text, Ikeeper, Isupplier, factory_numberTextBox.Text, fixed_encodingTextBox.Text, Istorage_place, Iposition, Ifixed_status, Iuser, DateTime.Now, int.Parse(warrantyTextBox.Text), account_numberTextBox.Text, fixed_assetTextBox.Text, card_numberTextBox.Text, "1", "1", "", contentTextBox.Text, 1, Iaffiliated, Idepartment, 1, 1, DateTime.Now);
            fixedDataSetfixedTableAdapter.Update(fixedDataSet._fixed);


            C1.WPF.C1Window findfixed = MainWindow.FindChild <C1.WPF.C1Window>(Application.Current.MainWindow, "newfixed");
            if (findfixed != null)
            {
                findfixed.Close();
            }
        }