Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public void RefrenshChildren()
        {
            children.Clear();
            List <Model.TB_StandardInfo> standInfoModelList;

            switch (standInfo.Stand_Level)
            {
            case -1:
                standInfoModelList = standInfoBLL.GetModelList("stand_level=1");
                foreach (Model.TB_StandardInfo standInfoModel in standInfoModelList)
                {
                    StandInfoTreeDataModel treeModel = new StandInfoTreeDataModel();
                    treeModel.parentModel = this;
                    treeModel.StandInfo   = standInfoModel;
                    treeModel.DefaultIcon = "/DSJL;component/Assets/Images/folder.png";
                    treeModel.OpenedIcon  = "/DSJL;component/Assets/Images/folder_opened.png";
                    children.Add(treeModel);
                }
                break;

            case 1:
                standInfoModelList = standInfoBLL.GetModelList("stand_level=2 and Stand_ParentID=" + standInfo.ID);
                foreach (Model.TB_StandardInfo standInfoModel in standInfoModelList)
                {
                    StandInfoTreeDataModel treeModel = new StandInfoTreeDataModel();
                    treeModel.parentModel = this;
                    treeModel.StandInfo   = standInfoModel;
                    treeModel.DefaultIcon = "/DSJL;component/Assets/Images/file.png";
                    treeModel.OpenedIcon  = "/DSJL;component/Assets/Images/file.png";
                    children.Add(treeModel);
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            standList = standBLL.GetModelList("");
            List <Model.TB_StandardInfo> standListLevel1 = standList.FindAll(x => x.Stand_Level == 1);

            lbLevel1.ItemsSource = standListLevel1;

            //lbLevel1.SelectedIndex = 0;
            lbLevel1.SelectedIndex = -1;
            if (selectStandInfo1 != null)
            {
                for (int i = 0; i < standListLevel1.Count; i++)
                {
                    if (standListLevel1[i].ID == selectStandInfo1.ID)
                    {
                        lbLevel1.SelectedIndex = i;
                        break;
                    }
                }
            }
            if (selectStandInfo2 != null)
            {
                for (int i = 0; i < standListLevel1.Count; i++)
                {
                    if (standListLevel1[i].ID == selectStandInfo2.Stand_ParentID)
                    {
                        lbLevel1.SelectedIndex = i;
                        break;
                    }
                }
            }
            if (lbLevel1.SelectedIndex == -1)
            {
                lbLevel1.SelectedIndex = 0;
            }

            //lbLevel1.SelectedValue = selectStandInfo1;
        }
Ejemplo n.º 3
0
        public void LoadStandInfo()
        {
            rootModel.Children.Clear();
            treeModelCollection.Clear();

            List <Model.TB_StandardInfo> standInfoList = standardBLL.GetModelList("");

            Task task = new Task(() =>
            {
                //加载导入的测试参考值
                List <Model.TB_StandardInfo> importedlevel1List = Stand.StandConfig.GetParentStandList();
                if (importedlevel1List != null)
                {
                    foreach (var item in importedlevel1List)
                    {
                        StandInfoTreeDataModel treeModel = new StandInfoTreeDataModel();
                        treeModel.ParentModel            = rootModel;
                        treeModel.StandInfo   = item;
                        treeModel.DefaultIcon = "/DSJL;component/Assets/Images/folder.png";
                        treeModel.OpenedIcon  = "/DSJL;component/Assets/Images/folder_opened.png";

                        List <Model.TB_StandardInfo> importedChildList = Stand.StandConfig.GetChildStandInfo(item.Stand_Name);
                        foreach (var item2 in importedChildList)
                        {
                            StandInfoTreeDataModel childTreeModel = new StandInfoTreeDataModel();
                            childTreeModel.ParentModel            = treeModel;
                            childTreeModel.StandInfo   = item2;
                            childTreeModel.DefaultIcon = "/DSJL;component/Assets/Images/file.png";
                            childTreeModel.OpenedIcon  = "/DSJL;component/Assets/Images/file.png";

                            treeModel.Children.Add(childTreeModel);
                        }
                        item.Stand_Name += "(导入)";
                        rootModel.Children.Add(treeModel);
                    }
                }

                var level1List = from items in standInfoList where items.Stand_Level == 1 orderby items.ID select items;
                var level2List = from items in standInfoList where items.Stand_Level == 2 orderby items.ID select items;
                foreach (var item in level1List)
                {
                    StandInfoTreeDataModel treeModel = new StandInfoTreeDataModel();
                    treeModel.ParentModel            = rootModel;
                    treeModel.StandInfo   = item;
                    treeModel.DefaultIcon = "/DSJL;component/Assets/Images/folder.png";
                    treeModel.OpenedIcon  = "/DSJL;component/Assets/Images/folder_opened.png";

                    var childList = from standItem in level2List where standItem.Stand_ParentID == item.ID select standItem;

                    foreach (var item2 in childList)
                    {
                        StandInfoTreeDataModel childTreeModel = new StandInfoTreeDataModel();
                        childTreeModel.ParentModel            = treeModel;
                        childTreeModel.StandInfo   = item2;
                        childTreeModel.DefaultIcon = "/DSJL;component/Assets/Images/file.png";
                        childTreeModel.OpenedIcon  = "/DSJL;component/Assets/Images/file.png";

                        treeModel.Children.Add(childTreeModel);
                    }
                    rootModel.Children.Add(treeModel);
                }
                this.Dispatcher.Invoke(new Action(() =>
                {
                    treeModelCollection.Add(rootModel);
                    tree.ItemsSource = treeModelCollection;
                }));
            });

            task.Start();
        }
Ejemplo n.º 4
0
        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, "数据合并完成");
        }
Ejemplo n.º 5
0
        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, "数据合并完成");
        }