温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
当前文件:
SpaceBuiderV10Source/BasicWebControls/Manage/SystemManage/TasksReport.cs[3K,2009-6-12 11:55:08],打开代码结构图
SpaceBuiderV10Source/BasicWebControls/Manage/SystemManage/TasksReport.cs[3K,2009-6-12 11:55:08],打开代码结构图1//------------------------------------------------------------------------------ 2
// <copyright company="Tunynet"> 3
// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4
// </copyright> 5
//------------------------------------------------------------------------------ 6
7
8
using System; 9
using System.Collections.Generic; 10
using System.Text; 11
using SpaceBuilder.Components; 12
using System.Web.UI.WebControls; 13
using System.Collections.Specialized; 14
using TunyNet.Tasks; 15
using System.Collections; 16
using SpaceBuilder.Security; 17
using SpaceBuilder.Posts.Permissions; 18
19
namespace SpaceBuilder.Web.Manage.Controls 20
{ 21
public class TasksReport : ManageBaseControl 22
{ 23
SBContext wlContext; 24
int threadCount = 1; 25
26
protected override void Authorize() 27
{ 28
if (!SBContext.Current.User.IsAdministrator) 29
PermissionBase.RedirectOrExcpetion(SBExceptionType.AccessDenied); 30
} 31
32
protected override void OnInit(EventArgs e) 33
{ 34
if (SkinName == null) 35
SkinName = "Skin-TasksReport.ascx"; 36
37
wlContext = SBContext.Current; 38
39
base.OnInit(e); 40
} 41
42
protected override void OnLoad(EventArgs e) 43
{ 44
base.OnLoad(e); 45
EnsureChildControls(); 46
ThreadsRepeater.ItemDataBound += new RepeaterItemEventHandler(ThreadsRepeater_ItemDataBound); 47
48
if (!Page.IsPostBack) 49
BindData(); 50
} 51
52
Child Controls 57
58
protected override void AttachChildControls() 59
{ 60
ThreadsRepeater = FindControl("ThreadsRepeater") as Repeater; 61
} 62
63
void BindData() 64
{ 65
ThreadsRepeater.DataSource = TaskManager.Instance().TaskThreads; 66
ThreadsRepeater.DataBind(); 67
} 68
69
void ThreadsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) 70
{ 71
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 72
{ 73
TaskThread taskThread = e.Item.DataItem as TaskThread; 74
75
if (taskThread == null) 76
return; 77
78
Repeater tasks = e.Item.FindControl("TasksRepeater") as Repeater; 79
if (tasks != null) 80
{ 81
tasks.DataSource = taskThread.Tasks; 82
tasks.DataBind(); 83
} 84
85
Literal ThreadTitle = e.Item.FindControl("ThreadTitle") as Literal; 86
Label Created = e.Item.FindControl("Created") as Label; 87
Label LastStart = e.Item.FindControl("LastStart") as Label; 88
Label LastStop = e.Item.FindControl("LastStop") as Label; 89
Label IsRunning = e.Item.FindControl("IsRunning") as Label; 90
Label Minutes = e.Item.FindControl("Minutes") as Label; 91
92
ThreadTitle.Text = string.Format("Thread #{0} 任务列表", threadCount++); 93
Created.Text = taskThread.Created == DateTime.MinValue ? "--" : taskThread.Created.ToString(); 94
LastStart.Text = taskThread.Started == DateTime.MinValue ? "--" : taskThread.Started.ToString(); 95
LastStop.Text = taskThread.Completed == DateTime.MinValue ? "--" : taskThread.Completed.ToString(); 96
IsRunning.Text = taskThread.IsRunning.ToString(); 97
Minutes.Text = (taskThread.Interval / 60000).ToString(); 98
} 99
} 100
101
102
} 103
} 104
105
106






}
}