在ascx中写的,通过smartpart挂载。
1
namespace Genersoft.OA.Protal.EipWeb
2![]()
![]()
{
3
using System;
4
using System.Data;
5
using System.Drawing;
6
using System.Web;
7
using System.Web.UI;
8
using System.Web.UI.WebControls;
9
using System.Web.UI.HtmlControls;
10
using System.Text;
11
using System.Collections;
12![]()
13
using Microsoft.SharePoint;
14
using Microsoft.SharePoint.Portal;
15
using Microsoft.SharePoint.WebControls;
16
using Microsoft.SharePoint.Portal.SiteData;
17
using Microsoft.SharePoint.Portal.WebControls;
18
using Microsoft.SharePoint.Portal.Security;
19
using Microsoft.SharePoint.Portal.Topology;
20![]()
21
using tag = System.Web.UI.HtmlTextWriterTag;
22
using attr = System.Web.UI.HtmlTextWriterAttribute;
23![]()
24
25
[System.ComponentModel.Description("新闻列表部件")]
26
public class EipListNews : System.Web.UI.UserControl
27![]()
{
28![]()
"variable definiens"#region "variable definiens"
29
private string _areaGuids = "";
30
private string strLog = "";
31
#endregion
32![]()
33![]()
"public properties"#region "public properties"
34![]()
35
[System.ComponentModel.Browsable(true),
36
System.ComponentModel.DefaultValue("guid以逗号分割"),
37
System.ComponentModel.Description("Area's Guid for display")]
38
public string AreaGuids
39![]()
{
40![]()
get
{ return _areaGuids; }
41![]()
set
{ _areaGuids = value; }
42
}
43![]()
44
#endregion
45![]()
46![]()
"PageLoad"#region "PageLoad"
47
private void Page_Load(object sender, System.EventArgs e)
48![]()
{
49
// 在此处放置用户代码以初始化页面
50
}
51
#endregion
52![]()
53![]()
"生成新闻列表html"#region "生成新闻列表html"
54
protected override void Render(HtmlTextWriter writer)
55![]()
{
56
57
try
58![]()
{
59
if( _areaGuids.IndexOf(",")!= -1)
60![]()
{
61
string [] tempAreaGuids = _areaGuids.Split(',');
62
63
for (int i=0;i<tempAreaGuids.Length;i++)
64![]()
{
65
if(tempAreaGuids[i] != "" )
66![]()
{
67
Area tempArea = GetAreaFromGuidOrPath(tempAreaGuids[i]);
68
if(tempArea != null)
69![]()
{
70
ArrayList al = new ArrayList();
71
GetAllAreasListings(ref al,tempArea,1);
72
writer.Write(RenderHtml(tempArea,al));
73
//writer.RenderBeginTag(tag.Br);
74
//writer.RenderEndTag();
75
}
76
}
77
}
78
}
79
else
80![]()
{
81
writer.Write("您还没有设置要显示的新闻区域,点此设置!");//让用户点击直接打开ToolPart
82
}
83
}
84
catch(Exception ex)
85![]()
{
86
writer.Write(strLog+=ex.Message);
87
}
88
}
89
#endregion
90![]()
91![]()
"递归动态获取新闻列表ArrayList"#region "递归动态获取新闻列表ArrayList"
92
private void GetAllAreasListings(ref ArrayList al,Area currentArea,int runone)
93![]()
{
94
if(runone == 1)//新闻父区域
95![]()
{
96
AreaListingCollection list = currentArea.Listings;
97
for(uint i=0;i<list.Count;i++)
98![]()
{
99
al.Add(list[i]);
100
}
101
runone++;
102
GetAllAreasListings(ref al,currentArea,runone);
103
}
104
else//新闻子区域
105![]()
{
106
foreach(Area onearea in currentArea.Areas)
107![]()
{
108
AreaListingCollection list = onearea.Listings;
109
for(uint i=0;i<list.Count;i++)
110![]()
{
111
al.Add(list[i]);
112
}
113
GetAllAreasListings(ref al,onearea,runone);
114
}
115
}
116
al.Sort(new AreaListingComparer());
117
}
118
#endregion
119![]()
120![]()
"根据Guid获取新闻区域"#region "根据Guid获取新闻区域"
121![]()
/**//// <summary>
122
/// Get current Area by Guid or areaNavigationPath
123
/// </summary>
124
/// <param name="GuidOrPath">GuidOrPath</param>
125
/// <returns>Area</returns>
126
public Area GetAreaFromGuidOrPath(string GuidOrPath)
127![]()
{
128
Area homeArea = null;
129
string curAreaName="";
130
try
131![]()
{
132
if(GuidOrPath.StartsWith("http://"))
133![]()
{
134
string startUrl=GetPortalURL(GuidOrPath);
135![]()
136
Uri siteUri = new Uri(startUrl);
137
TopologyManager tm = new TopologyManager();
138
PortalSite site = tm.PortalSites[siteUri];
139
PortalContext portalContext = PortalApplication.GetContext(site);
140
Guid homeGuid = AreaManager.GetSystemAreaGuid(portalContext, SystemArea.Home);
141
homeArea = AreaManager.GetArea(portalContext, homeGuid);
142
143
string areaName=getNextSectionInUrl(GuidOrPath,startUrl).Trim();
144
while (areaName!="")
145![]()
{
146
homeArea=homeArea.Areas[areaName];
147
startUrl+="/"+areaName;
148
curAreaName=areaName;
149
areaName=getNextSectionInUrl(GuidOrPath,startUrl).Trim();
150
}
151
}
152
else
153![]()
{
154
homeArea = AreaManager.GetArea(PortalContext.Current,new Guid(GuidOrPath));
155
}
156
if (homeArea==null)
157![]()
{
158
strLog+="Can't find the area ("+curAreaName+") in the URL "+GuidOrPath+";\n";
159
strLog+="GetAreaFromURL leave:\n";
160
return null;
161
}
162
strLog+="GetAreaFromURL leave:\n";
163
return homeArea;
164
}
165
catch (Exception ex)
166![]()
{
167
strLog+=ex.Source+"====="+ex.Message+"\n";
168
strLog+="GetAreaFromURL leave:\n";
169
return null;
170
}
171![]()
172
}
173![]()
174![]()
/**//// <summary>
175
/// Get the portal's URL from the siteURL. Because it includes "http://" and the content between this and the next "/"
176
/// </summary>
177
/// <param name="siteUrl">sitUrl</param>
178
/// <returns>String</returns>
179
private string GetPortalURL(string siteUrl)
180![]()
{
181
strLog+="GetPortalURL enter:\n";
182
strLog+="siteUrl="+siteUrl+"\n";
183
string tempStr=siteUrl;
184
int tempPos;
185
tempPos=tempStr.IndexOf("/",7);
186
if (tempPos<0)
187![]()
{
188
tempPos=tempStr.Length;
189
}
190
tempStr=tempStr.Substring(0,tempPos);
191
strLog+="GetPortalURL leave:\n";
192
return tempStr;
193
}
194![]()
195![]()
/**//// <summary>
196
/// from the sourceUrl, get the section between startUrl and the next "/", for example, sourceUrl=http://sean/url1/url2,startUrl=http://sean, return result=url1
197
/// </summary>
198
/// <param name="sourceUrl">sourceUrl</param>
199
/// <param name="startUrl">startUrl</param>
200
/// <returns>String</returns>
201
private string getNextSectionInUrl(string sourceUrl,string startUrl)
202![]()
{
203
strLog+="getNextSectionInUrl enter:\n";
204
strLog+="sourceUrl="+sourceUrl+"\nstartUrl="+startUrl+"\n";
205
string resultStr="";
206
if ((sourceUrl==null)||(startUrl==null)||(sourceUrl.Trim()=="")||(startUrl.Trim()==""))
207![]()
{
208
strLog+="sourceUrl or startUrl is null or empty";
209
strLog+="getNextSectionInUrl leave:\n";
210
return resultStr;
211
}
212
if (sourceUrl.Length<=startUrl.Length)
213![]()
{
214
strLog+="sourceUrl must be longer than startUrl.\n";
215
strLog+="getNextSectionInUrl leave:\n";
216
return resultStr;
217
}
218
int tempIndex=sourceUrl.IndexOf("/",startUrl.Length+1);
219
if (tempIndex<=0)
220![]()
{
221
resultStr=sourceUrl.Substring(startUrl.Length+1);
222
}
223
else
224![]()
{
225
resultStr=sourceUrl.Substring(startUrl.Length+1,tempIndex-startUrl.Length-1);
226
}
227
strLog+="resultStr="+resultStr+"\n";
228
strLog+="getNextSectionInUrl leave:\n";
229
return resultStr;
230
}
231
232
#endregion
233![]()
234![]()
"构造展现新闻的HTML串"#region "构造展现新闻的HTML串"
235![]()
/**//// <summary>
236
/// 构造展现每个新闻模块的Html字符串 需要时可以放到属性里,让用户自行设置
237
/// </summary>
238
/// <param name="area"></param>
239
/// <param name="al"></param>
240
/// <returns></returns>
241
private string RenderHtml(Area area ,ArrayList al)
242![]()
{
243
StringBuilder sb = new StringBuilder();
244
try
245![]()
{
246
sb.Append("<table width='490'border='0' cellspacing='0' cellpadding='0'> ");
247
sb.Append(" <tr> ");
248
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/01.jpg' width='4' height='4'></td> ");
249
sb.Append(" <td width='4' background='/_layouts/images/lceip/02.jpg'></td> ");
250
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/03.jpg' width='4' height='4'></td> ");
251
sb.Append(" </tr> ");
252
sb.Append(" <tr> ");
253
sb.Append(" <td width='4' background='/_layouts/images/lceip/04.jpg'></td> ");
254
sb.Append(" <td height='50'valign='top'> ");
255
sb.Append(" <table cellspacing='0' cellpadding='0' border='0' width='470'> ");
256
sb.Append(" <tr> ");
257
sb.Append(" <td colspan='2' background='/_layouts/images/lceip/xwdh.jpg' height='40' align='right'> ");
258
sb.Append(" <font size='2'><a href='/News/default.aspx'>>>>更多</a> </font></td> ");
259
sb.Append(" </tr> ");
260
261
for(int i=0;i<al.Count;i++)
262![]()
{
263
string tempListTitle =((AreaListing)al[i]).Title.Length<23?((AreaListing)al[i]).Title:((AreaListing)al[i]).Title.Substring(0,23) + "…";
264
sb.Append(" <tr> ");
265
sb.Append(" <td width='370' height='25' background='/_layouts/images/lceip/news_bg.jpg'> <img src='/_layouts/images/lceip/newshead.gif'> <a href='"+ ((AreaListing)al[i]).URL + "'>" + tempListTitle+"</a>");
266
sb.Append(" <font color=DarkGray>["+((AreaListing)al[i]).CreationDate.ToShortDateString().Substring(2)+"]</font>");
267
if(((AreaListing)al[i]).CreationDate >DateTime.Today)
268![]()
{
269
sb.Append(" <img border='0' src='/_layouts/images/lceip/new.gif'> ");
270
}
271
sb.Append(" </td> ");
272
sb.Append(" <td width='50' background='/_layouts/images/lceip/news_bg.jpg' align='right'>" +"<font color=DarkGray>"+ ((AreaListing)al[i]).CreatedBy.Substring(((AreaListing)al[i]).CreatedBy.LastIndexOf("\\")+1,((AreaListing)al[i]).CreatedBy.Length-((AreaListing)al[i]).CreatedBy.LastIndexOf("\\")-1)+"</font>");
273
sb.Append(" </td> ");
274
sb.Append(" </tr> ");
275
}
276![]()
277
sb.Append(" </table> ");
278
sb.Append(" </td> ");
279
sb.Append(" <td background='/_layouts/images/lceip/06.jpg'></td> ");
280
sb.Append(" </tr> ");
281
sb.Append(" <tr> ");
282
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/07.jpg' width='4' height='4'></td> ");
283
sb.Append(" <td background='/_layouts/images/lceip/08.jpg'></td> ");
284
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/09.jpg' width='4' height='4'></td> ");
285
sb.Append(" </tr> ");
286
sb.Append("</table> ");
287
}
288
catch(Exception ex)
289![]()
{
290
strLog+= "error occur:" + ex.Message + "\n" ;
291
}
292
return sb.ToString();
293
}
294![]()
295
#endregion
296![]()
297![]()
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
298
override protected void OnInit(EventArgs e)
299![]()
{
300
//
301
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
302
//
303
InitializeComponent();
304
base.OnInit(e);
305
}
306
307![]()
/**//// <summary>
308
/// 设计器支持所需的方法 - 不要使用代码编辑器
309
/// 修改此方法的内容。
310
/// </summary>
311
private void InitializeComponent()
312![]()
{
313
this.Load += new System.EventHandler(this.Page_Load);
314
}
315
#endregion
316
}
317![]()
318![]()
"根据CreationDate进行倒叙排序"#region "根据CreationDate进行倒叙排序"
319
public class AreaListingComparer : IComparer
320![]()
{
321![]()
/**//// <summary>
322
/// First off, AreaListingCollection returns a collections of listings, not lists. They are different.
323
///The collection is based on the IEnumerable interface so you can create an IComparable class to have it sort whatever way you want and call the
324
/// </summary>
325
/// <param name="x"></param>
326
/// <param name="y"></param>
327
/// <returns></returns>
328
public int Compare(Object x, Object y)
329![]()
{
330
if(((AreaListing)x).CreationDate > ((AreaListing)y).CreationDate)
331![]()
{
332
return -1;
333
}
334
return 1;
335
}
336
}
337
#endregion
338
}
339![]()
namespace Genersoft.OA.Protal.EipWeb2


{3
using System;4
using System.Data;5
using System.Drawing;6
using System.Web;7
using System.Web.UI;8
using System.Web.UI.WebControls;9
using System.Web.UI.HtmlControls;10
using System.Text;11
using System.Collections;12

13
using Microsoft.SharePoint;14
using Microsoft.SharePoint.Portal;15
using Microsoft.SharePoint.WebControls;16
using Microsoft.SharePoint.Portal.SiteData;17
using Microsoft.SharePoint.Portal.WebControls;18
using Microsoft.SharePoint.Portal.Security;19
using Microsoft.SharePoint.Portal.Topology;20

21
using tag = System.Web.UI.HtmlTextWriterTag;22
using attr = System.Web.UI.HtmlTextWriterAttribute; 23

24
25
[System.ComponentModel.Description("新闻列表部件")]26
public class EipListNews : System.Web.UI.UserControl27

{28

"variable definiens"#region "variable definiens"29
private string _areaGuids = "";30
private string strLog = "";31
#endregion32

33

"public properties"#region "public properties"34

35
[System.ComponentModel.Browsable(true),36
System.ComponentModel.DefaultValue("guid以逗号分割"),37
System.ComponentModel.Description("Area's Guid for display")]38
public string AreaGuids 39

{40

get
{ return _areaGuids; }41

set
{ _areaGuids = value; } 42
}43

44
#endregion45

46

"PageLoad"#region "PageLoad"47
private void Page_Load(object sender, System.EventArgs e)48

{49
// 在此处放置用户代码以初始化页面50
}51
#endregion52

53

"生成新闻列表html"#region "生成新闻列表html"54
protected override void Render(HtmlTextWriter writer)55

{ 56
57
try58

{59
if( _areaGuids.IndexOf(",")!= -1)60

{61
string [] tempAreaGuids = _areaGuids.Split(',');62
63
for (int i=0;i<tempAreaGuids.Length;i++)64

{65
if(tempAreaGuids[i] != "" )66

{67
Area tempArea = GetAreaFromGuidOrPath(tempAreaGuids[i]);68
if(tempArea != null)69

{70
ArrayList al = new ArrayList();71
GetAllAreasListings(ref al,tempArea,1);72
writer.Write(RenderHtml(tempArea,al));73
//writer.RenderBeginTag(tag.Br);74
//writer.RenderEndTag();75
}76
} 77
} 78
}79
else80

{81
writer.Write("您还没有设置要显示的新闻区域,点此设置!");//让用户点击直接打开ToolPart82
}83
}84
catch(Exception ex)85

{86
writer.Write(strLog+=ex.Message);87
}88
}89
#endregion90

91

"递归动态获取新闻列表ArrayList"#region "递归动态获取新闻列表ArrayList"92
private void GetAllAreasListings(ref ArrayList al,Area currentArea,int runone)93

{ 94
if(runone == 1)//新闻父区域95

{96
AreaListingCollection list = currentArea.Listings;97
for(uint i=0;i<list.Count;i++)98

{99
al.Add(list[i]);100
} 101
runone++;102
GetAllAreasListings(ref al,currentArea,runone);103
}104
else//新闻子区域105

{106
foreach(Area onearea in currentArea.Areas)107

{108
AreaListingCollection list = onearea.Listings; 109
for(uint i=0;i<list.Count;i++)110

{111
al.Add(list[i]);112
} 113
GetAllAreasListings(ref al,onearea,runone);114
}115
}116
al.Sort(new AreaListingComparer()); 117
} 118
#endregion 119

120

"根据Guid获取新闻区域"#region "根据Guid获取新闻区域"121

/**//// <summary>122
/// Get current Area by Guid or areaNavigationPath123
/// </summary>124
/// <param name="GuidOrPath">GuidOrPath</param>125
/// <returns>Area</returns>126
public Area GetAreaFromGuidOrPath(string GuidOrPath)127

{ 128
Area homeArea = null;129
string curAreaName="";130
try131

{132
if(GuidOrPath.StartsWith("http://"))133

{134
string startUrl=GetPortalURL(GuidOrPath); 135

136
Uri siteUri = new Uri(startUrl);137
TopologyManager tm = new TopologyManager();138
PortalSite site = tm.PortalSites[siteUri];139
PortalContext portalContext = PortalApplication.GetContext(site);140
Guid homeGuid = AreaManager.GetSystemAreaGuid(portalContext, SystemArea.Home);141
homeArea = AreaManager.GetArea(portalContext, homeGuid);142
143
string areaName=getNextSectionInUrl(GuidOrPath,startUrl).Trim(); 144
while (areaName!="")145

{146
homeArea=homeArea.Areas[areaName];147
startUrl+="/"+areaName;148
curAreaName=areaName;149
areaName=getNextSectionInUrl(GuidOrPath,startUrl).Trim();150
}151
}152
else 153

{154
homeArea = AreaManager.GetArea(PortalContext.Current,new Guid(GuidOrPath));155
}156
if (homeArea==null)157

{158
strLog+="Can't find the area ("+curAreaName+") in the URL "+GuidOrPath+";\n";159
strLog+="GetAreaFromURL leave:\n";160
return null;161
}162
strLog+="GetAreaFromURL leave:\n";163
return homeArea;164
}165
catch (Exception ex)166

{167
strLog+=ex.Source+"====="+ex.Message+"\n";168
strLog+="GetAreaFromURL leave:\n";169
return null;170
}171

172
} 173

174

/**//// <summary>175
/// Get the portal's URL from the siteURL. Because it includes "http://" and the content between this and the next "/"176
/// </summary>177
/// <param name="siteUrl">sitUrl</param>178
/// <returns>String</returns>179
private string GetPortalURL(string siteUrl)180

{181
strLog+="GetPortalURL enter:\n";182
strLog+="siteUrl="+siteUrl+"\n";183
string tempStr=siteUrl;184
int tempPos; 185
tempPos=tempStr.IndexOf("/",7);186
if (tempPos<0)187

{188
tempPos=tempStr.Length;189
}190
tempStr=tempStr.Substring(0,tempPos);191
strLog+="GetPortalURL leave:\n";192
return tempStr;193
}194

195

/**//// <summary>196
/// from the sourceUrl, get the section between startUrl and the next "/", for example, sourceUrl=http://sean/url1/url2,startUrl=http://sean, return result=url1197
/// </summary>198
/// <param name="sourceUrl">sourceUrl</param>199
/// <param name="startUrl">startUrl</param>200
/// <returns>String</returns>201
private string getNextSectionInUrl(string sourceUrl,string startUrl)202

{203
strLog+="getNextSectionInUrl enter:\n";204
strLog+="sourceUrl="+sourceUrl+"\nstartUrl="+startUrl+"\n";205
string resultStr="";206
if ((sourceUrl==null)||(startUrl==null)||(sourceUrl.Trim()=="")||(startUrl.Trim()==""))207

{208
strLog+="sourceUrl or startUrl is null or empty";209
strLog+="getNextSectionInUrl leave:\n";210
return resultStr;211
}212
if (sourceUrl.Length<=startUrl.Length)213

{214
strLog+="sourceUrl must be longer than startUrl.\n";215
strLog+="getNextSectionInUrl leave:\n";216
return resultStr;217
}218
int tempIndex=sourceUrl.IndexOf("/",startUrl.Length+1);219
if (tempIndex<=0)220

{ 221
resultStr=sourceUrl.Substring(startUrl.Length+1);222
}223
else224

{225
resultStr=sourceUrl.Substring(startUrl.Length+1,tempIndex-startUrl.Length-1);226
}227
strLog+="resultStr="+resultStr+"\n";228
strLog+="getNextSectionInUrl leave:\n";229
return resultStr;230
}231
232
#endregion233

234

"构造展现新闻的HTML串"#region "构造展现新闻的HTML串" 235

/**//// <summary>236
/// 构造展现每个新闻模块的Html字符串 需要时可以放到属性里,让用户自行设置237
/// </summary>238
/// <param name="area"></param>239
/// <param name="al"></param>240
/// <returns></returns>241
private string RenderHtml(Area area ,ArrayList al)242

{243
StringBuilder sb = new StringBuilder();244
try245

{ 246
sb.Append("<table width='490'border='0' cellspacing='0' cellpadding='0'> ");247
sb.Append(" <tr> ");248
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/01.jpg' width='4' height='4'></td> ");249
sb.Append(" <td width='4' background='/_layouts/images/lceip/02.jpg'></td> ");250
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/03.jpg' width='4' height='4'></td> ");251
sb.Append(" </tr> ");252
sb.Append(" <tr> ");253
sb.Append(" <td width='4' background='/_layouts/images/lceip/04.jpg'></td> ");254
sb.Append(" <td height='50'valign='top'> ");255
sb.Append(" <table cellspacing='0' cellpadding='0' border='0' width='470'> ");256
sb.Append(" <tr> ");257
sb.Append(" <td colspan='2' background='/_layouts/images/lceip/xwdh.jpg' height='40' align='right'> ");258
sb.Append(" <font size='2'><a href='/News/default.aspx'>>>>更多</a> </font></td> ");259
sb.Append(" </tr> "); 260
261
for(int i=0;i<al.Count;i++)262

{ 263
string tempListTitle =((AreaListing)al[i]).Title.Length<23?((AreaListing)al[i]).Title:((AreaListing)al[i]).Title.Substring(0,23) + "…";264
sb.Append(" <tr> ");265
sb.Append(" <td width='370' height='25' background='/_layouts/images/lceip/news_bg.jpg'> <img src='/_layouts/images/lceip/newshead.gif'> <a href='"+ ((AreaListing)al[i]).URL + "'>" + tempListTitle+"</a>");266
sb.Append(" <font color=DarkGray>["+((AreaListing)al[i]).CreationDate.ToShortDateString().Substring(2)+"]</font>");267
if(((AreaListing)al[i]).CreationDate >DateTime.Today)268

{269
sb.Append(" <img border='0' src='/_layouts/images/lceip/new.gif'> ");270
} 271
sb.Append(" </td> ");272
sb.Append(" <td width='50' background='/_layouts/images/lceip/news_bg.jpg' align='right'>" +"<font color=DarkGray>"+ ((AreaListing)al[i]).CreatedBy.Substring(((AreaListing)al[i]).CreatedBy.LastIndexOf("\\")+1,((AreaListing)al[i]).CreatedBy.Length-((AreaListing)al[i]).CreatedBy.LastIndexOf("\\")-1)+"</font>");273
sb.Append(" </td> ");274
sb.Append(" </tr> ");275
} 276

277
sb.Append(" </table> ");278
sb.Append(" </td> ");279
sb.Append(" <td background='/_layouts/images/lceip/06.jpg'></td> ");280
sb.Append(" </tr> ");281
sb.Append(" <tr> ");282
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/07.jpg' width='4' height='4'></td> ");283
sb.Append(" <td background='/_layouts/images/lceip/08.jpg'></td> ");284
sb.Append(" <td width='4' height='4'><img src='/_layouts/images/lceip/09.jpg' width='4' height='4'></td> ");285
sb.Append(" </tr> ");286
sb.Append("</table> "); 287
}288
catch(Exception ex)289

{290
strLog+= "error occur:" + ex.Message + "\n" ;291
}292
return sb.ToString(); 293
} 294

295
#endregion296

297

Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码298
override protected void OnInit(EventArgs e)299

{300
//301
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。302
//303
InitializeComponent();304
base.OnInit(e);305
}306
307

/**//// <summary>308
/// 设计器支持所需的方法 - 不要使用代码编辑器309
/// 修改此方法的内容。310
/// </summary>311
private void InitializeComponent()312

{313
this.Load += new System.EventHandler(this.Page_Load);314
}315
#endregion316
}317

318

"根据CreationDate进行倒叙排序"#region "根据CreationDate进行倒叙排序"319
public class AreaListingComparer : IComparer 320

{ 321

/**//// <summary>322
/// First off, AreaListingCollection returns a collections of listings, not lists. They are different.323
///The collection is based on the IEnumerable interface so you can create an IComparable class to have it sort whatever way you want and call the 324
/// </summary>325
/// <param name="x"></param>326
/// <param name="y"></param>327
/// <returns></returns>328
public int Compare(Object x, Object y) 329

{ 330
if(((AreaListing)x).CreationDate > ((AreaListing)y).CreationDate) 331

{ 332
return -1; 333
} 334
return 1; 335
} 336
} 337
#endregion338
}339

浙公网安备 33010602011771号