forked from harveysburger/pinnaclewrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvent.cs
74 lines (63 loc) · 1.9 KB
/
Event.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
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using PinnacleWrapper.Enums;
namespace PinnacleWrapper.Data
{
[Serializable]
[XmlRoot("event")]
public class Event
{
[XmlElement("startDateTime")]
public DateTime StartDateTime { get; set; }
[XmlElement("id")]
public long Id { get; set; }
[XmlElement("IsLive")]
public string IsLiveString { get; set; }
[XmlIgnore]
public bool IsLive
{
get
{
return IsLiveString.Equals("Yes", StringComparison.OrdinalIgnoreCase);
}
set
{
IsLiveString = (value ? "Yes" : "No");
}
}
[XmlElement("status")]
public string StatusString { get; set; }
[XmlIgnore]
public Status Status
{
get
{
if (!string.IsNullOrWhiteSpace(StatusString))
{
switch (StatusString.ToLower())
{
case "o":
return Status.Open;
case "i":
return Status.LowerMaximum;
case "h":
return Status.Unavailable;
case "x":
return Status.Cancelled;
default:
throw new Exception("Unrecognized status: " + StatusString);
}
}
throw new Exception("No status string");
}
}
[XmlElement("homeTeam")]
public Team HomeTeam { get; set; }
[XmlElement("awayTeam")]
public Team AwayTeam { get; set; }
[XmlArray("periods")]
[XmlArrayItem("period")]
public List<Period> Periods { get; set; }
}
}