温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:BugNet0.7.881.0汉化免安装版源码
当前文件路径:BugNet/BugNET_WAP/Bugs/RoadMap.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using BugNET.UserInterfaceLayer; 12
using BugNET.BusinessLogicLayer; 13
using System.Drawing; 14
15
/// <summary> 16
/// Project Road Map 17
/// </summary> 18
public partial class Bugs_RoadMap : BasePage 19
{ 20
/// <summary> 21
/// The current version title. 22
/// </summary> 23
protected string VersionTitle; 24
25
/// <summary> 26
/// Handles the Load event of the Page control. 27
/// </summary> 28
/// <param name="sender">The source of the event.</param> 29
/// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> 30
protected void Page_Load(object sender, EventArgs e) 31
{ 32
if (!Page.IsPostBack) 33
{ 34
//get project id 35
if (Request.QueryString["pid"] != null) 36
ProjectId = Convert.ToInt32(Request.Params["pid"]); 37
38
Project p = Project.GetProjectById(ProjectId); 39
ltProject.Text = p.Name; 40
litProjectCode.Text = p.Code; 41
42
rptRoadMap.DataSource = Bug.GetRoadMap(ProjectId); 43
rptRoadMap.DataBind(); 44
} 45
46
// The ExpandIssuePaths method is called to handle 47
// the SiteMapResolve event. 48
SiteMap.SiteMapResolve += 49
new SiteMapResolveEventHandler(this.ExpandProjectPaths); 50
} 51
52
/// <summary> 53
/// Handles the Unload event of the Page control. 54
/// </summary> 55
/// <param name="sender">The source of the event.</param> 56
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> 57
protected void Page_Unload(object sender, System.EventArgs e) 58
{ 59
//remove the event handler 60
SiteMap.SiteMapResolve -= 61
new SiteMapResolveEventHandler(this.ExpandProjectPaths); 62
} 63
64
/// <summary> 65
/// Expands the project paths. 66
/// </summary> 67
/// <param name="sender">The sender.</param> 68
/// <param name="e">The <see cref="System.Web.SiteMapResolveEventArgs"/> instance containing the event data.</param> 69
/// <returns></returns> 70
private SiteMapNode ExpandProjectPaths(Object sender, SiteMapResolveEventArgs e) 71
{ 72
SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); 73
SiteMapNode tempNode = currentNode; 74
75
// The current node, and its parents, can be modified to include 76
// dynamic querystring information relevant to the currently 77
// executing request. 78
if (ProjectId != 0) 79
{ 80
tempNode.Url = tempNode.Url + "?pid=" + ProjectId.ToString(); 81
} 82
83
if ((null != (tempNode = tempNode.ParentNode)) && 84
(ProjectId != 0)) 85
{ 86
tempNode.Url = tempNode.Url + "?pid=" + ProjectId.ToString(); 87
} 88
89
return currentNode; 90
} 91
/// <summary> 92
/// Handles the ItemDataBound event of the rptRoadMap control. 93
/// </summary> 94
/// <param name="sender">The source of the event.</param> 95
/// <param name="e">The <see cref="T:System.Web.UI.WebControls.RepeaterItemEventArgs"/> instance containing the event data.</param> 96
protected void rptRoadMap_ItemDataBound(object sender, RepeaterItemEventArgs e) 97
{ 98
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 99
{ 100
BugNET.BusinessLogicLayer.Bug b = (BugNET.BusinessLogicLayer.Bug)e.Item.DataItem; 101
((HtmlControl)e.Item.FindControl("HeaderRow")).Visible = false; 102
if (e.Item.ItemIndex == 0) 103
{ 104
//first control set title 105
VersionTitle = b.FixedInVersionName; 106
((Label)e.Item.FindControl("lblVersion")).Text = VersionTitle; 107
((HtmlControl)e.Item.FindControl("HeaderRow")).Visible = true; 108
} 109
110
if (VersionTitle != b.FixedInVersionName) 111
{ 112
VersionTitle = b.FixedInVersionName; 113
((Label)e.Item.FindControl("lblVersion")).Text = VersionTitle; 114
((HtmlControl)e.Item.FindControl("HeaderRow")).Visible = true; 115
} 116
int[] values = Bug.GetRoadMapProgress(ProjectId,b.FixedInVersionId); 117
((Label)e.Item.FindControl("lblProgress")).Text = string.Format("{2}% complete<br/>{0} of {1} issues have been resolved", values[0], values[1],values[0]*100/values[1]); 118
119
((Label)e.Item.FindControl("lblSummary")).Text = b.Summary; 120
((Label)e.Item.FindControl("lblComponent")).Text = b.ComponentName; 121
((Label)e.Item.FindControl("lblStatus")).Text = b.StatusName; 122
((Label)e.Item.FindControl("lblType")).Text = b.TypeName; 123
((Label)e.Item.FindControl("lblAssignedTo")).Text = b.AssignedDisplayName; 124
125
//change unassigned user to red 126
if (b.AssignedToUserId == Guid.Empty) 127
((Label)e.Item.FindControl("lblAssignedTo")).ForeColor = Color.Red; 128
} 129
} 130
} 131







