コード例 #1
0
ファイル: TestManager.xaml.cs プロジェクト: dewade2003/DSJL
        public void RefrenshList()
        {
            testManagerBLL = new BLL.TB_TestManager();
            testItmesListBox.ItemsSource = testList = testManagerBLL.GetModelList("");

            //如果设置了测试项目,则选中设置的测试项目
            int index = -1;

            if (testItem != null)
            {
                index = testList.FindIndex(x => x.ID == testItem.ID);
            }
            else if (testList.Count > 0)
            {
                index = 0;
            }

            if (selectedTestItemIndex >= 0 && testItem == null)
            {
                testItmesListBox.SelectedIndex = selectedTestItemIndex;
            }
            else
            {
                testItmesListBox.SelectedIndex = index;
            }
        }
コード例 #2
0
ファイル: TestManager.xaml.cs プロジェクト: dewade2003/DSJL
        public void RefrenshList()
        {
            testManagerBLL = new BLL.TB_TestManager();
            testItmesListBox.ItemsSource = testList = testManagerBLL.GetModelList("");

            //如果设置了测试项目,则选中设置的测试项目
            int index = -1;

            if (testItem != null)
            {
                index = testList.FindIndex(x => x.ID == testItem.ID);
            }
            else if (testList.Count>0)
            {
                index = 0;
            }

            if (selectedTestItemIndex >= 0 && testItem == null)
            {
                testItmesListBox.SelectedIndex = selectedTestItemIndex;
            }
            else
            {
                testItmesListBox.SelectedIndex = index;
            }
        }
コード例 #3
0
 private void Window_ContentRendered(object sender, System.EventArgs e)
 {
     if (!ChooseBackupPath())
     {
         this.Close();
     }
     else
     {
         testManagerList = testManagerBLL.GetModelList("");
         testItmesListBox.SetBinding(ListBox.ItemsSourceProperty, new Binding()
         {
             Source = testManagerList
         });
     }
 }
コード例 #4
0
ファイル: ImportAthlete.xaml.cs プロジェクト: dewade2003/DSJL
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            AddTestItemWindow addWindow = new AddTestItemWindow();

            addWindow.Owner = this;
            if (addWindow.ShowDialog() == true)
            {
                testList = testManagerBLL.GetModelList("");
                Binding b = new Binding()
                {
                    Source = testList
                };
                cbTestItems.SetBinding(ComboBox.ItemsSourceProperty, b);
                cbTestItems.SelectedIndex = 0;
            }
        }
コード例 #5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            testList = testManagerBLL.GetModelList("");
            Binding b = new Binding()
            {
                Source = testList
            };

            cbTestItems.SetBinding(ComboBox.ItemsSourceProperty, b);
            List <string> addresslist = athleteBLL.GetColumnDistinctList("Ath_TestAddress");

            txtTestAddress.ItemsSource = addresslist;
            List <string> teststatelist = athleteBLL.GetColumnDistinctList("Ath_TestState");

            txtTestState.ItemsSource = teststatelist;


            if (isEdit)
            {
                tbTitle.Text = "编辑" + athlete.Ath_Name + "信息";
            }
            else
            {
                athlete.Ath_TestMachine = "Isomed2000";
                if (addresslist.Count > 0)
                {
                    athlete.Ath_TestAddress = addresslist[0];
                }
                if (teststatelist.Count > 0)
                {
                    athlete.Ath_TestState = teststatelist[0];
                }
            }
            if (currentAthInfo != null)
            {
                athlete.Ath_Name     = currentAthInfo.Ath_Name;
                athlete.Ath_PinYin   = currentAthInfo.Ath_PinYin;
                athlete.Ath_Height   = currentAthInfo.Ath_Height;
                athlete.Ath_Weight   = currentAthInfo.Ath_Weight;
                athlete.Ath_Birthday = currentAthInfo.Ath_Birthday == null ? DateTime.Now : currentAthInfo.Ath_Birthday;
                athlete.Ath_TestDate = currentAthInfo.Ath_TestDate;
            }

            SetBind();
        }
コード例 #6
0
ファイル: ImportAthlete.xaml.cs プロジェクト: dewade2003/DSJL
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            testManagerBLL = new BLL.TB_TestManager();
            athInfoBLL     = new BLL.TB_AthleteInfo();
            testList       = testManagerBLL.GetModelList("");
            Binding b = new Binding()
            {
                Source = testList
            };

            cbTestItems.SetBinding(ComboBox.ItemsSourceProperty, b);
            if (testItem == null)
            {
                cbTestItems.SelectedIndex = 0;
            }
            else
            {
                cbTestItems.SelectedIndex = testList.FindIndex(x => x.ID == testItem.ID);
            }
        }
コード例 #7
0
ファイル: ImportAthlete.xaml.cs プロジェクト: dewade2003/DSJL
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     testManagerBLL = new BLL.TB_TestManager();
     athInfoBLL = new BLL.TB_AthleteInfo();
     testList = testManagerBLL.GetModelList("");
     Binding b = new Binding() { Source = testList };
     cbTestItems.SetBinding(ComboBox.ItemsSourceProperty, b);
     if (testItem == null)
     {
         cbTestItems.SelectedIndex = 0;
     }
     else {
         cbTestItems.SelectedIndex = testList.FindIndex(x => x.ID == testItem.ID);
     }
 }
コード例 #8
0
ファイル: MergeDB.xaml.cs プロジェクト: dewade2003/DSJL
        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, "数据合并完成");
        }
コード例 #9
0
ファイル: MergeDB.xaml.cs プロジェクト: dewade2003/DSJL
        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, "数据合并完成");
        }