private void UserControl_Loaded(object sender, RoutedEventArgs e) { AlgorithmClass.InitBOPSelectionList(dataManager.AllBOPList, dataManager.AllDepartmentList, dataManager.AllEmployeeList); BalanceBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.B); PaymentBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.P); BalanceBOPList.CollectionChanged += BalanceBOPList_CollectionChanged; PaymentBOPList.CollectionChanged += PaymentBOPList_CollectionChanged; InitBOPUIList(BalanceBOPList, BOPType.B); }
private bool CheckedIsNeedSave(ref BOPInfo tempInfo, ref ObservableCollection <BOPInfo> needUpdateList, BOPType bopType) { if (dataManager == null) { tempInfo = new BOPInfo(); needUpdateList = new ObservableCollection <BOPInfo>(); return(false); } ObservableCollection <BOPInfo> tempInfoList = null; bool isNeedUpdate = false; //检查新建项 switch (bopType) { case BOPType.P: tempInfo = PaymentBOPList.Where(bop => bop.ID == 0).FirstOrDefault(); tempInfoList = pageManager.ReFreshCurPageCollection( AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.P)); break; case BOPType.B: tempInfo = BalanceBOPList.Where(bop => bop.ID == 0).FirstOrDefault(); tempInfoList = pageManager.ReFreshCurPageCollection( AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.B)); break; } if (tempInfo != null) { isNeedUpdate = true; } //检查并获取编辑项 needUpdateList = AlgorithmClass.CompareCollectionIsChanged <BOPInfo>(tempInfoList, (FindResource("ViewSource") as CollectionViewSource).Source as ObservableCollection <BOPInfo>, "ID"); if (needUpdateList.Count != 0) { isNeedUpdate = true; } return(isNeedUpdate); }
private void RestoreBtn_Click(object sender, RoutedEventArgs e) { switch ((BOPType)(((DictionaryEntry)(BOPTypeList.SelectedValue)).Key)) { case BOPType.P: PaymentBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.P); PaymentBOPList.CollectionChanged += PaymentBOPList_CollectionChanged; InitBOPUIList(PaymentBOPList, BOPType.P); break; case BOPType.B: BalanceBOPList = AlgorithmClass.GetBOPListByBOPType(dataManager.AllBOPList, BOPType.B); BalanceBOPList.CollectionChanged += BalanceBOPList_CollectionChanged; InitBOPUIList(BalanceBOPList, BOPType.B); break; } }