-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetadata.cs
179 lines (143 loc) · 5.33 KB
/
Metadata.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using System;
using System.Data;
using System.Linq;
using System.Reflection;
namespace SP.GlobalTopMenu
{
[Serializable]
public class Metadata:IDisposable
{
#region properties
public double SiteId { get; set; }
public string SiteTitle { get; set; }
public string NewTitle { get; set; }
public string SiteDescription { get; set; }
public string SiteUrl { get; set; }
public string Position { get; set; }
public string GroupId { get; set; }
public string GlobalNav { get; set; }
public string Footer { get; set; }
public string ParentId { get; set; }
#endregion
#region Constractors
/// <summary>
///
/// </summary>
public Metadata() { }
/// <summary>
///
/// </summary>
/// <param name="drDoc"></param>
/// <param name="oMetadata"></param>
public Metadata(DataRow drDoc,Metadata oMetadata)
{
try
{
SiteId = oMetadata.SiteId;
SiteTitle = oMetadata.SiteTitle;
NewTitle = oMetadata.NewTitle;
SiteDescription = oMetadata.SiteDescription;
SiteUrl = oMetadata.SiteUrl;
Position = oMetadata.Position;
GroupId = oMetadata.GroupId;
GlobalNav = oMetadata.GlobalNav;
Footer = drDoc["FileName"].ToString();
ParentId = drDoc["File"].ToString();
}
catch (Exception ex)
{
throw;
}
}
/// <summary>
///
/// </summary>
/// <param name="dtDocInfo"></param>
public Metadata(DataTable dtDocInfo)
{
try
{
SiteId = Convert.ToDouble(dtDocInfo.Rows[0]["SiteId"]);
SiteTitle = dtDocInfo.Rows[0]["SiteTitle"].ToString();
NewTitle = dtDocInfo.Rows[0]["NewTitle"].ToString();
SiteDescription = dtDocInfo.Rows[0]["SiteDescription"].ToString();
SiteUrl = dtDocInfo.Rows[0]["SiteUrl"].ToString();
Position = dtDocInfo.Rows[0]["Position"].ToString();
GroupId = dtDocInfo.Rows[0]["GroupId"].ToString();
GlobalNav = dtDocInfo.Rows[0]["GlobalNav"].ToString();
Footer = dtDocInfo.Rows[0]["Footer"].ToString();
ParentId = dtDocInfo.Rows[0]["ParentId"].ToString();
}
catch (Exception ex)
{
throw;
}
}
/// <summary>
///
/// </summary>
/// <param name="drDocInfo"></param>
public Metadata(DataRow drDocInfo)
{
try
{
SiteId = Convert.ToDouble(drDocInfo["SiteId"]);
SiteTitle = string.IsNullOrEmpty(drDocInfo["SiteTitle"].ToString()) ? "1" : drDocInfo["SiteTitle"].ToString();
NewTitle = drDocInfo["NewTitle"].ToString();
SiteDescription = drDocInfo["SiteDescription"].ToString();
SiteUrl = drDocInfo["SiteUrl"].ToString();
Position = drDocInfo["Position"].ToString();
GroupId = drDocInfo["GroupId"].ToString();
GlobalNav = drDocInfo["GlobalNav"].ToString();
Footer = string.IsNullOrEmpty(drDocInfo["Footer"].ToString()) ? "0" : drDocInfo["Footer"].ToString(); ;
ParentId = drDocInfo["ParentId"].ToString();
}
catch (Exception ex)
{
throw;
}
}
public Metadata(DataRow drReference, Metadata oMetadata, bool bReference)
{
try
{
SiteId = Convert.ToDouble(drReference["SiteId"]);
SiteTitle = string.IsNullOrEmpty(drReference["SiteTitle"].ToString()) ? "1" : drReference["SiteTitle"].ToString();
NewTitle = oMetadata.NewTitle;
SiteDescription = oMetadata.SiteDescription;
SiteUrl = oMetadata.SiteUrl;
Position = oMetadata.Position;
GroupId = oMetadata.GroupId;
GlobalNav = drReference["GlobalNav"].ToString();
Footer = string.IsNullOrEmpty(drReference["Footer"].ToString()) ? "0" : drReference["Footer"].ToString();
ParentId = drReference["ParentId"].ToString();
}
catch (Exception ex)
{
throw;
}
}
public bool EqualTo(Metadata oMetadata)
{
PropertyInfo[] properties = this.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
if (this.GetType().GetProperty(property.Name).GetValue(this, null) != oMetadata.GetType().GetProperty(property.Name).GetValue(oMetadata, null))
{
return false;
}
}
return true;
}
#endregion
#region IDisposable Members
/// <summary>
///
/// </summary>
public void Dispose()
{
GC.SuppressFinalize(this);
}
#endregion
}
}