| 
									
										
										
										
											2022-09-14 16:38:27 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Data.SqlClient; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using System.Web.UI; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.CLGL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class PipelineMaterialList : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (this.CurrUser.UserId == BLL.Const.hfnbdId) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.btnGetAll.Hidden = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); | 
					
						
							|  |  |  |  |                 // 绑定表格 | 
					
						
							|  |  |  |  |                 this.BindGrid(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 进入软件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnUrl_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(String.Format("window.open('https://mat.cwcec.com');")); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取全部 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnGetAll_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BLL.MCSWebService.GetCLData(null, null); | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnGet_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BLL.MCSWebService.getPipelineMaterialListInfo(BLL.ProjectService.GetCLProjectCodeByProjectId(this.CurrUser.LoginProjectId)); | 
					
						
							|  |  |  |  |             this.BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 绑定数据 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void BindGrid() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string strSql = @"select *
 | 
					
						
							|  |  |  |  |                             from dbo.CLGL_PipelineMaterialList c  | 
					
						
							| 
									
										
										
										
											2022-09-19 09:35:49 +08:00
										 |  |  |  |                             where c.ProjectId=@ProjectId ";
 | 
					
						
							| 
									
										
										
										
											2022-09-14 16:38:27 +08:00
										 |  |  |  |             List<SqlParameter> listStr = new List<SqlParameter>(); | 
					
						
							|  |  |  |  |             listStr.Add(new SqlParameter("@ProjectId", BLL.ProjectService.GetCLProjectCodeByProjectId(this.CurrUser.LoginProjectId))); | 
					
						
							| 
									
										
										
										
											2022-09-19 09:35:49 +08:00
										 |  |  |  |             if (!string.IsNullOrEmpty(txtC1.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C1 like @C1"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C1", "%" + txtC1.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC2.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C2 like @C2"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C2", "%" + txtC2.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC3.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C3 like @C3"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C3", "%" + txtC3.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC4.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C4 like @C4"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C4", "%" + txtC4.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC6.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C6 like @C6"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C6", "%" + txtC6.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC7.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C7 like @C7"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C7", "%" + txtC7.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC8.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C8 like @C8"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C8", "%" + txtC8.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC9.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C9 like @C9"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C9", "%" + txtC9.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC13.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C13 like @C13"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C13", "%" + txtC13.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC14.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C14 like @C14"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C14", "%" + txtC14.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC15.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C15 like @C15"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C15", "%" + txtC15.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC21.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C21 like @C21"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C21", "%" + txtC21.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC22.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C22 like @C22"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C22", "%" + txtC22.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC23.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C23 like @C23"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C23", "%" + txtC23.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC24.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C24 like @C24"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C24", "%" + txtC24.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC26.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C26 like @C26"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C26", "%" + txtC26.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(txtC29.Text.Trim())) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 strSql += " AND c.C29 like @C29"; | 
					
						
							|  |  |  |  |                 listStr.Add(new SqlParameter("@C29", "%" + txtC29.Text.Trim() + "%")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             strSql += " order by c.C28 desc"; | 
					
						
							| 
									
										
										
										
											2022-09-14 16:38:27 +08:00
										 |  |  |  |             SqlParameter[] parameter = listStr.ToArray(); | 
					
						
							|  |  |  |  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); | 
					
						
							|  |  |  |  |             Grid1.RecordCount = tb.Rows.Count; | 
					
						
							|  |  |  |  |             //tb = GetFilteredTable(Grid1.FilteredData, tb); | 
					
						
							|  |  |  |  |             var table = this.GetPagedDataTable(Grid1, tb); | 
					
						
							|  |  |  |  |             Grid1.DataSource = table; | 
					
						
							|  |  |  |  |             Grid1.DataBind(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-19 09:35:49 +08:00
										 |  |  |  |         protected void btnQuery_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected void btnRset_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             txtC1.Text = ""; | 
					
						
							|  |  |  |  |             txtC2.Text = ""; | 
					
						
							|  |  |  |  |             txtC3.Text = ""; | 
					
						
							|  |  |  |  |             txtC4.Text = ""; | 
					
						
							|  |  |  |  |             txtC6.Text = ""; | 
					
						
							|  |  |  |  |             txtC7.Text = ""; | 
					
						
							|  |  |  |  |             txtC8.Text = ""; | 
					
						
							|  |  |  |  |             txtC9.Text = ""; | 
					
						
							|  |  |  |  |             txtC13.Text = ""; | 
					
						
							|  |  |  |  |             txtC14.Text = ""; | 
					
						
							|  |  |  |  |             txtC15.Text = ""; | 
					
						
							|  |  |  |  |             txtC21.Text = ""; | 
					
						
							|  |  |  |  |             txtC22.Text = ""; | 
					
						
							|  |  |  |  |             txtC23.Text = ""; | 
					
						
							|  |  |  |  |             txtC24.Text = ""; | 
					
						
							|  |  |  |  |             txtC26.Text = ""; | 
					
						
							|  |  |  |  |             txtC29.Text = ""; | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-14 16:38:27 +08:00
										 |  |  |  |         #region 分页 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 分页 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 分页显示条数下拉框 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 排序 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             BindGrid(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |