CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/DataShow/HJGLDefect.aspx.cs

127 lines
4.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using FineUIPro.Web.BaseInfo;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.DataShow
{
public partial class HJGLDefect : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
// 绑定表格t
BindGrid();
this.Panel1.Title = "焊接缺陷数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + "";
}
}
#endregion
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT Project.ProjectId,Project.ProjectName,Project.ProjectCode,Defects_Definition,COUNT(Item.CHT_CheckItemID) AS Counts
FROM CH_CheckItem AS Item
LEFT JOIN CH_Check AS Checks ON Item.CHT_CheckID =Checks.CHT_CheckID
LEFT JOIN Base_Project AS Project ON Checks.ProjectId =Project.ProjectId
WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (this.drpProject.SelectedValue != Const._Null)
{
strSql += " AND Checks.projectId = @projectId"; ///状态为已完成
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
}
//if (!string.IsNullOrEmpty(this.txtStartTime.Text))
//{
// strSql += " AND h.RegisterDate >=@StartTime";
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
//}
//if (!string.IsNullOrEmpty(this.txtEndTime.Text))
//{
// strSql += " AND h.RegisterDate <=@EndTime";
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
//}
strSql += " GROUP BY Project.ProjectId,Project.ProjectName,Project.ProjectCode,Defects_Definition";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
}
#endregion
#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 Grid1_Sort(object sender, GridSortEventArgs 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 Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
}
}