Newer
Older
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
using System;
using System.Collections.Generic;
using System.Web;
using Kenanfans.KDO;
using System.Web.UI.WebControls;
using System.Data;
namespace Sqcy.Page
{
/// <summary>
///CacheTools 的摘要说明
/// </summary>
public class CacheTools
{
public static SqlDataBaseOperator Sdbo = DataService.AppSdbo;
public enum Result { Success, Warning, Error };
public static String[] DayOfWeekDescript = new String[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
private CacheTools()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public static CacheStatus LoadNav()
{
Dictionary<String, String> mainNav = new Dictionary<String, String>();
mainNav.Add("首页", "Default.aspx");
mainNav.Add("信息简报", "dcd28e37-4303-4bd4-b09a-58adb3e4f67b");
mainNav.Add("政策法规", "749fbdfc-bf6e-4c50-aaef-3fe2bbf75d4d");
mainNav.Add("规章制度", "f4679928-212c-48aa-8739-e9802afea047");
mainNav.Add("处室专区", "9c4a704f-938f-4ac4-a43e-8cdd0abe0bfe");
mainNav.Add("公务网", "http://gww.sjgj.sh");
mainNav.Add("外网镜像", "http://app1.sjgj.sh/jgjportal");
mainNav.Add("视频点播", "http://intranet.sjgj.sh:8888/");
mainNav.Add("局域微博", "http://intranet.sjgj.sh/lansite/Weibo.aspx");
Dictionary<String, String>.Enumerator enu = mainNav.GetEnumerator();
String html = "";
int index = 0;
while (enu.MoveNext())
{
html += "<li class=\"navbtn\" ";
KeyValuePair<String, String> d = enu.Current;
String href = d.Value;
if (DataConvertHelper.IsGuid(href))
{
href = String.Format("SectionList.aspx?GroupID={0}", d.Value);
html += String.Format("href=\"{0}\">{1}", href, d.Key);
using (DataTable dt = Sdbo.ExecuteDataTable("SELECT * FROM TBL_Common_Section WHERE Parent='{0}' ORDER BY DispSeq", d.Value))
{
if (dt.Rows.Count > 0)
{
String colStr = "";
if (dt.Rows.Count >= 8 && dt.Rows.Count <= 12)
{
colStr = "twoCol";
}
else if (dt.Rows.Count > 12)
{
colStr = "threeCol";
}
html += String.Format("<div class=\"{0}\">", colStr);
foreach (DataRow dr in dt.Rows)
{
html += String.Format("<a href=\"{0}&SectionID={1}\">{2}</a>", href, dr["ID"], dr["Name"]);
}
html += "</div>";
}
}
html += "</li>";
}
else
{
html += String.Format("href=\"{0}\">{1}</li>", href, d.Key);
}
if (index < mainNav.Count)
{
html += "<li class=\"navhr\"> </li>";
}
index++;
}
HttpContext.Current.Application["NavHtml"] = html;
return new CacheStatus(Result.Success, "");
}
public static WeekInfo GetWeekInfo(DateTime now)
{
WeekInfo wi = new WeekInfo(now);
return wi;
}
public static WeekInfo GetWeekInfo()
{
DateTime now = DateTime.Now;
return GetWeekInfo(now);
}
public static void LoadWeekInfo()
{
DateTime now = DateTime.Now;
WeekInfo wi = new WeekInfo(now);
HttpContext.Current.Application["WeekInfo"] = wi;
}
public static int GetWeekNo(DateTime now)
{
int weekNo = 0;
if (now.DayOfYear % 7 > 0)
{
weekNo = (now.DayOfYear - (now.DayOfYear % 7)) / 7 + 1;
}
else
{
weekNo = now.DayOfYear / 7;
}
//weekNo = now.Year * 100 + weekNo;
return weekNo;
}
public static DateTime[] GetWeekDays(DateTime now)
{
DateTime[] weekDays = new DateTime[7];
int dowNo = (int)now.DayOfWeek;
if (dowNo == 0)
{
dowNo = 7;
}
DateTime startWeek = now.AddDays(1 - dowNo); //本周周一
weekDays[0] = startWeek;
for (int i = 1; i < 7; i++)
{
weekDays[i] = startWeek.AddDays(i);
}
//DateTime endWeek = startWeek.AddDays(6); //本周周日
return weekDays;
}
}
public class CacheStatus
{
private CacheTools.Result _Result;
private String _Message;
public CacheStatus(CacheTools.Result _Result, String _Message)
{
this._Result = _Result;
this._Message = _Message;
}
}
public class WeekInfo
{
public int _WeekNo; //一年的第几周
public int _Year;
public Guid _WeekWork;
public DayInfo[] _DayInfos;
public WeekInfo(DateTime now)
{
_WeekNo = CacheTools.GetWeekNo(now);
_Year = now.Year;
DateTime[] weekDays = CacheTools.GetWeekDays(now);
_DayInfos = new DayInfo[7];
for (int i = 0; i < weekDays.Length; i++)
{
_DayInfos[i] = new DayInfo(weekDays[i]);
}
using (DataTable dtCalendar = CacheTools.Sdbo.ExecuteDataTable("SELECT * FROM dbo.TBL_Common_Calendar WHERE [Date] BETWEEN '{0}' AND '{1}'", weekDays[0].Date, weekDays[6].Date.AddDays(1)))
{
foreach (DataRow drDate in dtCalendar.Rows)
{
DayInfo di = GetDayInfo((DateTime)drDate["Date"]);
if (di != null)
{
di._Watch1 = drDate["Watch1"].ToString();
di._Watch2 = drDate["Watch2"].ToString();
if (drDate["Conference"].ToString() != "")
{
di._Conference = drDate["Conference"].ToString();
}
}
}
}
}
public DayInfo GetDayInfo(DateTime theDay)
{
foreach (DayInfo di in _DayInfos)
{
if (theDay.Date == di._Day.Date)
{
return di;
}
}
return null;
}
public DayInfo GetDayInfo(int index)
{
return _DayInfos[index - 1];
}
public DayInfo Today
{
get
{
DayInfo di = GetDayInfo(DateTime.Now);
return di;
}
}
}
public class DayInfo
{
public DateTime _Day;
public String _DayDescript;
public String _DayOfWeekDescript;
public String _DayOfChineseCalendarDescript;
public int _DayOfWeekNo;
public String _Watch1, _Watch2, _Conference;//大值班、小值班、会议信息
public DayInfo(DateTime theDay)
{
_Watch2 = _Watch1 = "";
_Conference = "今日暂无会议信息";
_Day = theDay;
_DayDescript = theDay.ToString("yyyy年MM月dd日");
_DayOfWeekDescript = CacheTools.DayOfWeekDescript[Convert.ToInt32(theDay.DayOfWeek.ToString("d"))].ToString();
ChineseCalendar cc = new ChineseCalendar(theDay);
//cc.ChineseMonthString
_DayOfChineseCalendarDescript = String.Format("{0}{1}", cc.ChineseMonthString, cc.ChineseDayString);
_DayOfWeekNo = Convert.ToInt32(_Day.DayOfWeek.ToString("d"));
if (_DayOfWeekNo == 0)
{
_DayOfWeekNo = 7;
}
//_DayOfWeekNo--;
}
}
}