private void Button_DeliveryNotMatched_SetSpecal_Click(object sender, RoutedEventArgs e) { var item = (sender as Button).DataContext as 交割单; if (item != null) { var result = MessageBox.Show("确认强制保留此交割单吗?", "交割单编辑", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { using (var db = new DataComparisionDataset()) { var lst = db.交割单ds.ToList(); var editItem = lst.FirstOrDefault(_ => EntityCompareUtil.IsSame(item, _)); if (editItem != null) { editItem.备注 = "强制保留"; db.SaveChanges(); } } RefreshWindow(false); } } }
private void Button_Soft_Delete_Click(object sender, RoutedEventArgs e) { var item = (sender as Button).DataContext as 软件委托; if (item != null) { var result = MessageBox.Show("确认删除此委托吗?", "委托删除", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { using (var db = new DataComparisionDataset()) { var lst = db.软件委托ds.ToList(); var deleteItem = lst.FirstOrDefault(_ => EntityCompareUtil.IsSame(item, _)); if (deleteItem != null) { db.软件委托ds.Remove(deleteItem); db.SaveChanges(); } } RefreshWindow(false); } } }