103 lines
3.0 KiB
C#
103 lines
3.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Xml;
|
|
|
|
namespace VRS.Management
|
|
{
|
|
public partial class ZTest : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
//save_xml();
|
|
//赋值
|
|
// RadEditor1.Content = model.content;
|
|
//保存
|
|
//model.content = RadEditor1.Content;
|
|
}
|
|
}
|
|
|
|
public void get_json()
|
|
{
|
|
|
|
}
|
|
|
|
public static List<PersonOM> GetResult()
|
|
{
|
|
List<PersonOM> lstPs = new List<PersonOM>();
|
|
PersonOM ps = null;
|
|
for (int i = 1; i <= 10; i++)
|
|
{
|
|
ps = new PersonOM();
|
|
ps.Name = "Name" + i;
|
|
ps.Age = 20 + i;
|
|
lstPs.Add(ps);
|
|
}
|
|
return lstPs;
|
|
}
|
|
|
|
|
|
public List<PersonOM> GetResult2()
|
|
{
|
|
return ZTest.GetResult();
|
|
}
|
|
|
|
public class PersonOM
|
|
{
|
|
public string Name { get; set; }
|
|
|
|
public int Age { get; set; }
|
|
}
|
|
|
|
/*
|
|
public void save_xml()
|
|
{
|
|
string path = @"D:\Temp\test.xml";
|
|
if (!File.Exists(path))
|
|
{
|
|
var stream = File.Create(path);
|
|
stream.Close();
|
|
}
|
|
|
|
XmlDocument xmlDoc = new XmlDocument();//新建XML文件
|
|
xmlDoc.Load(path);//加载XML文件
|
|
//XmlNode xm = xmlDoc.SelectSingleNode("RFI");
|
|
//XmlElement xelKey = xmlDoc.CreateElement("RFIID");
|
|
//XmlAttribute xelType = xmlDoc.CreateAttribute("Type");
|
|
//xelType.InnerText = "data";
|
|
//xelKey.SetAttributeNode(xelType);
|
|
//XmlElement xelAuthor = xmlDoc.CreateElement("author");
|
|
//xelKey.InnerText = "dfdsa";
|
|
//xm.AppendChild(xelKey);
|
|
//xmlDoc.Save(path);
|
|
|
|
var temp = xmlDoc.GetElementsByTagName("RFI");
|
|
//var element =xmlDoc.CreateElement("RFIID2");
|
|
var element = xmlDoc.GetElementById("id_rfid");
|
|
if (null == element)
|
|
{
|
|
XmlAttribute xelType = xmlDoc.CreateAttribute("Type");
|
|
xelType.InnerText = "data";
|
|
element.SetAttributeNode(xelType);
|
|
|
|
XmlAttribute xelType2 = xmlDoc.CreateAttribute("Flag");
|
|
xelType.InnerText = "1";
|
|
element.SetAttributeNode(xelType2);
|
|
}
|
|
|
|
element.InnerText = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
|
xmlDoc.DocumentElement.AppendChild(element);
|
|
xmlDoc.Save(path);
|
|
}
|
|
*/
|
|
|
|
}
|
|
|
|
} |