This commit is contained in:
2023-11-13 17:47:53 +08:00
4 changed files with 193 additions and 100 deletions
@@ -57,57 +57,62 @@ namespace FineUIPro.Web.HSSE.Check
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT CheckSpecial.CheckSpecialId,CodeRecords.Code AS CheckSpecialCode,"
+ @" CheckItemSet.CheckItemName,CheckSpecial.CheckTime,(CASE WHEN CheckSpecial.CheckType ='1' THEN '联合检查' ELSE '专项检查' END) AS CheckTypeName"
+ @" ,(CASE WHEN CheckSpecial.States='2' THEN '已完成' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName"
+ @" FROM Check_CheckSpecial AS CheckSpecial "
+ @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckSpecial.CheckSpecialId=CodeRecords.DataId "
+ @" LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId = CheckSpecial.CheckItemSetId where 1=1";
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " AND CheckSpecial.ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
//string strSql = @"SELECT CheckSpecial.CheckSpecialId,CodeRecords.Code AS CheckSpecialCode,"
// + @" CheckItemSet.CheckItemName,CheckSpecial.CheckTime,(CASE WHEN CheckSpecial.CheckType ='1' THEN '联合检查' ELSE '专项检查' END) AS CheckTypeName"
// + @" ,(CASE WHEN CheckSpecial.States='2' THEN '已完成' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName"
// + @" FROM Check_CheckSpecial AS CheckSpecial "
// + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckSpecial.CheckSpecialId=CodeRecords.DataId "
// + @" LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId = CheckSpecial.CheckItemSetId where 1=1";
//List<SqlParameter> listStr = new List<SqlParameter>();
//strSql += " AND CheckSpecial.ProjectId = @ProjectId";
//listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
if (this.rbStates.SelectedValue != "-1")
{
strSql += " AND CheckSpecial.States = @States";
listStr.Add(new SqlParameter("@States", this.rbStates.SelectedValue));
}
if (this.rbType.SelectedValue != "-1")
{
if (this.rbType.SelectedValue == "1")
{
strSql += " AND CheckSpecial.CheckType = @CheckType";
listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue));
}
else
{
strSql += " AND (CheckSpecial.CheckType = @CheckType OR CheckSpecial.CheckType IS NULL) ";
listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue));
}
}
if (this.drpSupCheckItemSet.SelectedValue != BLL.Const._Null)
{
strSql += " AND CheckSpecial.CheckItemSetId = @CheckItemSetId";
listStr.Add(new SqlParameter("@CheckItemSetId", this.drpSupCheckItemSet.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
{
strSql += " AND CheckSpecial.CheckTime >= @StartTime";
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
{
strSql += " AND CheckSpecial.CheckTime <= @EndTime";
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
}
//if (this.rbStates.SelectedValue != "-1")
//{
// strSql += " AND CheckSpecial.States = @States";
// listStr.Add(new SqlParameter("@States", this.rbStates.SelectedValue));
//}
//if (this.rbType.SelectedValue != "-1")
//{
// if (this.rbType.SelectedValue == "1")
// {
// strSql += " AND CheckSpecial.CheckType = @CheckType";
// listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue));
// }
// else
// {
// strSql += " AND (CheckSpecial.CheckType = @CheckType OR CheckSpecial.CheckType IS NULL) ";
// listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue));
// }
//}
//if (this.drpSupCheckItemSet.SelectedValue != BLL.Const._Null)
//{
// strSql += " AND CheckSpecial.CheckItemSetId = @CheckItemSetId";
// listStr.Add(new SqlParameter("@CheckItemSetId", this.drpSupCheckItemSet.SelectedValue));
//}
//if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
//{
// strSql += " AND CheckSpecial.CheckTime >= @StartTime";
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
//}
//if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
//{
// strSql += " AND CheckSpecial.CheckTime <= @EndTime";
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
//}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
//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();
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
var getData = Check_CheckSpecialService.getListData(this.ProjectId, this.rbStates.SelectedValue, this.rbType.SelectedValue, this.drpSupCheckItemSet.SelectedValue,
Funs.GetNewDateTime(txtStartTime.Text.Trim()), Funs.GetNewDateTime(this.txtEndTime.Text.Trim()), Grid1);
Grid1.RecordCount = Check_CheckSpecialService.count;
Grid1.DataSource = getData;
Grid1.DataBind();
}
#endregion