2023-03-25 14:46:00 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using FineUIPro.Web.BaseInfo;
|
|
|
|
|
using Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using static NPOI.HSSF.Util.HSSFColor;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
|
|
|
{
|
|
|
|
|
public partial class Accident : 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();
|
2023-06-07 18:55:33 +08:00
|
|
|
|
this.Panel1.Title = "事故事件数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")";
|
2023-03-25 14:46:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
|
|
|
|
string strSql = string.Empty;
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
|
|
|
|
|
if (rbType.SelectedValue == "0" || rbType.SelectedValue == "1")
|
|
|
|
|
{
|
|
|
|
|
strSql = @"SELECT Record.AccidentPersonRecordId AS ID,Record.ProjectId,Project.ProjectCode,Project.ProjectName,
|
|
|
|
|
Record.AccidentTypeId,AccidentType.AccidentTypeName,Record.AccidentDate
|
|
|
|
|
,Unit.UnitId,Unit.UnitName,Record.States, 1 AS PeopleNum
|
|
|
|
|
,(CASE WHEN Record.Injury =1 THEN '死亡' WHEN Record.Injury =2 THEN '重伤' ELSE '轻伤' END) AS Info
|
|
|
|
|
FROM Accident_AccidentPersonRecord AS Record
|
|
|
|
|
LEFT JOIN Base_AccidentType AS AccidentType ON AccidentType.AccidentTypeId = Record.AccidentTypeId
|
|
|
|
|
LEFT JOIN Base_Project AS Project ON Record.ProjectId = Project.ProjectId
|
|
|
|
|
LEFT JOIN SitePerson_Person AS Person ON Person.PersonId = Record.PersonId
|
|
|
|
|
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Person.UnitId
|
|
|
|
|
WHERE 1=1 ";
|
|
|
|
|
|
|
|
|
|
if (rbType.SelectedValue == "0")
|
|
|
|
|
{
|
2023-06-07 18:55:33 +08:00
|
|
|
|
strSql += " AND Record.IsAttempt='1'";
|
2023-03-25 14:46:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql = @"SELECT Record.AccidentReportId AS ID,Record.ProjectId,Project.ProjectCode,Project.ProjectName,
|
|
|
|
|
Record.AccidentTypeId,ConstText AS AccidentTypeName,Record.AccidentDate
|
2023-06-07 18:55:33 +08:00
|
|
|
|
,Unit.UnitId,Unit.UnitName,Record.States, Record.PeopleNum
|
2023-03-25 14:46:00 +08:00
|
|
|
|
, Record.Abstract AS Info
|
|
|
|
|
FROM Accident_AccidentReport AS Record
|
|
|
|
|
LEFT JOIN Sys_Const AS AccidentType ON AccidentType.ConstValue = Record.AccidentTypeId AND GroupId='AccidentReportRegistration'
|
|
|
|
|
LEFT JOIN Base_Project AS Project ON Record.ProjectId = Project.ProjectId
|
|
|
|
|
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId = Record.UnitId
|
|
|
|
|
WHERE 1 = 1 ";
|
|
|
|
|
if (rbType.SelectedValue == "2")
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Record.AccidentDegree ='1'";
|
|
|
|
|
}
|
|
|
|
|
else if (rbType.SelectedValue == "3")
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Record.AccidentDegree ='2'";
|
|
|
|
|
}
|
|
|
|
|
else if (rbType.SelectedValue == "4")
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Record.AccidentDegree ='3'";
|
|
|
|
|
}
|
|
|
|
|
else if (rbType.SelectedValue == "5")
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Record.AccidentDegree ='4'";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.drpProject.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND Record.ProjectId = @ProjectId";
|
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", this.drpProject.SelectedValue));
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
#region Grid双击事件 编辑
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grid行双击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
EditData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void EditData()
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.rbType.SelectedValue == "0" || this.rbType.SelectedValue == "1")
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/Accident/AccidentPersonRecordView.aspx?AccidentPersonRecordId={0}", Grid1.SelectedRowID, "查看 - ")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/Accident/AccidentReportView.aspx?AccidentReportId={0}", Grid1.SelectedRowID, "查看 - ")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
protected void btnView_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
EditData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|