using BLL; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web.UI.WebControls; namespace FineUIPro.Web.WeldMat.ReleaseRecovery { public partial class ReleaseRecoveryPrint : PageBase { #region 定义集合 /// /// 定义集合 /// private static List releaseRecoverys = new List(); #endregion #region 加载页面 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string projectId = Request.Params["projectId"]; string startDate = Request.Params["startDate"]; string endDate = Request.Params["endDate"]; if (!string.IsNullOrEmpty(projectId)) { var project = BLL.Base_ProjectService.GetProjectByProjectId(projectId); if (project != null) { this.txtProjectCode.Text = project.ProjectCode; this.txtProjectName.Text = project.ProjectName; } releaseRecoverys = (from x in Funs.DB.Weld_View_ReleaseRecovery where x.ProjectId == projectId orderby x.Years, x.Months, x.Dayt descending select x).ToList(); if (!string.IsNullOrEmpty(startDate)) { releaseRecoverys = releaseRecoverys.Where(x => x.UsingDate >= Funs.GetNewDateTime(startDate)).ToList(); } if (!string.IsNullOrEmpty(endDate)) { releaseRecoverys = releaseRecoverys.Where(x => x.UsingDate <= Funs.GetNewDateTime(endDate)).ToList(); } this.gvElectrodeRecovery.DataSource = releaseRecoverys; this.gvElectrodeRecovery.DataBind(); } } } #endregion #region Grid行绑定事件 /// /// Grid行绑定事件 /// /// /// protected void gvElectrodeRecovery_DataBound(object sender, EventArgs e) { int counts = this.gvElectrodeRecovery.Rows.Count; for (int i = 0; i < counts; i++) { System.Web.UI.WebControls.Label lblId = (System.Web.UI.WebControls.Label)(this.gvElectrodeRecovery.Rows[i].FindControl("lblId")); System.Web.UI.WebControls.Image imgUsingManUrl = (System.Web.UI.WebControls.Image)(this.gvElectrodeRecovery.Rows[i].FindControl("imgUsingManUrl")); System.Web.UI.WebControls.Image imgStoreNameUrl = (System.Web.UI.WebControls.Image)(this.gvElectrodeRecovery.Rows[i].FindControl("imgStoreNameUrl")); Model.Weld_View_ReleaseRecovery releaseRecovery = (from x in Funs.DB.Weld_View_ReleaseRecovery where x.UsingMatId == lblId.Text.Trim() select x).FirstOrDefault(); if (releaseRecovery != null) { if (!string.IsNullOrEmpty(releaseRecovery.UsingManUrl)) { imgUsingManUrl.ImageUrl = releaseRecovery.UsingManUrl; } if (!string.IsNullOrEmpty(releaseRecovery.StoreNameUrl)) { imgStoreNameUrl.ImageUrl = releaseRecovery.StoreNameUrl; } } } } #endregion } }