private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (!IsModify)
     {
         ExcelPin p = (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pin;
         p.PinNO = this.codepart.Text;
         if (QualityCheck())
         {
             int rs = SQliteDbContext.AddExPin(p);
             if (rs > 0)
             {
                 MessageBox.Show("添加成功", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                 (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pins.Add(p);
                 IsAdd = true;
                 this.Close();
             }
         }
     }
     else
     {
         ExcelPin p = (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pin;
         p.PinNO = this.codepart.Text;
         if (QualityCheck())
         {
             int rs = SQliteDbContext.UpdatOneExPin(p);
             if (rs > 0)
             {
                 MessageBox.Show("修改成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                 this.Close();
             }
         }
     }
     (App.Current.Resources["Locator"] as ViewModelLocator).ExcelPaper.Pins =
         new ObservableCollection <ExcelPin>(SQliteDbContext.
                                             GetOneFixtureExcelPins((App.Current.Resources["Locator"] as ViewModelLocator).
                                                                    ExcelPaper.Fixture.FixtureType));
 }