96 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			96 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using BLL.CQMS.Comprehensive; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Data; | |||
|  | using System.Data.SqlClient; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.Transfer.Chart | |||
|  | { | |||
|  |     public partial class PunchlistFromProgress : PageBase | |||
|  |     { | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 BindGrid(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 数据绑定 | |||
|  |         /// </summary> | |||
|  |         public void BindGrid() | |||
|  |         { | |||
|  |             StringBuilder strSql = new StringBuilder(""); | |||
|  |             strSql.AppendLine("IF OBJECT_ID('tempdb..#AllPunchlistFromProgressTemp') IS NOT NULL drop table #AllPunchlistFromProgressTemp; "); | |||
|  |             strSql.AppendLine("IF OBJECT_ID('tempdb..#PunchlistFromProgressTemp') IS NOT NULL drop table #PunchlistFromProgressTemp; "); | |||
|  |             strSql.AppendLine(" select System_No,Actual_Date,Cleared_By,Confirmed_By,Verified_By,ProjectId "); | |||
|  |             strSql.AppendLine(" INTO #AllPunchlistFromProgressTemp from Transfer_PunchlistFrom where ProjectId = @ProjectId "); | |||
|  |             strSql.AppendLine(" select System_No,count(System_No) SystemNoCount,cast(0 as decimal(18,2)) ActualDateCount "); | |||
|  |             strSql.AppendLine(" ,cast(0 as decimal(18,2)) ClearedByCount,cast(0 as decimal(18,2)) ConfirmedByCount,cast(0 as decimal(18,2)) VerifiedByCount "); | |||
|  |             strSql.AppendLine(" INTO #PunchlistFromProgressTemp from #AllPunchlistFromProgressTemp where ProjectId = @ProjectId group by System_No "); | |||
|  |             strSql.AppendLine(" update  a set a.ActualDateCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Actual_Date,'')<>'')  "); | |||
|  |             strSql.AppendLine(" ,a.ClearedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Cleared_By,'')<>'') "); | |||
|  |             strSql.AppendLine(" ,a.ConfirmedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Confirmed_By,'')<>'')  "); | |||
|  |             strSql.AppendLine(" ,a.VerifiedByCount=(select count(1) from #AllPunchlistFromProgressTemp b where a.System_No=b.System_No AND isnull(b.Verified_By,'')<>'') "); | |||
|  |             strSql.AppendLine(" from #PunchlistFromProgressTemp a "); | |||
|  |             strSql.AppendLine(" select *  from #PunchlistFromProgressTemp "); | |||
|  |             List<SqlParameter> listStr = new List<SqlParameter>(); | |||
|  |             listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); | |||
|  | 
 | |||
|  |             strSql.AppendLine(" order by System_No "); | |||
|  |             SqlParameter[] parameter = listStr.ToArray(); | |||
|  |             DataTable tb = SQLHelper.GetDataTableRunText(strSql.ToString(), parameter); | |||
|  |             Grid1.RecordCount = tb.Rows.Count; | |||
|  |             var table = this.GetPagedDataTable(Grid1, tb); | |||
|  |             Grid1.DataSource = table; | |||
|  |             Grid1.DataBind(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <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_PageIndexChange(object sender, GridPageEventArgs e) | |||
|  |         { | |||
|  |             BindGrid(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 排序 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) | |||
|  |         { | |||
|  |             Grid1.SortDirection = e.SortDirection; | |||
|  |             Grid1.SortField = e.SortField; | |||
|  |             BindGrid(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 查询 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSearch_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             BindGrid(); | |||
|  |         } | |||
|  |     } | |||
|  | } |