public static List<Model.TestInfoModel> GetTestInfoModelListByTestID(int testID,TestInfoModelParams param) { List<Model.TestInfoModel> testInfoModelList = new List<Model.TestInfoModel>(); if (testInfoModelListDict.ContainsKey(testID)) { testInfoModelList=testInfoModelListDict[testID]; } else { testInfoModelList = QueryTestInfo(testID); testInfoModelListDict.Add(testID, testInfoModelList); } if (param!=null) { List<Model.TestInfoModel> checkedList=testInfoModelList; if (param.athName!=null) { checkedList = checkedList.FindAll(x => x.Ath_Name.Contains(param.athName.ToLower()) || x.Ath_Name.Contains(param.athName.ToUpper())); } if (param.athCode!=null) { checkedList = checkedList.FindAll(x => x.Ath_Code == param.athCode); } if (param.testJoint!=null) { checkedList = checkedList.FindAll(x => x.Joint == param.testJoint); } if (param.testJointSide!=null) { checkedList = checkedList.FindAll(x => x.Joint_Side == param.testJointSide); } if (param.testMode!=null) { checkedList = checkedList.FindAll(x => x.Test_Mode == param.testMode); } testInfoModelList =(List<Model.TestInfoModel>) checkedList; } return testInfoModelList; }
public static List <Model.TestInfoModel> GetTestInfoModelListByTestID(int testID, TestInfoModelParams param) { List <Model.TestInfoModel> testInfoModelList = new List <Model.TestInfoModel>(); if (testInfoModelListDict.ContainsKey(testID)) { testInfoModelList = testInfoModelListDict[testID]; } else { testInfoModelList = QueryTestInfo(testID); testInfoModelListDict.Add(testID, testInfoModelList); } if (param != null) { List <Model.TestInfoModel> checkedList = testInfoModelList; if (param.athName != null) { checkedList = checkedList.FindAll(x => x.Ath_Name.Contains(param.athName.ToLower()) || x.Ath_Name.Contains(param.athName.ToUpper())); } if (param.athCode != null) { checkedList = checkedList.FindAll(x => x.Ath_Code == param.athCode); } if (param.testJoint != null) { checkedList = checkedList.FindAll(x => x.Joint == param.testJoint); } if (param.testJointSide != null) { checkedList = checkedList.FindAll(x => x.Joint_Side == param.testJointSide); } if (param.testMode != null) { checkedList = checkedList.FindAll(x => x.Test_Mode == param.testMode); } testInfoModelList = (List <Model.TestInfoModel>)checkedList; } return(testInfoModelList); }
//刷新数据表 private void RefrenshDataGridSource() { if (testManager.SelectedItem != null) { TestInfoModelParams param = new TestInfoModelParams(); if (txtKeyWord.Text.Trim() != "") { param.athName = txtKeyWord.Text.Trim(); } if (cbJoint.SelectedIndex > 0) { param.testJoint = jointDictList[cbJoint.SelectedIndex].Dict_Key; } if (cbTestMode.SelectedIndex > 0) { param.testMode = testmodeDictList[cbTestMode.SelectedIndex].Dict_Key; } if (cbJointSide.SelectedIndex > 0) { param.testJointSide = jointsideDictList[cbJointSide.SelectedIndex].Dict_Key; } if (AthleteInfo != null) { param.athCode = AthleteInfo.Ath_Code; } testInfoModelList = TestInfoModelCache.GetTestInfoModelListByTestID(testManager.SelectedItem.ID,param); if (AthleteInfo != null) { List<Model.TestInfoModel> currentDateTestInfoList = testInfoModelList.FindAll(x => x.TestDate.ToString("yyyyMMdd") == AthleteInfo.Ath_TestDate.ToString("yyyyMMdd")); if (currentDateTestInfoList.Count > 0) { foreach (Model.TestInfoModel model in currentDateTestInfoList) { testInfoModelList.Remove(model);//先移除 testInfoModelList.Insert(0, model);//插入到第一个 } for (int i = 0; i < testInfoModelList.Count; i++) { testInfoModelList[i].Index = i + 1; } } } } else { testInfoModelList = new List<Model.TestInfoModel>(); } Binding b = new Binding() { Source = testInfoModelList }; dgTestInfo.SetBinding(DataGrid.ItemsSourceProperty, b); }