예제 #1
0
        /// <summary>
        /// 加载sql配置方案树
        /// </summary>
        /// <param name="tree"></param>
        public static void LoadSqlSchema(AdvTree tree, String selectValue)
        {
            tree.Nodes.Clear();
            Node nodeRoot = new Node();

            nodeRoot.Name     = "ROOT_" + Guid.NewGuid().ToString();
            nodeRoot.Text     = "所有SQL方案";
            nodeRoot.Expanded = true;
            tree.Nodes.Add(nodeRoot);

            XmlDocument doc = new XmlDocument();

            doc.Load(MsqlConfigXmlPath);
            List <XmlNode>
            nodeList = doc.SelectNodes("//SqlSchema").ToList <XmlNode>();

            foreach (XmlNode node in nodeList)
            {
                String          id              = node.Attributes["ID"].Value;
                String          name            = node.Attributes["Name"].Value;
                SqlSchemaEntity sqlSchemaEntity = new SqlSchemaEntity();
                sqlSchemaEntity.ID   = id;
                sqlSchemaEntity.Name = name;
                Node nodeChild = new Node();
                nodeChild.Name = "SCHEMA_" + id;
                nodeChild.Text = name;
                nodeChild.Tag  = sqlSchemaEntity;
                nodeRoot.Nodes.Add(nodeChild);

                if (selectValue.Equals(id))
                {
                    tree.SelectNode(nodeChild, eTreeAction.Mouse);
                }
            }
        }
예제 #2
0
        public static void CreateDepartment(AdvTree tree, Node nodeParent, String departmentSelectValue, String userSelectValue)
        {
            String url      = StaticValue.ServicePath.DepartmentPath;
            String userName = StaticValue.ServicePath.UserName;
            String passWord = StaticValue.ServicePath.PassWord;
            String result   = RestUserLoginService.Get(url, "", userName, passWord);
            List <DepartmentEntity> departmentList = JsonConvert.DeserializeObject <List <DepartmentEntity> >(result);

            List <DepartmentEntity> firstNodeDepartment
                = departmentList.Where(o => String.IsNullOrEmpty(o.Pid)).ToList();

            LoadAllDepartment(departmentList, firstNodeDepartment, nodeParent, departmentSelectValue, userSelectValue);
            tree.Nodes.Add(nodeParent);
            tree.SelectNode(nodeSelect, eTreeAction.Mouse);
        }
예제 #3
0
        /// <summary>
        /// 获取所有自动化测试方案
        /// </summary>
        /// <param name="tree"></param>
        public static void GetAllSeleniumSchema(AdvTree tree, String selectNodeId)
        {
            tree.Nodes.Clear();
            Node nodeRoot = new Node();

            nodeRoot.Name = "ROOT_" + Guid.NewGuid().ToString();
            nodeRoot.Text = " 所有测试方案";
            Node        selectNode = null;
            XmlDocument doc        = new XmlDocument();

            doc.Load(MSeleniumSchemaPath);
            nodeRoot.Expanded = true;
            List <XmlNode> nodeList = doc.SelectNodes("//Schema").ToList <XmlNode>();

            if (nodeList.Count > 0)
            {
                nodeList.ForEach(o =>
                {
                    SeleniumSchemaEntity seleniumSchemaEntity = new SeleniumSchemaEntity();
                    seleniumSchemaEntity.Id        = o.Attributes["ID"].Value;
                    seleniumSchemaEntity.Name      = o.Attributes["Name"].Value;
                    seleniumSchemaEntity.IsExecute = o.Attributes["Execute"] != null && Convert.ToBoolean(o.Attributes["Execute"].Value);

                    Node nodeChild = new Node();
                    nodeChild.Name = "SCHEMA_" + seleniumSchemaEntity.Id;
                    nodeChild.Text = seleniumSchemaEntity.Name;
                    nodeChild.Tag  = seleniumSchemaEntity;
                    if (selectNodeId.Equals(seleniumSchemaEntity.Id))
                    {
                        selectNode = nodeChild;
                    }

                    if (seleniumSchemaEntity.IsExecute)
                    {
                        ElementStyle style = new ElementStyle();
                        style.TextColor    = Color.Red;
                        nodeChild.Style    = style;
                        nodeChild.Text     = nodeChild.Text + "(执行方案)";
                    }
                    nodeRoot.Nodes.Add(nodeChild);
                });
            }
            tree.Nodes.Add(nodeRoot);
            if (selectNode != null) //选中节点
            {
                tree.SelectNode(selectNode, eTreeAction.Mouse);
            }
        }