2024-01-29 18:34:54 +08:00
|
|
|
|
using Aspose.Words.Lists;
|
|
|
|
|
using BLL;
|
2022-03-15 17:36:38 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.Hazard
|
|
|
|
|
{
|
|
|
|
|
public partial class HazardTemplate : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 定义集合
|
|
|
|
|
public string HazardListId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["HazardListId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["HazardListId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工作阶段值
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string WorkStageIds
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["WorkStageIds"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["WorkStageIds"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static List<Model.Hazard_HazardSelectedItem> hazardSelectedItems = new List<Model.Hazard_HazardSelectedItem>();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 定义集合
|
|
|
|
|
/// </summary>
|
2024-01-29 18:34:54 +08:00
|
|
|
|
private static HashSet<string> list = new HashSet<string>();
|
|
|
|
|
private static HashSet<string> listNoSelected = new HashSet<string>();
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#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);
|
2024-01-29 18:34:54 +08:00
|
|
|
|
list = new HashSet<string>();
|
|
|
|
|
listNoSelected= new HashSet<string>();
|
|
|
|
|
WorkStageService.InitWorkPostDropDownList(this.drpWorkStages, false);
|
2022-03-15 17:36:38 +08:00
|
|
|
|
this.HazardListId = Request.Params["HazardListId"];
|
|
|
|
|
this.WorkStageIds = Request.Params["WorkStageIds"];
|
|
|
|
|
if (!string.IsNullOrEmpty(this.WorkStageIds))
|
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
this.drpWorkStages.SelectedValueArray = this.WorkStageIds.Split(',');
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
hazardSelectedItems = BLL.Hazard_HazardSelectedItemService.GetHazardSelectedItemsByHazardListId(this.HazardListId);
|
|
|
|
|
foreach (var item in hazardSelectedItems)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(item.HazardListTypeId))
|
|
|
|
|
{
|
|
|
|
|
Model.Technique_HazardListType hazardListType = BLL.HazardListTypeService.GetHazardListTypeById(item.HazardListTypeId);
|
|
|
|
|
if (hazardListType != null)
|
|
|
|
|
{
|
|
|
|
|
if (hazardListType.IsCompany == true)
|
|
|
|
|
{
|
|
|
|
|
rblIsCompany.SelectedValue = "1";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rblIsCompany.SelectedValue = "0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取编辑页面上的工作阶段保存到list集合里
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取编辑页面上的工作阶段保存到list集合里
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void GetHazardSelectedItem()
|
|
|
|
|
{
|
|
|
|
|
hazardSelectedItems = BLL.Hazard_HazardSelectedItemService.GetHazardSelectedItemsByHazardListId(this.HazardListId);
|
|
|
|
|
if (hazardSelectedItems.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
string i = string.Empty;
|
|
|
|
|
string j = string.Empty;
|
|
|
|
|
foreach (var item in hazardSelectedItems)
|
|
|
|
|
{
|
|
|
|
|
foreach (var workStagesId in this.drpWorkStages.SelectedValueArray)
|
|
|
|
|
{
|
|
|
|
|
if (item.WorkStage == workStagesId)
|
|
|
|
|
{
|
|
|
|
|
i += item.HazardId + "," + workStagesId + "|";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(i))
|
|
|
|
|
{
|
|
|
|
|
j = i.Substring(0, i.LastIndexOf("|"));
|
|
|
|
|
list.Add(j);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载树
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化树
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void InitTreeMenu()
|
|
|
|
|
{
|
|
|
|
|
trHazardListType.Nodes.Clear();
|
|
|
|
|
trHazardListType.ShowBorder = false;
|
|
|
|
|
trHazardListType.ShowHeader = false;
|
|
|
|
|
trHazardListType.EnableIcons = true;
|
|
|
|
|
trHazardListType.AutoScroll = true;
|
|
|
|
|
trHazardListType.EnableSingleClickExpand = true;
|
|
|
|
|
TreeNode rootNode = new TreeNode
|
|
|
|
|
{
|
|
|
|
|
Text = "危险源清单",
|
|
|
|
|
NodeID = "0",
|
2024-01-29 18:34:54 +08:00
|
|
|
|
EnableCheckEvent = true,
|
2022-03-15 17:36:38 +08:00
|
|
|
|
Expanded = true
|
|
|
|
|
};
|
|
|
|
|
this.trHazardListType.Nodes.Add(rootNode);
|
|
|
|
|
string[] workStages = this.drpWorkStages.SelectedValueArray;
|
|
|
|
|
var works = BLL.WorkStageService.GetWorkStageList();
|
|
|
|
|
foreach (var item in workStages)
|
|
|
|
|
{
|
|
|
|
|
TreeNode newNode = new TreeNode
|
|
|
|
|
{
|
|
|
|
|
Text = works.FirstOrDefault(x => x.WorkStageId == item).WorkStageName,
|
|
|
|
|
NodeID = item,
|
2024-01-29 18:34:54 +08:00
|
|
|
|
EnableCheckEvent = true,
|
2022-03-15 17:36:38 +08:00
|
|
|
|
CommandArgument = item
|
|
|
|
|
};
|
|
|
|
|
rootNode.Nodes.Add(newNode);
|
|
|
|
|
BoundTree(newNode, "0"); //newNode.Nodes,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void BoundTree(TreeNode node, string supHazardListTypeId)
|
2024-01-29 18:34:54 +08:00
|
|
|
|
{
|
2022-03-15 17:36:38 +08:00
|
|
|
|
var dt = GetNewHazardListType(node, supHazardListTypeId);
|
|
|
|
|
if (dt.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
TreeNode tn = null;
|
|
|
|
|
foreach (var dr in dt)
|
|
|
|
|
{
|
|
|
|
|
tn = new TreeNode
|
|
|
|
|
{
|
|
|
|
|
Text = dr.HazardListTypeName,
|
|
|
|
|
ToolTip = dr.HazardListTypeName,
|
|
|
|
|
NodeID = node.NodeID + "#" + dr.HazardListTypeId,
|
|
|
|
|
CommandArgument = node.CommandArgument,
|
2024-01-29 18:34:54 +08:00
|
|
|
|
EnableCheckEvent = true,
|
2022-03-15 17:36:38 +08:00
|
|
|
|
EnableClickEvent = true
|
|
|
|
|
};
|
|
|
|
|
node.Nodes.Add(tn);
|
|
|
|
|
BoundTree(tn, dr.HazardListTypeId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 得到树方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 得到菜单方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parentId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private List<Model.Technique_HazardListType> GetNewHazardListType(TreeNode tn, string parentId)
|
|
|
|
|
{
|
|
|
|
|
string nodeId = tn.NodeID;
|
|
|
|
|
if (nodeId.Contains("#"))
|
|
|
|
|
{
|
|
|
|
|
nodeId = nodeId.Substring(nodeId.LastIndexOf('#') + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (parentId.Contains("#"))
|
|
|
|
|
{
|
|
|
|
|
parentId = parentId.Substring(parentId.LastIndexOf('#') + 1);
|
|
|
|
|
}
|
|
|
|
|
List<Model.Technique_HazardListType> hazardListType = new List<Model.Technique_HazardListType>();
|
|
|
|
|
if (this.rblIsCompany.SelectedValue == "1")//本公司危险源
|
|
|
|
|
{
|
|
|
|
|
if (parentId == "0")
|
|
|
|
|
{
|
|
|
|
|
hazardListType = (from x in Funs.DB.Technique_HazardListType where x.IsCompany == true && x.SupHazardListTypeId == parentId && x.WorkStage.Contains(nodeId) orderby x.HazardListTypeCode select x).ToList();
|
|
|
|
|
if (hazardListType.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
hazardListType = (from x in Funs.DB.Technique_HazardListType where x.IsCompany == true && x.SupHazardListTypeId == parentId && x.WorkStage == null orderby x.HazardListTypeCode select x).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
hazardListType = (from x in Funs.DB.Technique_HazardListType where x.IsCompany == true && x.SupHazardListTypeId == parentId orderby x.HazardListTypeCode select x).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (parentId == "0")
|
|
|
|
|
{
|
|
|
|
|
hazardListType = (from x in Funs.DB.Technique_HazardListType where (x.IsCompany == false || x.IsCompany == null) && x.SupHazardListTypeId == parentId && x.WorkStage.Contains(nodeId) orderby x.HazardListTypeCode select x).ToList();
|
|
|
|
|
if (hazardListType == null)
|
|
|
|
|
{
|
|
|
|
|
hazardListType = (from x in Funs.DB.Technique_HazardListType where (x.IsCompany == false || x.IsCompany == null) && x.SupHazardListTypeId == parentId && x.WorkStage == null orderby x.HazardListTypeCode select x).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
hazardListType = (from x in Funs.DB.Technique_HazardListType where (x.IsCompany == false || x.IsCompany == null) && x.SupHazardListTypeId == parentId orderby x.HazardListTypeCode select x).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return hazardListType;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 点击树节点
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 点击树节点
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void trHazardListType_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 绑定Grid
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定Grid
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
string[] nodeIds = this.trHazardListType.GetCheckedNodeIDs();
|
|
|
|
|
Dictionary<string, List<string>> ids = new Dictionary<string, List<string>>();
|
|
|
|
|
foreach (var nodeId in nodeIds)
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(nodeId) && nodeId.Contains("#"))
|
|
|
|
|
{
|
|
|
|
|
string wid = nodeId.Substring(0, nodeId.IndexOf('#'));
|
|
|
|
|
|
|
|
|
|
string nid = nodeId.Substring(nodeId.LastIndexOf('#') + 1);
|
|
|
|
|
if (ids.ContainsKey(wid))
|
|
|
|
|
{
|
|
|
|
|
ids[wid].Add(nid);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ids.Add(wid, new List<string>());
|
|
|
|
|
ids[wid].Add(nid);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
2024-01-29 18:34:54 +08:00
|
|
|
|
if (ids.Count > 0)
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
int ii = 0;
|
|
|
|
|
string strSql = "";
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
2024-01-29 18:34:54 +08:00
|
|
|
|
foreach (string key in ids.Keys)
|
|
|
|
|
{
|
|
|
|
|
var idStr = string.Join("','", ids[key].ToArray());
|
|
|
|
|
strSql += @"SELECT '"+ key + "|'+ H.HazardId id, '" + key + @"' wid, H.HazardId,T.HazardListTypeId,T.HazardListTypeCode,T.HazardListTypeName,H.HazardCode,H.HazardItems,H.DefectsType,"
|
|
|
|
|
+ @" H.MayLeadAccidents,H.HelperMethod,H.HazardJudge_L,H.HazardJudge_E,H.HazardJudge_C,H.HazardJudge_D,RiskLevel.RiskLevelName AS HazardLevel,"
|
|
|
|
|
+ @" H.ControlMeasures,H.CompileMan,H.CompileDate,H.AuditMan,H.AuditDate,H.IsPass,U.UserName AS CompileManName,UR.UserName AS AuditManName"
|
|
|
|
|
+ @" FROM Technique_HazardList AS H"
|
|
|
|
|
+ @" LEFT JOIN Technique_HazardListType AS T ON T.HazardListTypeId = H.HazardListTypeId"
|
|
|
|
|
+ @" LEFT JOIN Sys_User AS U ON U.UserId = H.CompileMan"
|
|
|
|
|
+ @" LEFT JOIN Sys_User AS UR ON UR.UserId = H.AuditMan"
|
|
|
|
|
+ @" LEFT JOIN Base_RiskLevel AS RiskLevel ON RiskLevel.RiskLevel= H.HazardLevel "
|
|
|
|
|
;
|
|
|
|
|
strSql += @" WHERE T.HazardListTypeId in ('" + idStr + "') ";
|
|
|
|
|
if (ii != (ids.Count - 1))
|
|
|
|
|
{
|
|
|
|
|
strSql += " union all ";
|
|
|
|
|
}
|
|
|
|
|
ii++;
|
|
|
|
|
}
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, null);
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
list.Clear();
|
|
|
|
|
foreach (DataRow row in tb.Rows)
|
|
|
|
|
{
|
|
|
|
|
if (!listNoSelected.Contains(row["id"].ToString()))
|
|
|
|
|
{
|
|
|
|
|
list.Add(row["id"].ToString());
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
2024-01-29 18:34:54 +08:00
|
|
|
|
}
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
if (list.Count() > 0)
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
for (int i = 0; i < Grid1.Rows.Count; i++)
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
string id = Grid1.DataKeys[i][0].ToString();
|
|
|
|
|
if (list.Contains(id))
|
|
|
|
|
{
|
|
|
|
|
CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected");
|
|
|
|
|
checkField.SetCheckedState(i, true);
|
|
|
|
|
///Grid1.Rows[i].Values[0] = true;
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-29 18:34:54 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Grid1.RecordCount = 0;
|
|
|
|
|
Grid1.DataSource = null;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 表分页、排序
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 页索引改变事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grid排序
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.SortDirection = e.SortDirection;
|
|
|
|
|
Grid1.SortField = e.SortField;
|
|
|
|
|
|
|
|
|
|
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 Grid行双击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 双击行事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.EditData();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 增加明细
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加危险源清单事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnNewDetail_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.trHazardListType.SelectedNode != null)
|
|
|
|
|
{
|
|
|
|
|
if (this.trHazardListType.SelectedNode.Nodes.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../Technique/HazardListEdit.aspx?HazardListTypeId={0}", this.trHazardListType.SelectedNode.NodeID, "编辑 - ")));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择末级节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Grid行点击事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grid1行点击事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GetHazardSelectedItem();
|
2024-01-29 18:34:54 +08:00
|
|
|
|
string rowID = Grid1.DataKeys[e.RowIndex][0].ToString();
|
2022-03-15 17:36:38 +08:00
|
|
|
|
if (e.CommandName == "IsSelected")
|
|
|
|
|
{
|
|
|
|
|
CheckBoxField checkField = (CheckBoxField)Grid1.FindColumn("ckbIsSelected");
|
|
|
|
|
if (checkField.GetCheckedState(e.RowIndex))
|
|
|
|
|
{
|
|
|
|
|
if (!list.Contains(rowID))
|
|
|
|
|
{
|
|
|
|
|
list.Add(rowID);
|
|
|
|
|
}
|
2024-01-29 18:34:54 +08:00
|
|
|
|
if (listNoSelected.Contains(rowID))
|
|
|
|
|
{
|
|
|
|
|
listNoSelected.Remove(rowID);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (list.Contains(rowID))
|
|
|
|
|
{
|
|
|
|
|
list.Remove(rowID);
|
|
|
|
|
}
|
2024-01-29 18:34:54 +08:00
|
|
|
|
listNoSelected.Add(rowID);
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 编辑明细
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑危险源
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnEditDetail_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.EditData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键编辑事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.EditData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑数据方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void EditData()
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string hazardId = Grid1.SelectedRowID;
|
|
|
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../Technique/HazardListEdit.aspx?HazardId={0}", hazardId, "编辑 - ")));
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 删除明细
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除危险源
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnDeleteDetail_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.DeleteData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 右键删除事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.DeleteData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void DeleteData()
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
|
|
|
{
|
|
|
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
2024-01-29 18:34:54 +08:00
|
|
|
|
var getD = BLL.HazardListService.GetHazardListById(rowID);
|
2022-03-15 17:36:38 +08:00
|
|
|
|
if (getD != null)
|
|
|
|
|
{
|
|
|
|
|
if (BLL.Hazard_HazardSelectedItemService.GetHazardSelectedItemByHazardId(rowID) != null)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("在项目级危险源评价清单中已使用该资源,无法删除!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, getD.HazardCode, getD.HazardId, BLL.Const.HazardListMenuId, BLL.Const.BtnDelete);
|
|
|
|
|
BLL.HazardListService.DeleteHazardListById(rowID);
|
2024-01-29 18:34:54 +08:00
|
|
|
|
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BindGrid();
|
|
|
|
|
ShowNotify("删除数据成功!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 关闭危险源清单弹出窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭危险源清单弹出窗口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window2_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 确认按钮
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 确认按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (list.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请至少选择一项!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string ids = string.Empty;
|
2024-01-29 18:34:54 +08:00
|
|
|
|
|
2022-03-15 17:36:38 +08:00
|
|
|
|
foreach (var item in list)
|
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
ids += item + ",";
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(ids))
|
|
|
|
|
{
|
2024-01-29 18:34:54 +08:00
|
|
|
|
ids = ids.Substring(0, ids.LastIndexOf(","));
|
2022-03-15 17:36:38 +08:00
|
|
|
|
Session["workStages"] = ids;
|
|
|
|
|
}
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HazardListMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
|
|
|
{
|
|
|
|
|
this.btnNewDetail.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 选择是否本公司危险源
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 选择是否本公司工作阶段
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void rblIsCompany_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
InitTreeMenu();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2024-01-29 18:34:54 +08:00
|
|
|
|
|
|
|
|
|
protected void trHazardListType_NodeCheck(object sender, TreeCheckEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string BindWorkStages(object wid)
|
|
|
|
|
{
|
|
|
|
|
string res = "";
|
|
|
|
|
|
|
|
|
|
if (wid != null)
|
|
|
|
|
{
|
|
|
|
|
var w = Funs.DB.Base_WorkStage.FirstOrDefault(x => x.WorkStageId == wid.ToString());
|
|
|
|
|
if (w != null)
|
|
|
|
|
{
|
|
|
|
|
res = w.WorkStageName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|