-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProject.cs
110 lines (99 loc) · 3.91 KB
/
Project.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
namespace RustyLogic.RedDotNet
{
public class Project : RedDotObject
{
private string _name;
public string Name
{
get { return _name; }
set { _name = value; }
}
protected Project(XmlNode xmlNode) : base(xmlNode) { }
public Project(Guid guid) : base(guid) { }
protected override void LoadBasics(XmlNode xmlNode)
{
_name = xmlNode.Attributes.GetNamedItem("name").Value;
}
protected override XmlNode LoadXml()
{
string rqlStatement =
"<IODATA>" +
"<ADMINISTRATION>" +
"<PROJECT action=\"load\" guid=\"" + GuidString + "\"/>" +
"</ADMINISTRATION>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement));
return xmlDoc.GetElementsByTagName("PROJECT")[0];
}
public void Select()
{
Session.SelectProject(Guid);
}
public static List<Project> List()
{
List<Project> projects = new List<Project>();
string rqlStatement =
"<IODATA>" +
"<ADMINISTRATION>" +
"<PROJECTS action=\"list\"/>" +
"</ADMINISTRATION>" +
"</IODATA>";
xmlDoc.LoadXml(Session.Execute(rqlStatement, Session.Info.LoginGuid));
XmlNodeList xmlNodes = xmlDoc.GetElementsByTagName("PROJECT");
foreach (XmlNode xmlNode in xmlNodes)
{
projects.Add(new Project(xmlNode));
}
return projects;
}
public void DeletePublishingLogs(int daysToKeep)
{
LogDir.DeletePublishingLogs(this, daysToKeep);
}
public void Export()
{
string rqlStatement =
"<IODATA>" +
"<ADMINISTRATION>" +
"<PROJECT action=\"export\" projectguid=\"" + Guid + "\"" +
"</ADMINISTRATION>" +
"</IODATA>";
Session.Execute(rqlStatement, Session.Info.LoginGuid);
}
public void Export(DirectoryInfo exportPath, bool createFolder, bool includeAdmin,
bool includeArchive, bool logoutUsers, Server emailServer, Server exportServer,
bool emailNotification, User to, string subject, string body)
{
string rqlStatement = "<IODATA>" + "<ADMINISTRATION>"
+ "<PROJECT action=\"export\" projectguid=\"" + GuidString + "\"";
if (exportPath != null)
{
rqlStatement += " targetpath=\"" + exportPath.FullName + "\"";
}
rqlStatement += " createfolderforeachexport=\"" + (createFolder ? "1" : "0") + "\"";
rqlStatement += " includeadmindata=\"" + (includeAdmin ? "1" : "0") + "\"";
rqlStatement += " includearchive=\"" + (includeArchive ? "1" : "0") + "\"";
rqlStatement += " logoutusers=\"" + (logoutUsers ? "1" : "0") + "\"";
if (exportServer != null)
{
rqlStatement += " reddotserverguid=\"" + exportServer.GuidString + "\"";
}
rqlStatement += " emailnotification=\"" + (emailNotification ? "1" : "0") + "\"";
if (emailNotification)
{
rqlStatement += " editorialserver=\"" + emailServer.GuidString + "\"";
rqlStatement += " to=\"" + to.GuidString + "\"";
rqlStatement += " subject=\"" + subject + "\"";
rqlStatement += " message=\"" + body + "\"";
}
rqlStatement += "/></ADMINISTRATION>" + "</IODATA>";
Session.Execute(rqlStatement, Session.Info.LoginGuid);
}
}
}