提交代码

This commit is contained in:
2024-05-16 09:15:08 +08:00
parent 9a2ba1af64
commit 9191546586
27 changed files with 3505 additions and 12 deletions
@@ -0,0 +1,136 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionRisk.aspx.cs" Inherits="FineUIPro.Web.HSSE.Hazard.ConstructionRisk" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>施工作业风险</title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true"
EnableCollapse="true" Width="280px" Title="施工作业风险" ShowBorder="true" Layout="VBox"
ShowHeader="true" AutoScroll="true" BodyPadding="5px" IconFont="ArrowCircleLeft">
<Items>
<f:HiddenField runat="server" ID="hdState">
</f:HiddenField>
<f:Tree ID="tvControlItem" EnableCollapse="true" ShowHeader="false" Title="WBS"
OnNodeCommand="tvControlItem_NodeCommand111" AutoLeafIdentification="true"
runat="server" ShowBorder="false" EnableTextSelection="True">
</f:Tree>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center" ShowBorder="true"
Layout="VBox" ShowHeader="false" BodyPadding="5px" IconFont="PlusCircle" Title="施工作业风险"
TitleToolTip="施工作业风险" AutoScroll="true">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="危险源台账" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="Id"
EnableColumnLines="true" DataIDField="Id" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
OnPageIndexChange="Grid1_PageIndexChange" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar1" runat="server" Position="Top">
<Items>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" Icon="SystemSave" runat="server" ToolTip="添加" Text="添加" ValidateForms="SimpleForm1"
OnClick="btnNew_Click">
</f:Button>
<f:Button ID="btnAudit" Text="安全经理审核" ToolTip="安全经理审核" Icon="ApplicationEdit" runat="server" OnClick="btnAudit_Click" ConfirmText="是否确认审核?" >
</f:Button>
<f:Button ID="btnImport" Text="导入" ToolTip="导入" Icon="ApplicationGet" runat="server" OnClick="btnImport_Click">
</f:Button>
<%-- <f:Button ID="btnQR" Text="生成二维码" ToolTip="生成二维码" Icon="TableRefresh" runat="server" OnClick="btnQR_Click">
</f:Button>--%>
<%--<f:Button runat="server" ID="btnSeeQR" OnClick="btnSeeQR_Click" Icon="Shading"
ToolTip="小程序二维码" Text="小程序二维码" Hidden="true">
</f:Button>--%>
<%-- <f:Button runat="server" ID="btnSeeQR1" OnClick="btnImport_Click" Icon="TableRefresh"
ToolTip="二维码" Text="二维码">
</f:Button>--%>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RenderField Width="100px" ColumnID="UnitWorkName" DataField="UnitWorkName"
SortField="UnitWorkName" FieldType="String" HeaderText="单位工程" TextAlign="Left"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="300px" ColumnID="ConstructionContent" DataField="ConstructionContent"
SortField="ConstructionContent" FieldType="String" HeaderText="施工内容" TextAlign="Left"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="RefLicense" DataField="RefLicense"
SortField="RefLicense" FieldType="String" HeaderText="涉及的高风险作业" TextAlign="Left"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="LicenseDes" DataField="LicenseDes"
SortField="LicenseDes" FieldType="String" HeaderText="作业风险描述" TextAlign="Left"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="RiskLevel" DataField="RiskLevel"
SortField="RiskLevel" FieldType="String" HeaderText="风险等级" TextAlign="Left"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="Measures" DataField="Measures" ExpandUnusedSpace="true"
SortField="Measures" FieldType="String" HeaderText="管控措施" TextAlign="Left"
HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="FlowOperateName" DataField="FlowOperateName"
SortField="FlowOperateName" FieldType="String" HeaderText="状态" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
<f:Listener Event="dataload" Handler="onGridDataLoad" />
</Listeners>
</f:Grid>
</Items>
</f:Panel>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="施工作业风险" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
Width="1000px" Height="600px">
</f:Window>
<f:Window ID="Window2" Title="施工作业风险" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Top" EnableResize="true" runat="server" OnClose="Window2_Close" IsModal="true"
Width="600px" Height="300px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
ConfirmText="删除选中行?" ConfirmTarget="Top" runat="server" Text="删除" Icon="Delete">
</f:MenuButton>
<f:MenuButton ID="btnMenuCheck" EnablePostBack="true" runat="server"
Text="巡检" Icon="ScriptLightning" OnClick="btnMenuCheck_Click">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function onGridDataLoad(event) {
this.mergeColumns(['UnitWorkName', 'ConstructionContent', 'RefLicense', 'LicenseDes','RiskLevel']);
}
</script>
</body>
</html>
@@ -0,0 +1,328 @@
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRisk : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetButtonPower();//权限设置
this.InitTreeMenu();//加载树
}
}
#region
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
List<Base_Unit> units = null;
var user = Person_PersonsService.GetPerson_PersonsById(this.CurrUser.PersonId);
if (!string.IsNullOrEmpty(user.UnitId))
{
var projectUnit = BLL.ProjectUnitService.GetProjectUnitByUnitIdProjectId(this.CurrUser.LoginProjectId, user.UnitId);
if (projectUnit != null)
{
if (projectUnit.UnitType == BLL.Const.ProjectUnitType_1 || projectUnit.UnitType == BLL.Const.ProjectUnitType_3 || projectUnit.UnitType == BLL.Const.ProjectUnitType_4)
{
var ids = Funs.DB.HSSE_ConstructionRisk.Select(x=>x.UnitId).Distinct().ToList();
units = (from x in Funs.DB.Base_Unit
where ids.Contains(x.UnitId)
select x).OrderBy(x => x.UnitCode).ToList();
}
else
{
units = (from x in Funs.DB.Base_Unit
where x.UnitId == this.CurrUser.UnitId select x).ToList();
}
}
}
else if (user.UnitId == Const.UnitId_SEDIN || user.PersonId == Const.hfnbdId)
{
var ids = Funs.DB.HSSE_ConstructionRisk.Select(x => x.UnitId).Distinct().ToList();
units = (from x in Funs.DB.Base_Unit
where ids.Contains(x.UnitId)
select x).OrderBy(x => x.UnitCode).ToList();
}
if (units != null && units.Count > 0)
{
foreach (var unit in units)
{
TreeNode rootNode = new TreeNode();
rootNode.Text = unit.UnitName;
rootNode.NodeID = unit.UnitId;
rootNode.ToolTip = "单位";
rootNode.Expanded = false;
this.tvControlItem.Nodes.Add(rootNode);
this.BindNodes(rootNode);
}
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
this.InitTreeMenu();
this.BindGrid();
}
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
if (hdState.Text == "A")
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../Check/RectifyNoticesAdd.aspx?ControlId={0}", ids[1], "编辑 - ")));
}
}
else if (hdState.Text == "B")
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HiddenInspection/HiddenRectificationAdd.aspx?ControlId={0}", ids[1], "编辑 - ")));
}
}
this.InitTreeMenu();
this.BindGrid();
}
#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();
}
#endregion
#region
/// <summary>
/// 删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <summary>
/// 右键删除明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
return;
}
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var ids =rowID.Split('|');
if (ids.Length >= 1)
{
var list = Funs.DB.HSSE_ConstructionRiskControl.Where(x => x.ConstructionRiskId == ids[0]).ToList();
Funs.DB.HSSE_ConstructionRiskControl.DeleteAllOnSubmit(list);
var constructionRisk = Funs.DB.HSSE_ConstructionRisk.Where(x => x.ConstructionRiskId == ids[0]).FirstOrDefault();
Funs.DB.HSSE_ConstructionRisk.DeleteOnSubmit(constructionRisk);
Funs.DB.SubmitChanges();
}
}
ShowNotify("删除成功!", MessageBoxIcon.Success);
this.InitTreeMenu();
this.BindGrid();
}
#endregion
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
{
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.NodeID.Contains("|"))
{
var ids= this.tvControlItem.SelectedNode.NodeID.Split('|');
string strSql = @"select c.UnitWorkName, '' Id,*
,(CASE WHEN a.States = " + BLL.Const.State_3 + " THEN '审核/审批完成' when a.States = " + BLL.Const.State_0 + " OR a.States IS NULL THEN '待提交' WHEN a.States = " + BLL.Const.State_2 + " THEN '待总包安全经理审核' ELSE '待['+OperateUser.PersonName+']办理' END) AS FlowOperateName"
+ @" from [dbo].[HSSE_ConstructionRisk] a left join [dbo].[HSSE_ConstructionRiskControl] b
on a.ConstructionRiskId =b.ConstructionRiskId left join WBS_UnitWork c on a.WorkAreaId = c.UnitWorkId
LEFT JOIN Sys_FlowOperate AS FlowOperate ON a.ConstructionRiskId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1
LEFT JOIN Person_Persons AS OperateUser ON FlowOperate.OperaterId=OperateUser.PersonId
where a.UnitId=@UnitId and a.DateWeek=@DateWeek order by a.[ConstructionContent],b.[ShowIndex]";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@UnitId", ids[0]));
listStr.Add(new SqlParameter("@DateWeek", ids[1]));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
foreach(DataRow row in tb.Rows)
{
row["Id"] = row["ConstructionRiskId"] +"|"+ row["ControlId"];
}
Grid1.DataSource = tb;
Grid1.DataBind();
}
}
#region
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
private void BindNodes(TreeNode node)
{
var DateWeek = (from x in Funs.DB.HSSE_ConstructionRisk
where x.ProjectId == this.CurrUser.LoginProjectId
&& x.UnitId == node.NodeID
select x.DateWeek).OrderByDescending(x=>x).ToList();
foreach (var d in DateWeek)
{
TreeNode newNode = new TreeNode();
newNode.Text = d; //string.Format("{0:yyyy-MM-dd}", d.AssessmentDate);
newNode.NodeID = node.NodeID + "|" + d;
newNode.EnableClickEvent = true;
newNode.ToolTip = "标签";
node.Nodes.Add(newNode);
}
}
#endregion
#region
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionRiskMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnIn))
{
this.btnImport.Hidden = false;
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnAuditing))
{
this.btnMenuDelete.Hidden = false;
}
}
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskDataIn.aspx", "导入 - ")));
}
#endregion
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnNew_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskEdit.aspx", "添加 - ")));
}
#endregion
protected void btnAudit_Click(object sender, EventArgs e)
{
var risks = Funs.DB.HSSE_ConstructionRisk.Where(x => x.States == "2");
foreach (var r in risks)
{
r.States = "3";
}
Funs.DB.SubmitChanges();
}
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand111(object sender, TreeCommandEventArgs e)
{
BindGrid();
}
#endregion
protected void btnMenuCheck_Click(object sender, EventArgs e)
{
var ids = Grid1.SelectedRowID.Split('|');
if (ids.Length > 1)
{
hdState.Text = "";
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdState.ClientID)
+ Window2.GetShowReference(String.Format("ConstructionRiskControlCheck.aspx?ControlId={0}", ids[1], "编辑 - ")));
}
}
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
var ids = Grid1.SelectedRowID.Split('|');
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskEdit.aspx?ConstructionRiskId={0}", ids[0], "编辑 - ")));
}
}
}
@@ -0,0 +1,179 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRisk
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// panelLeftRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelLeftRegion;
/// <summary>
/// hdState 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdState;
/// <summary>
/// tvControlItem 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree tvControlItem;
/// <summary>
/// panelCenterRegion 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel panelCenterRegion;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnNew 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
/// <summary>
/// btnMenuCheck 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuCheck;
}
}
@@ -0,0 +1,73 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionRiskControlCheck.aspx.cs"
Inherits="FineUIPro.Web.HSSE.Hazard.ConstructionRiskControlCheck" ValidateRequest="false" %>
<%@ Register Src="~/Controls/FlowOperateControl.ascx" TagName="FlowOperateControl"
TagPrefix="uc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>施工作业风险</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.lab
{
font-size: small;
color: Red;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
Layout="VBox" BodyPadding="10px" runat="server" RedStarPosition="BeforeText"
LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:RadioButtonList ID="rbCheckResult" Label="检查结果" runat="server" ColumnNumber="1" ShowRedStar="true" Required="true">
<f:RadioItem Text="符合" Value="符合" />
<f:RadioItem Text="不符合" Value="不符合" />
</f:RadioButtonList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:RadioButtonList ID="rbRectification" Label="整改情况" runat="server" ColumnNumber="1">
<f:RadioItem Text="A" Value="A" />
<f:RadioItem Text="B" Value="B" />
<f:RadioItem Text="C" Value="C" />
</f:RadioButtonList>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Label runat="server" ID="lbTemp">
</f:Label>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
<script type="text/javascript">
</script>
</body>
</html>
@@ -0,0 +1,115 @@
using BLL;
using Org.BouncyCastle.Crypto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskControlCheck : PageBase
{
#region
/// <summary>
/// 项目主键
/// </summary>
public string ControlId
{
get
{
return (string)ViewState["ControlId"];
}
set
{
ViewState["ControlId"] = value;
}
}
public string ConstructionRiskId
{
get
{
return (string)ViewState["ConstructionRiskId"];
}
set
{
ViewState["ConstructionRiskId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string ControlId = Request["ControlId"];
if (!string.IsNullOrEmpty(ControlId))
{
this.ControlId = ControlId;
}
var constructionRiskControl = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x=>x.ControlId == this.ControlId);
if (constructionRiskControl != null)
{
this.ConstructionRiskId = constructionRiskControl.ConstructionRiskId;
if (!string.IsNullOrEmpty(constructionRiskControl.CheckResult))
{
rbCheckResult.SelectedValue = constructionRiskControl.CheckResult;
}
if (!string.IsNullOrEmpty(constructionRiskControl.Rectification))
{
rbRectification.SelectedValue = constructionRiskControl.Rectification;
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
this.SaveData(BLL.Const.BtnSave);
}
#endregion
/// <summary>
/// 保存数据
/// </summary>
/// <param name="type"></param>
private void SaveData(string type)
{
Model.HSSE_ConstructionRiskControl newconstructionRisk = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x => x.ControlId == this.ControlId);
if (newconstructionRisk != null)
{
newconstructionRisk.CheckResult = rbCheckResult.SelectedValue;
newconstructionRisk.Rectification = rbRectification.SelectedValue;
}
Funs.DB.SubmitChanges();
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(rbRectification.SelectedValue) + ActiveWindow.GetHidePostBackReference());
}
protected void rdCheckResult_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
@@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskControlCheck
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// rbCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.RadioButtonList rbCheckResult;
/// <summary>
/// rbRectification 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.RadioButtonList rbRectification;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
}
}
@@ -0,0 +1,59 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionRiskControlEdit.aspx.cs"
Inherits="FineUIPro.Web.HSSE.Hazard.ConstructionRiskControlEdit" ValidateRequest="false" %>
<%@ Register Src="~/Controls/FlowOperateControl.ascx" TagName="FlowOperateControl"
TagPrefix="uc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>施工作业风险</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.lab
{
font-size: small;
color: Red;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
Layout="VBox" BodyPadding="10px" runat="server" RedStarPosition="BeforeText"
LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextArea ID="txtMeasures" runat="server" AutoGrowHeight="true" ShowRedStar="true" Required="true" LabelWidth="140px" AutoGrowHeightMin="50" Label="管控措施"></f:TextArea>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Label runat="server" ID="lbTemp">
</f:Label>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
<script type="text/javascript">
</script>
</body>
</html>
@@ -0,0 +1,128 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskControlEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string ConstructionRiskId
{
get
{
return (string)ViewState["ConstructionRiskId"];
}
set
{
ViewState["ConstructionRiskId"] = value;
}
}
/// <summary>
/// 项目主键
/// </summary>
public string ControlId
{
get
{
return (string)ViewState["ControlId"];
}
set
{
ViewState["ControlId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ConstructionRiskId = Request.Params["ConstructionRiskId"];
this.ControlId = Request.Params["ControlId"];
var constructionRiskControl = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x=>x.ControlId == this.ControlId);
if (constructionRiskControl != null)
{
if (!string.IsNullOrEmpty(constructionRiskControl.Measures))
{
txtMeasures.Text = constructionRiskControl.Measures;
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
this.SaveData(BLL.Const.BtnSave);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
/// <summary>
/// 保存数据
/// </summary>
/// <param name="type"></param>
private void SaveData(string type)
{
Model.HSSE_ConstructionRiskControl newConstructionRiskControl = new Model.HSSE_ConstructionRiskControl
{
ConstructionRiskId = this.ConstructionRiskId,
};
newConstructionRiskControl.Measures = this.txtMeasures.Text ;
if (!string.IsNullOrEmpty(this.ControlId))
{
newConstructionRiskControl.ControlId = this.ControlId;
BLL.ConstructionRiskListService.UpdateConstructionRiskControl(newConstructionRiskControl);
BLL.LogService.AddSys_Log(this.CurrUser, newConstructionRiskControl.ConstructionRiskId, newConstructionRiskControl.ConstructionRiskId, BLL.Const.ProjectEnvironmentalRiskListMenuId, BLL.Const.BtnModify);
}
else
{
newConstructionRiskControl.ControlId = SQLHelper.GetNewID(typeof(Model.Hazard_EnvironmentalRiskList));
this.ControlId = newConstructionRiskControl.ControlId;
BLL.ConstructionRiskListService.AddConstructionRiskControl(newConstructionRiskControl);
BLL.LogService.AddSys_Log(this.CurrUser, newConstructionRiskControl.ConstructionRiskId, newConstructionRiskControl.ConstructionRiskId, BLL.Const.ProjectEnvironmentalRiskListMenuId, BLL.Const.BtnAdd);
}
}
protected void rdCheckResult_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
@@ -0,0 +1,89 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskControlEdit
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtMeasures 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtMeasures;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
}
}
@@ -0,0 +1,54 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionRiskDataIn.aspx.cs" Inherits="FineUIPro.Web.HSSE.Hazard.ConstructionRiskDataIn" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>危险源台账导入</title>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="2px" BodyPadding="2px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:HiddenField ID="hdId" runat="server"></f:HiddenField>
<f:HiddenField ID="hdfileName" runat="server"></f:HiddenField>
<f:FileUpload ID="FileExcel" runat="server" Label="数据文件" EmptyText="请上传EXCEl格式文件" Width="350px" LabelWidth="90px" LabelAlign="Right"></f:FileUpload>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnAudit" runat="server" Text="审核" ToolTip="审核" Icon="PageEdit" OnClick="btnAudit_Click"></f:Button>
<f:Button ID="btnSave" runat="server" Text="导入" ToolTip="导入" Icon="SystemSave" OnClick="btnSave_Click"></f:Button>
<f:Button ID="imgbtnUpload" runat="server" Icon="DiskDownload" Text="模板下载" EnableAjaxLoading="false" OnClick="imgbtnUpload_Click"></f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="危险源台账导入" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="" AllowCellEditing="true"
EnableColumnLines="true" DataIDField="" EnableTextSelection="True">
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="60px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField Width="120px" HeaderText="错误行号" ColumnID="Row" DataField="Row" SortField="Row"
FieldType="String" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="200px" HeaderText="错误列" ColumnID="Column" DataField="Column" SortField="Column"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="200px" HeaderText="错误类型" ColumnID="Reason" DataField="Reason" SortField="Reason"
FieldType="String" HeaderTextAlign="Center" TextAlign="Left" ExpandUnusedSpace="true">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:Panel>
</form>
<script type="text/javascript">
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,440 @@
using BLL;
using FineUIPro.Web.SysManage;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskDataIn : PageBase
{
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 导入模版文件原始的虚拟路径
/// </summary>
private string initTemplatePath = Const.ConstructionRiskTemplateUrl;
/// <summary>
/// 错误集合
/// </summary>
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (errorInfos != null)
{
errorInfos.Clear();
}
}
}
#endregion
#region
/// <summary>
/// 模板下载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void imgbtnUpload_Click(object sender, EventArgs e)
{
string uploadfilepath = Server.MapPath("~/") + initTemplatePath;
string fileName = Path.GetFileName(initTemplatePath);
FileInfo info = new FileInfo(uploadfilepath);
if (info.Exists)
{
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.Flush();
Response.Close();
}
else
{
ShowNotify("文件不存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAudit_Click(object sender, EventArgs e)
{
try
{
if (this.FileExcel.HasFile == false)
{
Alert.ShowInTop("请您选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(FileExcel.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls")
{
Alert.ShowInTop("只可以选择Excel文件!", MessageBoxIcon.Warning);
return;
}
if (errorInfos != null)
{
errorInfos.Clear();
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
this.hdfileName.Text = BLL.Funs.GetNewFileName() + IsXls;
string filePath = initFullPath + this.hdfileName.Text;
FileExcel.PostedFile.SaveAs(filePath);
ImportXlsToData(filePath);
}
catch (Exception ex)
{
Alert.ShowInTop(ex.Message);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.SelectCommand.CommandTimeout = 1200;
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 14);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#endregion
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL(DataTable pds, int Cols)
{
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
var units = from x in Funs.DB.Base_Unit select x;
var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == CurrUser.LoginProjectId select x;
for (int i = 0; i < ir; i++)
{
string row0 = pds.Rows[i][0].ToString().Trim();
string row1 = pds.Rows[i][1].ToString().Trim();
string row2 = pds.Rows[i][2].ToString().Trim();
string row3 = pds.Rows[i][3].ToString().Trim();
string row4 = pds.Rows[i][4].ToString().Trim();
string row5 = pds.Rows[i][5].ToString().Trim();
string row6 = pds.Rows[i][6].ToString().Trim();
string row7 = pds.Rows[i][7].ToString().Trim();
string row8 = pds.Rows[i][8].ToString().Trim();
if (string.IsNullOrEmpty(row0))
{
result += (i + 2).ToString() + "," + "本周开始时间" + "," + "此项为必填项!" + "|";
}
if (string.IsNullOrEmpty(row1))
{
result += (i + 2).ToString() + "," + "本周结束时间" + "," + "此项为必填项!" + "|";
}
if (string.IsNullOrEmpty(row2))
{
result += (i + 2).ToString() + "," + "单位工程" + "," + "此项为必填项!" + "|";
}
else
{
var unitWork = unitWorks.Where(x => x.UnitWorkName == row2.Trim()).FirstOrDefault();
if (unitWork == null)
{
result += (i + 2).ToString() + "," + "单位工程" + "," + "此项目不存在!" + "|";
}
}
if (string.IsNullOrEmpty(row3))
{
result += (i + 2).ToString() + "," + "单位工程" + "," + "此项为必填项!" + "|";
}
else
{
var unit = units.Where(x => x.UnitName == row3.Trim()).FirstOrDefault();
if (unit == null)
{
result += (i + 2).ToString() + "," + "单位" + "," + "此项目不存在!" + "|";
}
}
if (string.IsNullOrEmpty(row4))
{
result += (i + 2).ToString() + "," + "施工内容" + "," + "此项为必填项!" + "|";
}
if (string.IsNullOrEmpty(row5))
{
result += (i + 2).ToString() + "," + "施工内容" + "," + "此项为必填项!" + "|";
}
}
if (!string.IsNullOrEmpty(result))
{
result = result.Substring(0, result.LastIndexOf("|"));
}
errorInfos.Clear();
if (!string.IsNullOrEmpty(result))
{
string results = result;
List<string> errorInfoList = results.Split('|').ToList();
foreach (var item in errorInfoList)
{
string[] errors = item.Split(',');
Model.ErrorInfo errorInfo = new Model.ErrorInfo();
errorInfo.Row = errors[0];
errorInfo.Column = errors[1];
errorInfo.Reason = errors[2];
errorInfos.Add(errorInfo);
}
if (errorInfos.Count > 0)
{
Grid1.DataSource = errorInfos;
Grid1.DataBind();
}
}
else
{
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
throw new Exception("导入数据为空!");
}
return true;
}
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (errorInfos.Count <= 0)
{
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
string filePath = initFullPath + this.hdfileName.Text;
ImportXlsToData2(filePath);
}
else
{
Alert.ShowInTop("请先将错误数据修正,再重新导入保存!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.SelectCommand.CommandTimeout = 1200;
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0]);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds)
{
string result = string.Empty;
string dReportID = string.Empty;
string dateStr = string.Empty;
int ir;
string des = "";
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
Model.HSSE_ConstructionRisk newConstructionRisk = null;
var units = from x in Funs.DB.Base_Unit select x;
var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == CurrUser.LoginProjectId select x;
int index = 1;
for (int i = 0; i < ir; i++)
{
string row0 = pds.Rows[i][0].ToString().Trim();
string row1 = pds.Rows[i][1].ToString().Trim();
string row2 = pds.Rows[i][2].ToString().Trim();
string row3 = pds.Rows[i][3].ToString().Trim();
string row4 = pds.Rows[i][4].ToString().Trim();
string row5 = pds.Rows[i][5].ToString().Trim();
string row6 = pds.Rows[i][6].ToString().Trim();
string row7 = pds.Rows[i][7].ToString().Trim();
string row8 = pds.Rows[i][8].ToString().Trim();
var unit = units.Where(x => x.UnitName == row3).FirstOrDefault();
var unitWork = unitWorks.Where(x => x.UnitWorkName == row2).FirstOrDefault();
if (des != row4)
{
index = 1;
newConstructionRisk = new Model.HSSE_ConstructionRisk();
newConstructionRisk.ConstructionRiskId = SQLHelper.GetNewID(typeof(Model.HSSE_ConstructionRisk));
newConstructionRisk.ProjectId = this.CurrUser.LoginProjectId;
newConstructionRisk.UnitId = unit.UnitId;
newConstructionRisk.WorkAreaId = unitWork.UnitWorkId;
try
{
newConstructionRisk.DateA = Funs.GetNewDateTime(row0);
newConstructionRisk.DateWeek = newConstructionRisk.DateA.Value.ToString("yyyy年") + Funs.GetWeekOfYear(newConstructionRisk.DateA.Value)+"周";
}
catch (Exception e) { }
try
{
newConstructionRisk.DateZ = Funs.GetNewDateTime(row1);
}
catch (Exception e) { }
newConstructionRisk.ConstructionContent = row4;
newConstructionRisk.RefLicense = row5;
newConstructionRisk.LicenseDes = row6;
newConstructionRisk.RiskLevel = row7;
Funs.DB.HSSE_ConstructionRisk.InsertOnSubmit(newConstructionRisk);
des = row4;
}
Model.HSSE_ConstructionRiskControl constructionRiskControl = new Model.HSSE_ConstructionRiskControl();
constructionRiskControl.ControlId = SQLHelper.GetNewID(typeof(Model.HSSE_ConstructionRiskControl));
constructionRiskControl.ConstructionRiskId = newConstructionRisk.ConstructionRiskId;
constructionRiskControl.Measures = row8;
constructionRiskControl.ShowIndex = index;
Funs.DB.HSSE_ConstructionRiskControl.InsertOnSubmit(constructionRiskControl);
}
Funs.DB.SubmitChanges();
ShowNotify("导入成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
throw new Exception("导入数据为空!");
}
return true;
}
#endregion
}
}
@@ -0,0 +1,125 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskDataIn
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// hdId 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdId;
/// <summary>
/// hdfileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdfileName;
/// <summary>
/// FileExcel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload FileExcel;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// imgbtnUpload 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button imgbtnUpload;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
}
}
@@ -0,0 +1,178 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionRiskEdit.aspx.cs"
Inherits="FineUIPro.Web.HSSE.Hazard.ConstructionRiskEdit" ValidateRequest="false" %>
<%@ Register Src="~/Controls/FlowOperateControl.ascx" TagName="FlowOperateControl"
TagPrefix="uc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>施工作业风险</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.lab
{
font-size: small;
color: Red;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
Layout="VBox" BodyPadding="10px" runat="server" RedStarPosition="BeforeText"
LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:DropDownList ID="drpUnit" runat="server" EnableEdit="true" Label="施工单位" LabelWidth="140px"
AutoPostBack="true">
</f:DropDownList>
<f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="本周开始日期" ID="dpDateA" LabelWidth="140px" AutoPostBack="true"
ShowRedStar="true" Required="true" EnableDateSelectEvent ="true" OnDateSelect ="dpDateA_SelectedIndexChanged">
</f:DatePicker>
<f:DatePicker runat="server" DateFormatString="yyyy-MM-dd" Label="本周结束日期" ID="dpDateZ" LabelWidth="140px"
ShowRedStar="true" Required="true" >
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtConstructionContent" runat="server" AutoGrowHeight="true" ShowRedStar="true" Required="true" LabelWidth="140px" AutoGrowHeightMin="50" Label="施工内容"></f:TextArea>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpWorkArea" runat="server" EnableEdit="true" Label="单位工程" LabelWidth="140px"
AutoPostBack="true">
</f:DropDownList>
<f:DropDownList ID="drpRefLicense" runat="server" EnableEdit="true" Label="涉及的高风险作业" LabelWidth="140px" EnableMultiSelect="true"
AutoPostBack="true" >
</f:DropDownList>
<f:DropDownList ID="drpRiskLevel" runat="server" EnableEdit="true" Label="风险等级" LabelWidth="140px"
AutoPostBack="true" >
<f:ListItem Value="" Text="- 请选择 -" />
<f:ListItem Value="一级风险" Text="一级风险" />
<f:ListItem Value="二级风险" Text="二级风险" />
<f:ListItem Value="三级风险" Text="三级风险" />
<f:ListItem Value="四级风险" Text="四级风险" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtLicenseDes" runat="server" AutoGrowHeight="true" ShowRedStar="true" Required="true" AutoGrowHeightMin="50" Label="作业风险描述" LabelWidth="140px"></f:TextArea>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" runat="server"
DataIDField="ControlId" DataKeyNames="ControlId" ForceFit="true"
EnableMultiSelect="true" ShowGridHeader="true" EnableColumnLines="true" AllowSorting="true"
SortField="ShowIndex" SortDirection="ASC" EnableRowDoubleClickEvent="true"
OnRowDoubleClick="Grid1_RowDoubleClick">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:Button ID="btnAdd" Icon="ShapeSquareSelect" Text="添加管控措施" runat="server" ToolTip="添加管控措施" ValidateForms="SimpleForm1" OnClick="btnAdd_Click" >
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField HeaderText="序号" Width="45px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField Width="100px" ColumnID="Measures" DataField="Measures" FieldType="String" ExpandUnusedSpace="true"
HeaderText="管控措施" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="40px" ColumnID="CheckResult" DataField="CheckResult" FieldType="String"
HeaderText="检查结果" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="40px" ColumnID="Rectification" DataField="Rectification"
FieldType="String" HeaderText="环境因素" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
</f:Grid>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Form ID="Form2" ShowBorder="false" AutoScroll="true" ShowHeader="true" Title="辨识内容"
EnableCollapse="true" Collapsed="true" BodyPadding="10px" runat="server" RedStarPosition="BeforeText"
LabelAlign="Right">
<Items>
<f:HtmlEditor runat="server" Label="辨识内容" ID="txtContents" ShowLabel="false" Editor="UMEditor"
BasePath="~/res/umeditor/" ToolbarSet="Full" Height="160px" LabelAlign="Right">
</f:HtmlEditor>
</Items>
</f:Form>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:ContentPanel ID="ContentPanel1" runat="server" ShowHeader="false" EnableCollapse="true"
BodyPadding="0px">
<uc1:FlowOperateControl ID="ctlAuditFlow" runat="server" />
</f:ContentPanel>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
<Items>
<f:Label runat="server" ID="lbTemp">
</f:Label>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="保存" ValidateForms="SimpleForm1"
OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnSubmit" Icon="SystemSaveNew" runat="server" Text="提交" ValidateForms="SimpleForm1"
OnClick="btnSubmit_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" Text="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
<f:Window ID="Window1" Title="编辑危险源明细" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="900px" Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Icon="Pencil" runat="server" Text="编辑" >
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true"
Icon="Delete" ConfirmText="确定删除当前数据?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/javascript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
</script>
</body>
</html>
@@ -0,0 +1,324 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string ConstructionRiskId
{
get
{
return (string)ViewState["ConstructionRiskId"];
}
set
{
ViewState["ConstructionRiskId"] = value;
}
}
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
/// <summary>
/// 定义集合
/// </summary>
private static List<Model.HSSE_ConstructionRiskControl> constructionRiskControls = new List<Model.HSSE_ConstructionRiskControl>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.ProjectId = this.CurrUser.LoginProjectId;
this.InitDropDownList();
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
constructionRiskControls.Clear();
this.ConstructionRiskId = Request.Params["ConstructionRiskId"];
var constructionRisk = Funs.DB.HSSE_ConstructionRisk.FirstOrDefault(x=>x.ConstructionRiskId==this.ConstructionRiskId);
if (constructionRisk != null)
{
this.ProjectId = constructionRisk.ProjectId;
this.InitDropDownList();
this.dpDateA.Text = string.Format("{0:yyyy-MM-dd}", constructionRisk.DateA);
this.dpDateZ.Text = string.Format("{0:yyyy-MM-dd}", constructionRisk.DateZ);
if (!string.IsNullOrEmpty(constructionRisk.WorkAreaId))
{
drpWorkArea.SelectedValue = constructionRisk.WorkAreaId;
}
if (!string.IsNullOrEmpty(constructionRisk.UnitId))
{
drpUnit.SelectedValue = constructionRisk.UnitId;
}
if (!string.IsNullOrEmpty(constructionRisk.RiskLevel))
{
drpRiskLevel.SelectedValue = constructionRisk.RiskLevel;
}
if (!string.IsNullOrEmpty(constructionRisk.RefLicense))
{
drpRefLicense.SelectedValueArray = constructionRisk.RefLicense.Split(',');
}
if (!string.IsNullOrEmpty(constructionRisk.ConstructionContent))
{
this.txtConstructionContent.Text = HttpUtility.HtmlDecode(constructionRisk.ConstructionContent);
}
if (!string.IsNullOrEmpty(constructionRisk.LicenseDes))
{
this.txtLicenseDes.Text = HttpUtility.HtmlDecode(constructionRisk.LicenseDes);
}
if (!string.IsNullOrEmpty(constructionRisk.RiskLevel))
{
this.drpRiskLevel.SelectedValueArray = constructionRisk.RiskLevel.Split(',');
}
constructionRiskControls = (from x in Funs.DB.HSSE_ConstructionRiskControl where x.ConstructionRiskId == this.ConstructionRiskId orderby x.ShowIndex select x).ToList();
}
Grid1.DataSource = constructionRiskControls;
Grid1.DataBind();
///初始化审核菜单
this.ctlAuditFlow.MenuId = BLL.Const.ConstructionRiskMenuId;
this.ctlAuditFlow.DataId = this.ConstructionRiskId;
this.ctlAuditFlow.ProjectId = this.ProjectId;
this.ctlAuditFlow.UnitId = this.CurrUser.UnitId;
}
}
#endregion
/// <summary>
/// 初始化下拉框
/// </summary>
private void InitDropDownList()
{
///区域下拉框
BLL.UnitWorkService.InitUnitWorkDownList(this.drpWorkArea, this.ProjectId, true);
drpRefLicense.DataValueField = "LicenseTypeName";
drpRefLicense.DataTextField = "LicenseTypeName";
drpRefLicense.DataSource = (from x in Funs.DB.Base_LicenseType orderby x.LicenseTypeCode select x).ToList();
drpRefLicense.DataBind();
UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnit, this.ProjectId, Const.ProjectUnitType_2, false);
}
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (this.ctlAuditFlow.NextStep == BLL.Const.State_1 && this.ctlAuditFlow.NextPerson == BLL.Const._Null)
{
ShowNotify("请选择下一步办理人!", MessageBoxIcon.Warning);
return;
}
this.SaveData(BLL.Const.BtnSubmit);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
this.SaveData(BLL.Const.BtnSave);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
/// <summary>
/// 保存数据
/// </summary>
/// <param name="type"></param>
private void SaveData(string type)
{
Model.HSSE_ConstructionRisk newConstructionRisk = new Model.HSSE_ConstructionRisk
{
ProjectId = this.ProjectId,
};
if (this.dpDateA.SelectedDate.HasValue)
{
newConstructionRisk.DateWeek = this.dpDateA.SelectedDate.Value.Year + "年" + Funs.GetWeekOfYear(this.dpDateA.SelectedDate.Value) + "周";
}
if (this.drpWorkArea.SelectedValue != BLL.Const._Null)
{
newConstructionRisk.WorkAreaId = this.drpWorkArea.SelectedValue;
}
if (this.drpRiskLevel.SelectedValue != BLL.Const._Null)
{
newConstructionRisk.RiskLevel = drpRiskLevel.SelectedValue;
}
if ( drpRefLicense.SelectedValueArray!=null && drpRefLicense.SelectedValueArray.Count()>0)
{
newConstructionRisk.RefLicense = string.Join(",",drpRefLicense.SelectedValueArray);
}
if (this.drpUnit.SelectedValue != BLL.Const._Null)
{
newConstructionRisk.UnitId = drpUnit.SelectedValue;
}
newConstructionRisk.DateA = Funs.GetNewDateTime(this.dpDateA.Text.Trim());
newConstructionRisk.DateZ = Funs.GetNewDateTime(this.dpDateZ.Text.Trim());
newConstructionRisk.LicenseDes = HttpUtility.HtmlEncode(this.txtLicenseDes.Text);
newConstructionRisk.ConstructionContent = HttpUtility.HtmlEncode(this.txtConstructionContent.Text);
////单据状态
newConstructionRisk.States = BLL.Const.State_0;
if (type == BLL.Const.BtnSubmit)
{
newConstructionRisk.States = this.ctlAuditFlow.NextStep;
}
if (!string.IsNullOrEmpty(this.ConstructionRiskId))
{
newConstructionRisk.ConstructionRiskId = this.ConstructionRiskId;
BLL.ConstructionRiskListService.UpdateConstructionRisk(newConstructionRisk);
BLL.LogService.AddSys_Log(this.CurrUser, newConstructionRisk.ConstructionRiskId, newConstructionRisk.ConstructionRiskId, BLL.Const.ProjectEnvironmentalRiskListMenuId, BLL.Const.BtnModify);
}
else
{
newConstructionRisk.ConstructionRiskId = SQLHelper.GetNewID(typeof(Model.Hazard_EnvironmentalRiskList));
this.ConstructionRiskId = newConstructionRisk.ConstructionRiskId;
BLL.ConstructionRiskListService.AddConstructionRisk(newConstructionRisk);
BLL.LogService.AddSys_Log(this.CurrUser, newConstructionRisk.ConstructionRiskId, newConstructionRisk.ConstructionRiskId, BLL.Const.ProjectEnvironmentalRiskListMenuId, BLL.Const.BtnAdd);
}
foreach(var item in constructionRiskControls)
{
item.ConstructionRiskId= newConstructionRisk.ConstructionRiskId;
}
BLL.ConstructionRiskListService.AddConstructionRiskControl(constructionRiskControls, this.ConstructionRiskId);
////保存流程审核数据
this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectEnvironmentalRiskListMenuId, this.ConstructionRiskId, (type == BLL.Const.BtnSubmit ? true : false), this.txtConstructionContent.Text.Trim(), "../Hazard/EnvironmentalRiskListView.aspx?EnvironmentalRiskListId={0}");
}
#region
/// <summary>
/// 关闭弹出窗
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
constructionRiskControls = (from x in Funs.DB.HSSE_ConstructionRiskControl where x.ConstructionRiskId == this.ConstructionRiskId orderby x.ShowIndex select x).ToList();
Grid1.DataSource = constructionRiskControls;
Grid1.DataBind();
}
#endregion
#region Grid双击事件
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit_Click(null, null);
}
#endregion
#region
/// <summary>
/// 编辑按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string rowID = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskControlEdit.aspx?ConstructionRiskId={0}&ControlId={1}", ConstructionRiskId, rowID, "编辑 - ")));
}
#endregion
#region
/// <summary>
/// 批量删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var constructionRiskControl = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x => x.ControlId == rowID);
Funs.DB.HSSE_ConstructionRiskControl.DeleteOnSubmit(constructionRiskControl);
Funs.DB.SubmitChanges();
}
constructionRiskControls = (from x in Funs.DB.HSSE_ConstructionRiskControl where x.ConstructionRiskId == this.ConstructionRiskId orderby x.ShowIndex select x).ToList();
Grid1.DataSource = constructionRiskControls;
Grid1.DataBind();
ShowNotify("删除数据成功!(表格数据已重新绑定)");
}
}
#endregion
#region
/// <summary>
/// 区域选择框事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void dpDateA_SelectedIndexChanged (object sender, EventArgs e)
{
}
#endregion
protected void btnAdd_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.ConstructionRiskId))
{
this.ConstructionRiskId = SQLHelper.GetNewID(typeof(Model.Hazard_EnvironmentalRiskList));
}
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskControlEdit.aspx?ConstructionRiskId=" + this.ConstructionRiskId, "添加 - ")));
}
}
}
@@ -0,0 +1,269 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Hazard
{
public partial class ConstructionRiskEdit
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// drpUnit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpUnit;
/// <summary>
/// dpDateA 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker dpDateA;
/// <summary>
/// dpDateZ 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker dpDateZ;
/// <summary>
/// txtConstructionContent 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtConstructionContent;
/// <summary>
/// drpWorkArea 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpWorkArea;
/// <summary>
/// drpRefLicense 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpRefLicense;
/// <summary>
/// drpRiskLevel 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpRiskLevel;
/// <summary>
/// txtLicenseDes 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextArea txtLicenseDes;
/// <summary>
/// Grid1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// btnAdd 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAdd;
/// <summary>
/// Form2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form Form2;
/// <summary>
/// txtContents 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HtmlEditor txtContents;
/// <summary>
/// ContentPanel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ContentPanel ContentPanel1;
/// <summary>
/// ctlAuditFlow 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Web.Controls.FlowOperateControl ctlAuditFlow;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnSubmit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSubmit;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// Window1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Menu1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}