public static List <Model.TestInfoModel> AthTestUtil(DataSet ds) { List <Model.TestInfoModel> testInfoModelList = new List <Model.TestInfoModel>(); BLL.TB_TestInfo testInfoBLL = new BLL.TB_TestInfo(); BLL.TB_AthleteInfo athleteInfoBLL = new BLL.TB_AthleteInfo(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; Model.TestInfoModel testInfoModel = new Model.TestInfoModel(); testInfoModel.Index = i + 1; testInfoBLL.GetModelFromDataRow(dr, testInfoModel); athleteInfoBLL.GetAthleteInfoFromDataRow(dr, testInfoModel); testInfoModel.DGravitycomp = DictCache.GetDictValue(DictCache.Gravitycomp, testInfoModel.Gravitycomp); testInfoModel.DInsuredSide = DictCache.GetDictValue(DictCache.InsuredSide, testInfoModel.InsuredSide); testInfoModel.DJoint = DictCache.GetDictValue(DictCache.Joint, testInfoModel.Joint); testInfoModel.DJointSide = DictCache.GetDictValue(DictCache.JointSide, testInfoModel.Joint_Side); testInfoModel.DTestMode = DictCache.GetDictValue(DictCache.TestMode, testInfoModel.Test_Mode); testInfoModel.DPlane = DictCache.GetDict(testInfoModel.Joint, testInfoModel.Plane, testInfoModel.Test_Mode).Dict_Value; testInfoModelList.Add(testInfoModel); } return(testInfoModelList); }
public static List<Model.TestInfoModel> AthTestUtil(DataSet ds) { List<Model.TestInfoModel> testInfoModelList = new List<Model.TestInfoModel>(); BLL.TB_TestInfo testInfoBLL = new BLL.TB_TestInfo(); BLL.TB_AthleteInfo athleteInfoBLL = new BLL.TB_AthleteInfo(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; Model.TestInfoModel testInfoModel = new Model.TestInfoModel(); testInfoModel.Index = i + 1; testInfoBLL.GetModelFromDataRow(dr, testInfoModel); athleteInfoBLL.GetAthleteInfoFromDataRow(dr, testInfoModel); testInfoModel.DGravitycomp = DictCache.GetDictValue(DictCache.Gravitycomp, testInfoModel.Gravitycomp); testInfoModel.DInsuredSide = DictCache.GetDictValue(DictCache.InsuredSide, testInfoModel.InsuredSide); testInfoModel.DJoint = DictCache.GetDictValue(DictCache.Joint, testInfoModel.Joint); testInfoModel.DJointSide = DictCache.GetDictValue(DictCache.JointSide, testInfoModel.Joint_Side); testInfoModel.DTestMode = DictCache.GetDictValue(DictCache.TestMode, testInfoModel.Test_Mode); testInfoModel.DPlane = DictCache.GetDict(testInfoModel.Joint, testInfoModel.Plane, testInfoModel.Test_Mode).Dict_Value; testInfoModelList.Add(testInfoModel); } return testInfoModelList; }
public PageAthleteManager() { InitializeComponent(); athleteBLL = new BLL.TB_AthleteInfo(); testInfoBLL = new BLL.TB_TestInfo(); menu = new ContextMenu(); miEdit.Header = "编辑信息"; miEdit.Click += new RoutedEventHandler(miEdit_Click); menu.Items.Add(miEdit); miShowTestInfo.Header = "查看测试信息"; miShowTestInfo.Click += new RoutedEventHandler(miShowTestInfo_Click); menu.Items.Add(miShowTestInfo); Separator sp = new Separator(); menu.Items.Add(sp); MenuItem miHidden = new MenuItem(); miHidden.Header = "设为隐藏"; menu.Items.Add(miHidden); miHidden.Click += new RoutedEventHandler(btnHidden_Click); MenuItem miDelete = new MenuItem(); miDelete.Header = "删除"; menu.Items.Add(miDelete); miDelete.Click += new RoutedEventHandler(btnDelete_Click); }
//删除 private void imgDelete_MouseDown(object sender, MouseButtonEventArgs e) { if (testItmesListBox.SelectedIndex >= 0) { if (MessageBox.Show("删除测试项目将会删除该项目下所有受试者信息和测试数据,改变应用该项目中测试数据建立的测试参考值。\r\n删除的信息将不能恢复,请确认要删除选择的测试项目吗?", "删除测试项目确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { testInfoBLL = new BLL.TB_TestInfo(); List <Model.TB_TestInfo> testInfoList = testInfoBLL.GetModelList("ath_id in (select id from tb_athleteinfo where ath_testid=" + testList[testItmesListBox.SelectedIndex].ID + ")"); foreach (Model.TB_TestInfo testInfo in testInfoList) { string dataFileName = Model.AppPath.XmlDataDirPath + testInfo.DataFileName; if (File.Exists(dataFileName)) { File.Delete(dataFileName); } } int selectTestID = testList[testItmesListBox.SelectedIndex].ID; testManagerBLL.Delete(selectTestID); //删除测试信息缓存 DSJL.Caches.TestInfoModelCache.DeleteCache(selectTestID); RefrenshList(); } } else { MessageBox.Show("请选择一项删除!"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { standTestRefeBLL = new BLL.TB_StandTestRefe(); testInfoBLL = new BLL.TB_TestInfo(); athleteBLL = new BLL.TB_AthleteInfo(); standPramsBLL = new BLL.TB_StandardParams(); standParam = standPramsBLL.GetModelByStandID(StandInfo.ID); parentStandParam = standPramsBLL.GetModelByStandID((int)StandInfo.Stand_ParentID); tbTitle.Text += " 当前测试参考值为:" + StandInfo.Stand_Name; }
//导入 private void btnImport_Click(object sender, RoutedEventArgs e) { if (btnImport.Content.ToString() == "开始导入") { btnChoolseFiles.IsEnabled = false; btnClose.IsEnabled = false; testManagerBLL = new BLL.TB_TestManager(); athBLL = new BLL.TB_AthleteInfo(); testInfoBLL = new BLL.TB_TestInfo(); errorModelList = new List <Model.ImportDataErrorModel>(); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = false; worker.RunWorkerAsync(); btnImport.Content = "取消导入"; } else { importFlag = 2; MessageBoxResult mr = MessageBox.Show("确定取消导入吗?", "系统信息", MessageBoxButton.OKCancel); if (mr == MessageBoxResult.OK) { importFlag = 1; } else { importFlag = 0; } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { standTestRefeBLL = new BLL.TB_StandTestRefe(); testInfoBLL = new BLL.TB_TestInfo(); athleteBLL = new BLL.TB_AthleteInfo(); standPramsBLL = new BLL.TB_StandardParams(); standParam = standPramsBLL.GetModelByStandID(StandInfo.ID); parentStandParam = standPramsBLL.GetModelByStandID((int)StandInfo.Stand_ParentID); tbTitle.Text +=" 当前测试参考值为:" +StandInfo.Stand_Name; }
//导入 private void btnImport_Click(object sender, RoutedEventArgs e) { if (btnImport.Content.ToString() == "开始导入") { btnChoolseFiles.IsEnabled = false; btnClose.IsEnabled = false; testManagerBLL = new BLL.TB_TestManager(); athBLL = new BLL.TB_AthleteInfo(); testInfoBLL = new BLL.TB_TestInfo(); errorModelList = new List<Model.ImportDataErrorModel>(); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = false; worker.RunWorkerAsync(); btnImport.Content = "取消导入"; } else { importFlag = 2; MessageBoxResult mr = MessageBox.Show("确定取消导入吗?", "系统信息", MessageBoxButton.OKCancel); if (mr == MessageBoxResult.OK) { importFlag = 1; } else { importFlag = 0; } } }
//删除 private void imgDelete_MouseDown(object sender, MouseButtonEventArgs e) { if (testItmesListBox.SelectedIndex >= 0) { if (MessageBox.Show("删除测试项目将会删除该项目下所有受试者信息和测试数据,改变应用该项目中测试数据建立的测试参考值。\r\n删除的信息将不能恢复,请确认要删除选择的测试项目吗?", "删除测试项目确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { testInfoBLL = new BLL.TB_TestInfo(); List<Model.TB_TestInfo> testInfoList = testInfoBLL.GetModelList("ath_id in (select id from tb_athleteinfo where ath_testid=" + testList[testItmesListBox.SelectedIndex].ID + ")"); foreach (Model.TB_TestInfo testInfo in testInfoList) { string dataFileName = Model.AppPath.XmlDataDirPath + testInfo.DataFileName; if (File.Exists(dataFileName)) { File.Delete(dataFileName); } } int selectTestID=testList[testItmesListBox.SelectedIndex].ID; testManagerBLL.Delete(selectTestID); //删除测试信息缓存 DSJL.Caches.TestInfoModelCache.DeleteCache(selectTestID); RefrenshList(); } } else { MessageBox.Show("请选择一项删除!"); } }
private void Merge() { DbHelperOleDb.SetDBPath(tempExtrctorPath + "DSJLDB.mdb"); DSJL.BLL.TB_AthleteInfo athBLL = new BLL.TB_AthleteInfo(); DSJL.BLL.TB_StandardInfo standBLL = new BLL.TB_StandardInfo(); DSJL.BLL.TB_StandTestRefe refeBLL = new BLL.TB_StandTestRefe(); DSJL.BLL.TB_TestInfo testInfoBLL = new BLL.TB_TestInfo(); DSJL.BLL.TB_TestManager testManagerBLL = new BLL.TB_TestManager(); List<Model.TB_AthleteInfo> athList = athBLL.GetModelList(""); List<Model.TB_StandardInfo> standList = standBLL.GetModelList(""); List<Model.TB_StandTestRefe> refeList = refeBLL.GetModelList(""); List<Model.TB_TestInfo> testInfoList = testInfoBLL.GetModelList(""); List<Model.TB_TestManager> testManagerList = testManagerBLL.GetModelList(""); DbHelperOleDb.SetDefaultDBPath(); Dictionary<int, int> testManagerDict = new Dictionary<int, int>(); Dictionary<int, int> testInfoDict = new Dictionary<int, int>(); Dictionary<int, int> standDict = new Dictionary<int, int>(); Dictionary<int, int> athDict = new Dictionary<int, int>(); for (int i = 0; i < testManagerList.Count; i++) { Model.TB_TestManager managerModel = testManagerList[i]; if (DbHelperOleDb.Exists("TB_TestManager", "TestName", managerModel.TestName)) { managerModel.TestName = managerModel.TestName + "(1)"; } testManagerBLL.Add(managerModel); int newID = testManagerBLL.GetMaxId(); testManagerDict.Add(managerModel.ID, newID); UpdateMergeState(Percent(i+1,testManagerList.Count), "正在导入测试项目信息..."); } for (int i = 0; i < standList.Count; i++) { Model.TB_StandardInfo standModel = standList[i]; if (DbHelperOleDb.Exists("Tb_StandardInfo", "Stand_Name", standModel.Stand_Name)) { standModel.Stand_Name = standModel.Stand_Name + "(1)"; } standBLL.Add(standModel); int newID = standBLL.GetMaxId(); standDict.Add(standModel.ID, newID); UpdateMergeState(Percent(i + 1, standList.Count), "正在导入测试参考值信息..."); } for (int i = 0; i < athList.Count; i++) { Model.TB_AthleteInfo athModel = athList[i]; athModel.Ath_TestID = testManagerDict[athModel.Ath_TestID]; string existID = ""; int addResult = athBLL.Add(athModel,out existID); int newID=0; switch (addResult) { case BLL.TB_AthleteInfo.RepeatAdd: newID = int.Parse(existID); break; case BLL.TB_AthleteInfo.Success: newID = athBLL.GetMaxId(); break; } athDict.Add(athModel.ID, newID); UpdateMergeState(Percent(i + 1, athList.Count), "正在导入受测者信息..."); } for (int i = 0; i < testInfoList.Count; i++) { Model.TB_TestInfo testInfoModel = testInfoList[i]; testInfoModel.Ath_ID = athDict[testInfoModel.Ath_ID]; testInfoBLL.Add(testInfoModel); int newID = testInfoBLL.GetMaxId(); string dataFileFullName = AppPath.XmlDataDirPath + testInfoModel.DataFileName; string oldFileName = testInfoModel.DataFileName; if (File.Exists(dataFileFullName)) { testInfoModel.DataFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xml"; } File.Copy(tempExtrctorPath + oldFileName, AppPath.XmlDataDirPath + testInfoModel.DataFileName); testInfoDict.Add(testInfoModel.ID, newID); UpdateMergeState(Percent(i + 1, testInfoList.Count), "正在导入测试信息..."); } for (int i = 0; i < refeList.Count; i++) { Model.TB_StandTestRefe refeModel = refeList[i]; refeModel.StandID = standDict[refeModel.StandID]; refeModel.TestID = testInfoDict[refeModel.TestID]; refeBLL.Add(refeModel); UpdateMergeState(Percent(i + 1, refeList.Count), "正在重设数据关系..."); } Directory.Delete(tempExtrctorPath, true); UpdateMergeState(-2, "数据合并完成"); }
private void Merge() { DbHelperOleDb.SetDBPath(tempExtrctorPath + "DSJLDB.mdb"); DSJL.BLL.TB_AthleteInfo athBLL = new BLL.TB_AthleteInfo(); DSJL.BLL.TB_StandardInfo standBLL = new BLL.TB_StandardInfo(); DSJL.BLL.TB_StandTestRefe refeBLL = new BLL.TB_StandTestRefe(); DSJL.BLL.TB_TestInfo testInfoBLL = new BLL.TB_TestInfo(); DSJL.BLL.TB_TestManager testManagerBLL = new BLL.TB_TestManager(); List <Model.TB_AthleteInfo> athList = athBLL.GetModelList(""); List <Model.TB_StandardInfo> standList = standBLL.GetModelList(""); List <Model.TB_StandTestRefe> refeList = refeBLL.GetModelList(""); List <Model.TB_TestInfo> testInfoList = testInfoBLL.GetModelList(""); List <Model.TB_TestManager> testManagerList = testManagerBLL.GetModelList(""); DbHelperOleDb.SetDefaultDBPath(); Dictionary <int, int> testManagerDict = new Dictionary <int, int>(); Dictionary <int, int> testInfoDict = new Dictionary <int, int>(); Dictionary <int, int> standDict = new Dictionary <int, int>(); Dictionary <int, int> athDict = new Dictionary <int, int>(); for (int i = 0; i < testManagerList.Count; i++) { Model.TB_TestManager managerModel = testManagerList[i]; if (DbHelperOleDb.Exists("TB_TestManager", "TestName", managerModel.TestName)) { managerModel.TestName = managerModel.TestName + "(1)"; } testManagerBLL.Add(managerModel); int newID = testManagerBLL.GetMaxId(); testManagerDict.Add(managerModel.ID, newID); UpdateMergeState(Percent(i + 1, testManagerList.Count), "正在导入测试项目信息..."); } for (int i = 0; i < standList.Count; i++) { Model.TB_StandardInfo standModel = standList[i]; if (DbHelperOleDb.Exists("Tb_StandardInfo", "Stand_Name", standModel.Stand_Name)) { standModel.Stand_Name = standModel.Stand_Name + "(1)"; } standBLL.Add(standModel); int newID = standBLL.GetMaxId(); standDict.Add(standModel.ID, newID); UpdateMergeState(Percent(i + 1, standList.Count), "正在导入测试参考值信息..."); } for (int i = 0; i < athList.Count; i++) { Model.TB_AthleteInfo athModel = athList[i]; athModel.Ath_TestID = testManagerDict[athModel.Ath_TestID]; string existID = ""; int addResult = athBLL.Add(athModel, out existID); int newID = 0; switch (addResult) { case BLL.TB_AthleteInfo.RepeatAdd: newID = int.Parse(existID); break; case BLL.TB_AthleteInfo.Success: newID = athBLL.GetMaxId(); break; } athDict.Add(athModel.ID, newID); UpdateMergeState(Percent(i + 1, athList.Count), "正在导入受测者信息..."); } for (int i = 0; i < testInfoList.Count; i++) { Model.TB_TestInfo testInfoModel = testInfoList[i]; testInfoModel.Ath_ID = athDict[testInfoModel.Ath_ID]; testInfoBLL.Add(testInfoModel); int newID = testInfoBLL.GetMaxId(); string dataFileFullName = AppPath.XmlDataDirPath + testInfoModel.DataFileName; string oldFileName = testInfoModel.DataFileName; if (File.Exists(dataFileFullName)) { testInfoModel.DataFileName = DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".xml"; } File.Copy(tempExtrctorPath + oldFileName, AppPath.XmlDataDirPath + testInfoModel.DataFileName); testInfoDict.Add(testInfoModel.ID, newID); UpdateMergeState(Percent(i + 1, testInfoList.Count), "正在导入测试信息..."); } for (int i = 0; i < refeList.Count; i++) { Model.TB_StandTestRefe refeModel = refeList[i]; refeModel.StandID = standDict[refeModel.StandID]; refeModel.TestID = testInfoDict[refeModel.TestID]; refeBLL.Add(refeModel); UpdateMergeState(Percent(i + 1, refeList.Count), "正在重设数据关系..."); } Directory.Delete(tempExtrctorPath, true); UpdateMergeState(-2, "数据合并完成"); }