-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTemplateVariant.cs
60 lines (54 loc) · 1.93 KB
/
TemplateVariant.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace RustyLogic.RedDotNet
{
public class TemplateVariant : RedDotObject
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
protected TemplateVariant(XmlNode xmlNode) : base(xmlNode) { }
protected TemplateVariant(Guid guid) : base(guid) { }
protected override void LoadBasics(XmlNode xmlNode)
{
_name = xmlNode.Attributes.GetNamedItem("name").Value;
}
protected override XmlNode LoadXml()
{
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<TEMPLATE>" +
"<TEMPLATEVARIANT action=\"load\" guid=\"" + GuidString + "\" readonly=\"1\"/>" +
"</TEMPLATE>" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
return xmlDoc.GetElementsByTagName("TEMPLATEVARIANT")[0];
}
public static List<TemplateVariant> List(Template template)
{
List<TemplateVariant> variants = new List<TemplateVariant>();
string rqlStatement =
"<IODATA>" +
"<PROJECT>" +
"<TEMPLATE guid=\"" + template.GuidString + "\">" +
"<TEMPLATEVARIANTS action=\"list\" />" +
"</TEMPLATE>" +
"</PROJECT>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
XmlNodeList xmlNodes = xmlDoc.GetElementsByTagName("TEMPLATEVARIANT");
foreach (XmlNode xmlNode in xmlNodes)
{
variants.Add(new TemplateVariant(xmlNode));
}
return variants;
}
}
}