The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
one day
Posted by: LINQ xpath w/e | April 4, 2011 @ 10:49am
C# Code
[
Download
]
public ContentResult CheckUpdates(string id) { List<string> list = new List<string>(); var db = new BariumUpdateServerdbDataContext(); var q = from cw in db.ClientWorkers from c in db.Clients from w in db.Workers where cw.ClientId == c.Id where cw.WorkerId == w.Id where c.ClientGuid == id select w.WorkerId; var xdoc = new XmlDocument(); XmlElement elem = xdoc.CreateElement("Workers"); xdoc.AppendChild(elem); XmlElement time = xdoc.CreateElement("LastUpdate"); XmlText timeValue = xdoc.CreateTextNode(DateTime.Now.ToString()); elem.AppendChild(time); time.AppendChild(timeValue); foreach (var i in q) { list.Add(i); foreach (string xelement in list) { XmlElement ele = xdoc.CreateElement("Worker"); XmlText xTxt = xdoc.CreateTextNode(i); elem.AppendChild(ele); ele.AppendChild(xTxt); } var q1 = from w in db.Workers where w.WorkerId == i select w.Id; foreach (var p in q1) { var q2 = (from wp in db.WorkerParameters where wp.Id == p select new { wp.Type, wp.KeyName }); foreach (var item in q2) { XmlElement param = xdoc.CreateElement("Paramters"); XmlElement paramText = xdoc.CreateElement(item.KeyName); XmlAttribute Type = xdoc.CreateAttribute(item.Type); elem.AppendChild(param); param.AppendChild(paramText); paramText.SetAttributeNode(Type); } } } return Content(xdoc.InnerXml.ToString(), "text/xml"); }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.50 / 8
167 Votes
http://codebin.yi.org/1198
page generated in 0.00 seconds