private void bwImport_DoWork(object sender, DoWorkEventArgs e)
 {
     foreach (AssemblyIncentiveModel model in assemblyIncentiveImportList)
     {
         AssemblyIncentiveController.Insert(model);
         Dispatcher.Invoke(new Action(() =>
         {
             dgvAssemblyIncentive.SelectedItem = model;
             dgvAssemblyIncentive.ScrollIntoView(model);
         }));
     }
 }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            string patternNo = "";

            if (assemblyIncentiveSearchList.Count > 0)
            {
                patternNo = assemblyIncentiveSearchList.Select(s => s.PatternNo).FirstOrDefault();
            }
            if (MessageBox.Show("Confirm Delete?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                AssemblyIncentiveController.Delete(patternNo);
                MessageBox.Show("Deleted!", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
                dgvAssemblyIncentiveRevise.ItemsSource = null;
            }
        }
 private void bwSearch_DoWork(object sender, DoWorkEventArgs e)
 {
     assemblyIncentiveList       = AssemblyIncentiveController.Select(patternNo);
     assemblyIncentiveSearchList = assemblyIncentiveList.Where(w => w.PatternNo == patternNo).ToList();
 }