Beispiel #1
0
        /// <summary>
        /// 获取基础框架,包括自动义
        /// </summary>
        /// <returns></returns>
        public static List <caseFramework> getBaseFrameworks()
        {
            int userID = getUserID();
            List <caseFramework> cfs = frameworkHelp.getAutoFramework();


            QCTESTEntities QC_DB = new QCTESTEntities();

            caseFramework cf = QC_DB.caseFramework.FirstOrDefault(t => t.userID == userID);

            if (cf != null)
            {
                cfs.Add(cf);
            }

            return(cfs);
        }
        /// <summary>
        /// 框架xml转换成前台显示的treeStep
        /// </summary>
        /// <param name="cf"></param>
        /// <returns></returns>
        public static treeViewModel getControlJson4Tree(this caseFramework cf)
        {
            XElement xe = XElement.Parse(cf.controlXML);


            var root = new frameTreeNode();

            root.text  = cf.workName;
            root.state = "open";
            root.FID   = cf.ID;

            root.children = new List <treeViewModel>();

            var sms = xe.Descendants("Step");

            foreach (var e in sms)
            {
                scriptStepTreeModel tv = new scriptStepTreeModel();

                tv.FID = cf.ID;
                //tv.PID = null;
                tv.state   = "open";
                tv.name    = e.Attribute("name").Value;//name肯定有把....
                tv.iconCls = "icon-view_outline_detail";

                if (e.Attribute("desc") != null)
                {
                    tv.desc = e.Attribute("desc").Value;
                }


                root.children.Add(tv);
            }



            return(root);
        }