forked from davidbwire/bvcms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AskExtraQuestions.cs
53 lines (48 loc) · 1.46 KB
/
AskExtraQuestions.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
using System.Collections.Generic;
using System.Xml.Linq;
using CmsData.API;
namespace CmsData.Registration
{
public class AskExtraQuestions : Ask
{
public override string Help => @"
These questions can be answered with text.
The Question should be fairly short (25 characters or less)
but long enough for you and your registrant to know what it refers to.
Note, this will be used as a column header on an Excel spreadsheet.
If you need a long explanation assoicated with your question, put that in as an Instruction above the question.
";
public List<ExtraQuestion> list { get; private set; }
public AskExtraQuestions()
: base("AskExtraQuestions")
{
list = new List<ExtraQuestion>();
}
public override void WriteXml(APIWriter w)
{
if (list.Count == 0)
return;
w.Start(Type);
foreach (var q in list)
w.Add("Question", q.Question);
w.End();
}
public new static AskExtraQuestions ReadXml(XElement e)
{
var eq = new AskExtraQuestions();
foreach (var ee in e.Elements("Question"))
eq.list.Add(ExtraQuestion.ReadXml(ee));
return eq;
}
public partial class ExtraQuestion
{
public string Name { get; set; }
public string Question { get; set; }
// ReSharper disable once MemberHidesStaticFromOuterClass
public static ExtraQuestion ReadXml(XElement e)
{
return new ExtraQuestion() { Question = e.Value };
}
}
}
}