using System; using System.Collections.Generic; namespace FineUIPro.Web.JDGL.WBSPlan { public partial class SeeDetailHistory : PageBase { #region 加载页面 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // 绑定表格 BindGrid(); } } /// /// 绑定数据 /// private void BindGrid() { string column1 = string.Empty; decimal totalValue = 0, totalRate = 0; List items = new List(); List detailHistorys = BLL.WbsDetailHistoryService.GetWbsDetailHistorysByToWbs(Request.Params["ToWbs"]); Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(Request.Params["ToWbs"]); if (detailHistorys.Count > 0 && wbsSet != null) { column1 = "进度计划开始日期:" + string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(wbsSet.StartDate)) + "
进度计划结束日期:" + string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(wbsSet.EndDate)); this.Grid1.Columns[1].HeaderText = column1; foreach (var detailHistory in detailHistorys) { Model.WBSDetailItem item = new Model.WBSDetailItem(); item.WbsDetailHistoryId = detailHistory.WbsDetailHistoryId; item.VersionNum = detailHistory.VersionNum; item.ToWbs = detailHistory.ToWbs; item.YearsMonthsStr = Convert.ToDateTime(detailHistory.Months).Year + "年" + Convert.ToDateTime(detailHistory.Months).Month + "月"; if (detailHistory.PlanValue != null) { item.PlanValue = decimal.Round(Convert.ToDecimal(detailHistory.PlanValue), 2); item.PlanValueRate = decimal.Round(Convert.ToDecimal(detailHistory.PlanValueRate), 2); totalValue += decimal.Round(Convert.ToDecimal(item.PlanValue), 2); totalRate += decimal.Round(Convert.ToDecimal(item.PlanValueRate), 2); item.PlanValueTotal = totalValue; item.PlanValueRateTotal = totalRate; if (wbsSet.WeightsMoney == totalValue) { item.PlanValueRateTotal = 100; totalValue = 0; totalRate = 0; } } items.Add(item); } Grid1.DataSource = items; Grid1.DataBind(); } } #endregion } }