private bool CheckedIsNeedSave() { appLog.Info("Check If Need Save..."); if (AllSalaryList == null) { appLog.Info("AllSalaryList==null,return."); return(false); } //检查添加项 if (AllSalaryList.Count != dataManager.AllSalaryList.Count) { appLog.InfoFormat("Check New Item,AllSalaryList.Count={0},dataManager.AllSalaryList.Count={1}", AllSalaryList.Count, dataManager.AllSalaryList.Count); needAddList = new ObservableCollection <SalaryInfo>(AllSalaryList.Where(s => s.ID == 0)); return(true); } else { //检查并获取编辑项 appLog.Info("Check and Get edited Items."); var tempList = new ObservableCollection <SalaryInfo>(AllSalaryList.Where(s => s.Year == (int)YearComboBox.SelectedItem && s.Month == (int)MonthComboBox.SelectedItem)); needUpdateList = AlgorithmClass.CompareCollectionIsChanged <SalaryInfo>(dataManager.AllSalaryList, tempList, "ID"); if (needUpdateList.Count != 0) { return(true); } } return(false); }
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 bool CheckedIsNeedSave() { if (AllEmployeeList == null || lcv == null) { return(false); } DepartmentInfo curDepartmentInfo = DepartmentComboBox.SelectedItem as DepartmentInfo; //检查添加项 if (AllEmployeeList.Count != dataManager.AllEmployeeList.Count) { foreach (EmployeeInfo info in lcv) { if (info.ID == 0) { needAddList.Add(info); } } return(true); } else { //检查并获取编辑项 var tempList = new ObservableCollection <EmployeeInfo>(); foreach (EmployeeInfo info in lcv) { if (info.ID != 0) { tempList.Add(info); } } needUpdateList = AlgorithmClass.CompareCollectionIsChanged <EmployeeInfo>(dataManager.AllEmployeeList, tempList, "ID"); if (needUpdateList.Count != 0) { return(true); } } return(false); }