20230324新增集团查看数据跳转页面、现场人员卡号补漏按钮功能
This commit is contained in:
@@ -0,0 +1,205 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
public partial class SecurityRiskItem : PageBase
|
||||
{
|
||||
|
||||
#region 加载页面
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
string projectId = Request.Params["projectId"];
|
||||
this.txtProject.Text=ProjectService.GetProjectNameByProjectId(projectId);
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"select Item.HazardSelectedItemId,Item.HazardListId,List.IdentificationDate,List.WorkAreaName,Item.WorkStage,Item.HazardListTypeId
|
||||
, Item.HazardListTypeId,Item.HazardId,Item.HazardItems,Item.DefectsType,Item.MayLeadAccidents
|
||||
,Item.HelperMethod,Item.HazardJudge_L,Item.HazardJudge_E,Item.HazardJudge_C,Item.HazardJudge_E
|
||||
,level.RiskLevelName,Item.ControlMeasures
|
||||
from Hazard_HazardSelectedItem AS Item
|
||||
LEFT JOIN Hazard_HazardList AS List on List.HazardListId = Item.HazardListId
|
||||
LEFT JOIN Base_RiskLevel as level on level.RiskLevelId = Item.HazardLevel
|
||||
WHERE List.States = " + BLL.Const.State_2;
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
strSql += " AND List.ProjectId = @ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", Request.Params["projectId"]));
|
||||
if (!string.IsNullOrEmpty(txtStartTime.Text.Trim()))
|
||||
{
|
||||
strSql += " AND List.IdentificationDate >= @StartTime";
|
||||
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
|
||||
{
|
||||
strSql += " AND List.IdentificationDate <= @EndTime";
|
||||
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
|
||||
}
|
||||
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();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 转换字符串
|
||||
/// <summary>
|
||||
/// 转换工作阶段
|
||||
/// </summary>
|
||||
/// <param name="workStage"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertWorkStage(object workStage)
|
||||
{
|
||||
if (workStage != null)
|
||||
{
|
||||
string workStages = string.Empty;
|
||||
string[] strList = workStage.ToString().Split(',');
|
||||
foreach (string str in strList)
|
||||
{
|
||||
Model.Base_WorkStage c = BLL.WorkStageService.GetWorkStageById(str);
|
||||
if (c != null)
|
||||
{
|
||||
workStages += c.WorkStageName + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(workStages))
|
||||
{
|
||||
workStages = workStages.Substring(0, workStages.LastIndexOf(","));
|
||||
}
|
||||
return workStages;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危险源编号
|
||||
/// </summary>
|
||||
/// <param name="WorkStage"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertHazardCode(object HazardId)
|
||||
{
|
||||
string hazardCode = string.Empty;
|
||||
if (HazardId != null)
|
||||
{
|
||||
Model.Technique_HazardList hazardList = BLL.HazardListService.GetHazardListById(HazardId.ToString());
|
||||
if (hazardList != null)
|
||||
{
|
||||
hazardCode = hazardList.HazardCode;
|
||||
}
|
||||
}
|
||||
return hazardCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危险源类别
|
||||
/// </summary>
|
||||
/// <param name="hazardListTypeId"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertSupHazardListTypeId(object hazardListTypeId)
|
||||
{
|
||||
if (hazardListTypeId != null)
|
||||
{
|
||||
Model.Technique_HazardListType hazardListType = BLL.HazardListTypeService.GetHazardListTypeById(hazardListTypeId.ToString());
|
||||
if (hazardListType != null)
|
||||
{
|
||||
var hazard = BLL.HazardListTypeService.GetHazardListTypeById(hazardListType.SupHazardListTypeId);
|
||||
if (hazard != null)
|
||||
{
|
||||
return hazard.HazardListTypeName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取危险源项
|
||||
/// </summary>
|
||||
/// <param name="hazardListTypeId"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertHazardListTypeId(object hazardListTypeId)
|
||||
{
|
||||
if (hazardListTypeId != null)
|
||||
{
|
||||
Model.Technique_HazardListType hazardListType = BLL.HazardListTypeService.GetHazardListTypeById(hazardListTypeId.ToString());
|
||||
if (hazardListType != null)
|
||||
{
|
||||
return hazardListType.HazardListTypeName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user