public AddToStandardWindow() { InitializeComponent(); testInfoModelList = new List<Model.TestInfoModel>(); standBLL = new BLL.TB_StandardInfo(); refeBLL = new BLL.TB_StandTestRefe(); standList = new List<Model.TB_StandardInfo>(); }
public AddToStandardWindow() { InitializeComponent(); testInfoModelList = new List <Model.TestInfoModel>(); standBLL = new BLL.TB_StandardInfo(); refeBLL = new BLL.TB_StandTestRefe(); standList = new List <Model.TB_StandardInfo>(); }
public AddOrUpdateLevel2() { InitializeComponent(); standardInfoBLL = new BLL.TB_StandardInfo(); standardParamsBLL = new BLL.TB_StandardParams(); athInfoBLL = new BLL.TB_AthleteInfo(); Model.TB_Dict allDict = new Model.TB_Dict() { Dict_Key = "-1", Dict_Value = "不限" }; jointDictList = dictBLL.GetModelListByGroupID(2); jointDictList.Insert(0, allDict); jointsideDictList = dictBLL.GetModelListByGroupID(3); jointsideDictList.Insert(0, allDict); testmodeDictList = dictBLL.GetModelListByGroupID(1); testmodeDictList.Insert(0, allDict); }
List<Model.TB_Dict> testmodeDictList; //测试模式字典列表 #endregion Fields #region Constructors public AddOrUpdateLevel2() { InitializeComponent(); standardInfoBLL = new BLL.TB_StandardInfo(); standardParamsBLL = new BLL.TB_StandardParams(); athInfoBLL = new BLL.TB_AthleteInfo(); Model.TB_Dict allDict = new Model.TB_Dict() { Dict_Key = "-1", Dict_Value = "不限" }; jointDictList = dictBLL.GetModelListByGroupID(2); jointDictList.Insert(0, allDict); jointsideDictList = dictBLL.GetModelListByGroupID(3); jointsideDictList.Insert(0, allDict); testmodeDictList = dictBLL.GetModelListByGroupID(1); testmodeDictList.Insert(0, allDict); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { standardBLL = new BLL.TB_StandardInfo(); if (treeModelCollection.Count == 0) { rootModel.IsExpanded = true; rootModel.DefaultIcon = "/DSJL;component/Assets/Images/folder.png"; rootModel.OpenedIcon = "/DSJL;component/Assets/Images/folder_opened.png"; rootModel.StandInfo = new Model.TB_StandardInfo() { Stand_Name = "参考值类别", Stand_Level = -1 }; rootModel.IsChecked = true; LoadStandInfo(); } tree.Focus(); selectedItem = null; ItemSelectionChangedEvent(selectedItem); }
//导出报告 private void btnExportReport_Click(object sender, RoutedEventArgs e) { //foreach (Model.TestInfoModel model in TestInfoModelList) //{ // model.IsChecked = true; //} //RefrenshChart(); try { //生成数据xml对象,供导出报告使用 //string title = "平均曲线对比-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //DSJL.Export.GenerateAvgReportXML garxml = new DSJL.Export.GenerateAvgReportXML(); //garxml.CurrentTitle = "平均曲线对比报告"; //garxml.TestInfoModelList = TestInfoModelList; //System.Xml.Linq.XDocument xdoc = garxml.Generate(); //System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); //fbd.Description = "选择保存报告的位置"; //fbd.ShowNewFolderButton = true; //if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) //{ // //生成平均曲线图片 // DSJL.Export.SaveUIElementToImage.SaveToImage(avgPanel, AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); // //开始导出 // DSJL.Export.ExportAvgReport exportReport = new DSJL.Export.ExportAvgReport(xdoc); // exportReport.Export(fbd.SelectedPath + "\\" + title + ".pdf"); // //删除平均曲线图片 // File.Delete(AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); // MessageBox.Show("导出成功!", "系统信息"); //} List <Model.TestInfoModel> testInfoModelList = GetSortedTestInfoModelList(); string pdfFileName = ""; string reportTitle = ""; string standName = ""; DSJL.Export.ExportModeEnum exportMode = DSJL.Export.ExportModeEnum.Mode1; if (rbMode1.IsChecked == true)//互相对比报告 { exportMode = DSJL.Export.ExportModeEnum.Mode1; pdfFileName = "等速肌力互相对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; reportTitle = "等速肌力互相对比报告"; } else if (rbMode2.IsChecked == true)//与平均曲线对比报告 { exportMode = DSJL.Export.ExportModeEnum.Mode2; pdfFileName = "等速肌力个人与平均曲线报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; reportTitle = "等速肌力个人与平均曲线报告"; } else if (rbMode3.IsChecked == true)//与参考值对比报告 { if (stand.SelectedItem == null) { MessageBox.Show("请选择测试参考值!", "系统信息"); return; } else { standName = stand.SelectedItem.Stand_Name; } exportMode = DSJL.Export.ExportModeEnum.Mode3; BLL.TB_StandardInfo standInfoBLL = new BLL.TB_StandardInfo(); Model.TB_StandardInfo parentStandInfo = standInfoBLL.GetModel((int)stand.SelectedItem.Stand_ParentID); foreach (Model.TestInfoModel testInfoModel in testInfoModelList) { pdfFileName += testInfoModel.Ath_Name; } pdfFileName += "与" + parentStandInfo.Stand_Name + stand.SelectedItem.Stand_Name + "对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; //pdfFileName = "等速肌力个人与参考值对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; reportTitle = "等速肌力个人与参考值对比报告"; } System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog(); saveFileDialog.AddExtension = true; saveFileDialog.OverwritePrompt = true; saveFileDialog.Title = "选择保存报告的位置"; saveFileDialog.FileName = pdfFileName; saveFileDialog.DefaultExt = "pdf"; saveFileDialog.Filter = "PDF文件(*.pdf)|*.pdf"; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //生成数据xml对象,供导出报告使用 DSJL.Export.GenerateCompareResportXml garxml = new DSJL.Export.GenerateCompareResportXml(exportMode); garxml.CurrentTitle = reportTitle; garxml.TestInfoModelList = GetSortedTestInfoModelList(); garxml.StandardTestInfoModelList = standTestInfoModelList; garxml.StandName = standName; System.Xml.Linq.XDocument xdoc = garxml.GenerateXDoc(); //生成平均曲线图片 DSJL.Export.SaveUIElementToImage.SaveToImage(avgPanel, AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); //开始导出 DSJL.Export.ExportCompareReport exportReport = new DSJL.Export.ExportCompareReport(xdoc); exportReport.Export(saveFileDialog.FileName); //删除平均曲线图片 File.Delete(AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); MessageBox.Show("导出成功!", "系统信息"); } } catch (Exception ee) { MessageBox.Show("导出出错!\r\n" + ee.Message, "系统错误"); } }
//导出报告 private void btnExportReport_Click(object sender, RoutedEventArgs e) { //foreach (Model.TestInfoModel model in TestInfoModelList) //{ // model.IsChecked = true; //} //RefrenshChart(); try { //生成数据xml对象,供导出报告使用 //string title = "平均曲线对比-" + DateTime.Now.ToString("yyyyMMddHHmmss"); //DSJL.Export.GenerateAvgReportXML garxml = new DSJL.Export.GenerateAvgReportXML(); //garxml.CurrentTitle = "平均曲线对比报告"; //garxml.TestInfoModelList = TestInfoModelList; //System.Xml.Linq.XDocument xdoc = garxml.Generate(); //System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog(); //fbd.Description = "选择保存报告的位置"; //fbd.ShowNewFolderButton = true; //if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) //{ // //生成平均曲线图片 // DSJL.Export.SaveUIElementToImage.SaveToImage(avgPanel, AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); // //开始导出 // DSJL.Export.ExportAvgReport exportReport = new DSJL.Export.ExportAvgReport(xdoc); // exportReport.Export(fbd.SelectedPath + "\\" + title + ".pdf"); // //删除平均曲线图片 // File.Delete(AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); // MessageBox.Show("导出成功!", "系统信息"); //} List<Model.TestInfoModel> testInfoModelList = GetSortedTestInfoModelList(); string pdfFileName = ""; string reportTitle = ""; string standName = ""; DSJL.Export.ExportModeEnum exportMode = DSJL.Export.ExportModeEnum.Mode1; if (rbMode1.IsChecked == true)//互相对比报告 { exportMode = DSJL.Export.ExportModeEnum.Mode1; pdfFileName = "等速肌力互相对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; reportTitle = "等速肌力互相对比报告"; } else if (rbMode2.IsChecked == true)//与平均曲线对比报告 { exportMode = DSJL.Export.ExportModeEnum.Mode2; pdfFileName = "等速肌力个人与平均曲线报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; reportTitle = "等速肌力个人与平均曲线报告"; } else if (rbMode3.IsChecked == true)//与参考值对比报告 { if (stand.SelectedItem == null) { MessageBox.Show("请选择测试参考值!", "系统信息"); return; } else { standName = stand.SelectedItem.Stand_Name; } exportMode = DSJL.Export.ExportModeEnum.Mode3; BLL.TB_StandardInfo standInfoBLL = new BLL.TB_StandardInfo(); Model.TB_StandardInfo parentStandInfo = standInfoBLL.GetModel((int)stand.SelectedItem.Stand_ParentID); foreach (Model.TestInfoModel testInfoModel in testInfoModelList) { pdfFileName += testInfoModel.Ath_Name; } pdfFileName += "与" + parentStandInfo.Stand_Name + stand.SelectedItem.Stand_Name + "对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; //pdfFileName = "等速肌力个人与参考值对比报告(" + DateTime.Now.ToString("yyyyMMddHHmmss") + ")"; reportTitle = "等速肌力个人与参考值对比报告"; } System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog(); saveFileDialog.AddExtension = true; saveFileDialog.OverwritePrompt = true; saveFileDialog.Title = "选择保存报告的位置"; saveFileDialog.FileName = pdfFileName; saveFileDialog.DefaultExt = "pdf"; saveFileDialog.Filter = "PDF文件(*.pdf)|*.pdf"; if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { //生成数据xml对象,供导出报告使用 DSJL.Export.GenerateCompareResportXml garxml = new DSJL.Export.GenerateCompareResportXml(exportMode); garxml.CurrentTitle = reportTitle; garxml.TestInfoModelList = GetSortedTestInfoModelList(); garxml.StandardTestInfoModelList = standTestInfoModelList; garxml.StandName = standName; System.Xml.Linq.XDocument xdoc = garxml.GenerateXDoc(); //生成平均曲线图片 DSJL.Export.SaveUIElementToImage.SaveToImage(avgPanel, AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); //开始导出 DSJL.Export.ExportCompareReport exportReport = new DSJL.Export.ExportCompareReport(xdoc); exportReport.Export(saveFileDialog.FileName); //删除平均曲线图片 File.Delete(AppDomain.CurrentDomain.BaseDirectory + "avg.jpg"); MessageBox.Show("导出成功!", "系统信息"); } } catch (Exception ee) { MessageBox.Show("导出出错!\r\n" + ee.Message, "系统错误"); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { standardBLL = new BLL.TB_StandardInfo(); if (treeModelCollection.Count==0) { rootModel.IsExpanded = true; rootModel.DefaultIcon = "/DSJL;component/Assets/Images/folder.png"; rootModel.OpenedIcon = "/DSJL;component/Assets/Images/folder_opened.png"; rootModel.StandInfo = new Model.TB_StandardInfo() { Stand_Name = "参考值类别", Stand_Level = -1 }; rootModel.IsChecked = true; LoadStandInfo(); } tree.Focus(); selectedItem = null; ItemSelectionChangedEvent(selectedItem); }
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, "数据合并完成"); }