using BLL; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.TestRun.DriverReport { public partial class MonthReportNewView : PageBase { #region 定义集合 /// /// 工作包完成情况统计 /// public static List monthReportItems = new List(); /// /// 开车绩效测量数据 /// public static List monthReportItems2 = new List(); #endregion #region 页面加载 /// /// 页面加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.lblProjectName.Text = BLL.ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectName; string id = Request.Params["id"]; if (!string.IsNullOrEmpty(id)) { Model.TestRun_MonthReport data = BLL.TestRun_MonthReportService.GetMonthReportById(id); if (data != null) { this.hdId.Text = id; if (data.SortId != null) { this.txtPeriod.Text = Convert.ToString(data.SortId); } if (data.StartDate != null) { this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", data.StartDate); } if (data.EndDate != null) { this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", data.EndDate); } //this.txtPeriod.Text = data.MonthReportCode; //this.txtStartDate.Text = data.MonthReportDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.MonthReportDate) : ""; this.txtProjectOverview.Text = data.ProjectOverview; this.txtProjectBaseInfo.Text = data.ProjectBaseInfo; this.txtEngineeringPlant.Text = data.EngineeringPlant; this.txtProjectContract.Text = data.ProjectContract; this.txtMilestone.Text = data.Milestone; this.txtCompleteWork.Text = data.CompleteWork; this.txtProblemSituation.Text = data.ProblemSituation; this.txtBudget.Text = data.Budget.HasValue ? data.Budget.ToString() : ""; this.txtBudgetTotal.Text = data.BudgetTotal.HasValue ? data.BudgetTotal.ToString() : ""; this.txtActualCost.Text = data.ActualCost.HasValue ? data.ActualCost.ToString() : ""; this.txtActualCostTotal.Text = data.ActualCostTotal.HasValue ? data.ActualCostTotal.ToString() : ""; this.txtPublicationStatus.Text = data.PublicationStatus; this.txtImplementationStatus.Text = data.ImplementationStatus; this.txtHSEManageSituation.Text = data.HSEManageSituation; this.txtNextMonthMilestone.Text = data.NextMonthMilestone; this.txtNextMonthCompleteWork.Text = data.NextMonthCompleteWork; this.txtNextMonthSchedule.Text = data.NextMonthSchedule; this.txtNextMonthDrivingCost.Text = data.NextMonthDrivingCost; this.txtProblemsMeasures.Text = data.ProblemsMeasures; this.txtSolvedProblems.Text = data.SolvedProblems; } var items = BLL.TestRun_MonthReportItemService.GetMonthReportItemByReportId(this.hdId.Text); if (items.Count > 0) { this.Grid1.DataSource = items; this.Grid1.DataBind(); } var items2 = BLL.TestRun_MonthReportItem2Service.GetMonthReportItem2ByReportId(this.hdId.Text, "1"); if (items2.Count > 0) { this.Grid2.DataSource = items2; this.Grid2.DataBind(); } var items3 = BLL.TestRun_MonthReportItem2Service.GetMonthReportItem2ByReportId(this.hdId.Text, "2"); if (items3.Count > 0) { this.Grid3.DataSource = items3; this.Grid3.DataBind(); } WindowAtt_Close(null, null); } //else //{ // this.txtStartDate.Text = string.IsNullOrEmpty(Request.Params["startdate"]) ? string.Format("{0:yyyy-MM-dd}", DateTime.Now) : Request.Params["startdate"]; // this.txtEndDate.Text = string.IsNullOrEmpty(Request.Params["enddate"]) ? string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtStartDate.Text).AddMonths(1).AddDays(-1)) : Request.Params["enddate"]; // //新增月报时填充上一条月报的项目概况内容 // var report = BLL.TestRun_MonthReportService.GetReportByMaxDate(this.CurrUser.LoginProjectId); // if (report != null) // { // this.txtProjectOverview.Text = report.ProjectOverview; // this.txtProjectBaseInfo.Text = report.ProjectBaseInfo; // this.txtEngineeringPlant.Text = report.EngineeringPlant; // this.txtProjectContract.Text = report.ProjectContract; // } // #region 开车绩效测量数据 // monthReportItems2.Clear(); // Model.TestRun_MonthReportItem2 newItem = new Model.TestRun_MonthReportItem2(); // newItem.MonthReportItem2Id = SQLHelper.GetNewID(typeof(Model.TestRun_MonthReportItem2)); // newItem.TypeName = "设计"; // monthReportItems2.Add(newItem); // Model.TestRun_MonthReportItem2 newItem2 = new Model.TestRun_MonthReportItem2(); // newItem2.MonthReportItem2Id = SQLHelper.GetNewID(typeof(Model.TestRun_MonthReportItem2)); // newItem2.TypeName = "采购"; // monthReportItems2.Add(newItem2); // Model.TestRun_MonthReportItem2 newItem3 = new Model.TestRun_MonthReportItem2(); // newItem3.MonthReportItem2Id = SQLHelper.GetNewID(typeof(Model.TestRun_MonthReportItem2)); // newItem3.TypeName = "施工"; // monthReportItems2.Add(newItem3); // Model.TestRun_MonthReportItem2 newItem4 = new Model.TestRun_MonthReportItem2(); // newItem4.MonthReportItem2Id = SQLHelper.GetNewID(typeof(Model.TestRun_MonthReportItem2)); // newItem4.TypeName = "开车"; // monthReportItems2.Add(newItem4); // Model.TestRun_MonthReportItem2 newItem5 = new Model.TestRun_MonthReportItem2(); // newItem5.MonthReportItem2Id = SQLHelper.GetNewID(typeof(Model.TestRun_MonthReportItem2)); // newItem5.TypeName = "项目"; // monthReportItems2.Add(newItem5); // this.Grid2.DataSource = monthReportItems2; // this.Grid2.DataBind(); // this.Grid3.DataSource = monthReportItems2; // this.Grid3.DataBind(); // #endregion //} int nextMonth = 1; if (!string.IsNullOrEmpty(this.txtStartDate.Text)) { nextMonth = Convert.ToDateTime(this.txtStartDate.Text).AddMonths(1).Month; } Panel18.Title = "下月开车计划要点(" + nextMonth + "月份)"; } } #endregion #region 附件上传 /// /// 附件上传 /// /// /// protected void btnAttach_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.TestRun_MonthReport)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/TestRun/DriverReport/MonthReport&menuId={1}", this.hdId.Text, BLL.Const.MonthReportMenuId))); } protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { this.lbtnAttach.Text = string.Empty; string url = string.Empty; var attLists = BLL.AttachFileService.Getfiles(this.hdId.Text, BLL.Const.MonthReportMenuId); if (attLists != null) { List lists = Funs.GetStrListByStr(attLists.AttachUrl, ','); if (lists.Count > 0) { foreach (var item in lists) { url += item.Substring(item.IndexOf('_') + 1) + "\r\n"; } } if (!string.IsNullOrEmpty(url)) { this.lbtnAttach.Text = url; } } } #endregion } }