You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.5 KiB
C#
102 lines
2.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Xml;
|
|
|
|
namespace VOL.Entity.DomainModels
|
|
{
|
|
class PubFunction
|
|
{
|
|
|
|
}
|
|
|
|
public class XmlHelp
|
|
{
|
|
///<summary>
|
|
/// 编写报文内容
|
|
///</summary>
|
|
/// <param name="Father">父节点名称</param>
|
|
/// <param name="doc">xmldocument类型</param>
|
|
/// <param name="NodeName">要插入的子节点名称</param>
|
|
/// <param name="text">子节点内容</param>
|
|
public void CreateChild(XmlElement Father, XmlDocument doc, string NodeName, object text)
|
|
{
|
|
XmlElement ChildName = doc.CreateElement("" + NodeName + "");
|
|
if (text != null)
|
|
{
|
|
ChildName.InnerText = text.ToString();
|
|
}
|
|
Father.AppendChild(ChildName);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public class el_cascader {
|
|
public string id { get; set; }
|
|
public string name { get; set; }
|
|
|
|
public string pid { get; set; }
|
|
public List<el_cascader> children { get; set; }
|
|
|
|
public el_cascader() {
|
|
children = new List<el_cascader>();
|
|
}
|
|
|
|
public el_cascader(string id, string pid, string name) {
|
|
this.id = id;
|
|
this.pid = pid;
|
|
this.name = name;
|
|
}
|
|
|
|
public void addnode(el_cascader newnode) {
|
|
if (children == null || children.Count == 0) return;
|
|
|
|
if (id == newnode.pid)
|
|
{
|
|
if (!children.Exists(x => x.id == newnode.id))
|
|
{
|
|
children.Add(newnode);
|
|
}
|
|
}
|
|
else {
|
|
foreach (var item in children) {
|
|
item.addnode(newnode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class el_cascader_tree {
|
|
private List<el_cascader> treelist{ get; set; }
|
|
|
|
public el_cascader_tree() {
|
|
treelist = new List<el_cascader>();
|
|
}
|
|
|
|
public void addnode(string id, string pid, string name) {
|
|
var newnode = new el_cascader(id, pid, name);
|
|
|
|
if (string.IsNullOrWhiteSpace(pid))
|
|
{
|
|
if (!treelist.Exists(x => x.id == newnode.id))
|
|
{
|
|
treelist.Add(newnode);
|
|
}
|
|
}
|
|
else {
|
|
foreach (var item in treelist) {
|
|
item.addnode(newnode);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public List<el_cascader> gettreelist() {
|
|
return treelist;
|
|
}
|
|
}
|
|
|
|
|
|
}
|