1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Web;
5: using System.Data;
6: using System.Collections;
7: using System.Xml;
8: using System.Xml.Linq;
9: using System.Text;
10: using System.Text.RegularExpressions;
11: using System.IO;
12: using System.Threading;
13:
14: namespace Ia.Islamic.Tawheed.Model
15: {
16: ////////////////////////////////////////////////////////////////////////////
17:
18: /// <summary publish="true">
19: /// Islamic Tawheed Support Functions: Data model
20: /// </summary>
21: /// <value>
22: /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
23: /// </value>
24: /// <remarks>
25: /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
26: ///
27: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
28: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
29: ///
30: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
31: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
32: ///
33: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
34: ///
35: /// Copyright notice: This notice may not be removed or altered from any source distribution.
36: /// </remarks>
37: public class Data
38: {
39: private static XDocument kashShubuhatTawheed;
40: private static XDocument kawaedArbaa;
41:
42: ////////////////////////////////////////////////////////////////////////////
43:
44: /// <summary>
45: ///
46: /// </summary>
47: public Data() { }
48:
49: ////////////////////////////////////////////////////////////////////////////
50:
51: /// <summary>
52: ///
53: /// </summary>
54: private static XDocument KawaedArbaa
55: {
56: get
57: {
58: kawaedArbaa = Ia.Cl.Model.Xml.Load(@"app_data\\kawaed-arbaa.xml");
59:
60: return kawaedArbaa;
61: }
62: }
63:
64: ////////////////////////////////////////////////////////////////////////////
65:
66: /// <summary>
67: ///
68: /// </summary>
69: private static XDocument KashShubuhatTawheed
70: {
71: get
72: {
73: kashShubuhatTawheed = Ia.Cl.Model.Xml.Load(@"app_data\\kashf-shubuhat-tawheed.xml");
74:
75: return kashShubuhatTawheed;
76: }
77: }
78:
79: ////////////////////////////////////////////////////////////////////////////
80:
81: /// <summary>
82: ///
83: /// </summary>
84: public static void BookAttributesUsingLanguage(string languageCode, out string title, out string author, out string date, out string content, out string coverImage, out string stylesheetCss)
85: {
86: XElement xe;
87: XDocument xd;
88:
89: // below: flip book type according to days hour
90:
91: if (DateTime.UtcNow.Hour % 2 == 0) xd = KashShubuhatTawheed.Document;
92: else xd = KawaedArbaa.Document;
93:
94: var v = from q in xd.Elements("book").Elements("language") where q.Attribute("name").Value == languageCode select q;
95:
96: title = v.First().Element("title").Value;
97: author = v.First().Element("author").Value;
98: date = v.First().Element("date").Value;
99: coverImage = v.First().Element("coverImage").Value;
100: stylesheetCss = v.First().Element("stylesheetCss").Value;
101:
102: xe = v.First().Element("content");
103: var reader = xe.CreateReader();
104: reader.MoveToContent();
105: content = reader.ReadInnerXml();
106: }
107:
108: ////////////////////////////////////////////////////////////////////////////
109: ////////////////////////////////////////////////////////////////////////////
110: }
111:
112: ////////////////////////////////////////////////////////////////////////////
113: ////////////////////////////////////////////////////////////////////////////
114: }