fix:问题修改

This commit is contained in:
geh
2025-02-19 15:09:13 +08:00
parent 8f471923bf
commit 0a70ab9af7
39 changed files with 6541 additions and 64 deletions
@@ -0,0 +1,108 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AwardStandards.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.AwardStandards" %>
<!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" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="防护标准" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="AwardStandardsId" EnableColumnLines="true"
DataIDField="AwardStandardsId" AllowSorting="true" SortField="AwardStandardsCode" ForceFit="true"
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server">
<Items>
<f:TextBox ID="AwardStandardsName" runat="server" Label="名称" EmptyText="输入查询名称"
Width="250px" LabelWidth="70px">
</f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnQuery" ToolTip="查询" Icon="SystemSearch" EnablePostBack="true"
OnClick="TextBox_TextChanged" runat="server" >
</f:Button>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
Hidden="true">
</f:Button>
<%-- <f:Button ID="btnSelectColumns" runat="server" ToolTip="导出" Icon="FolderUp" EnablePostBack="false" Hidden="true"> --%>
<%-- </f:Button> --%>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField Width="160px" ColumnID="AwardStandardsCode" DataField="AwardStandardsCode" SortField="AwardStandardsCode"
FieldType="String" HeaderText="编号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="220px" ColumnID="AwardStandardsName" DataField="AwardStandardsName" SortField="AwardStandardsName"
FieldType="String" HeaderText="名称" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="CompileMan" DataField="CompileMan" SortField="CompileMan"
FieldType="String" HeaderText="编制人" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="250px" ColumnID="CompileDate" DataField="CompileDate" SortField="CompileDate"
FieldType="String" HeaderText="编制时间" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:WindowField TextAlign="Left" Width="70px" WindowID="WindowAtt" Text="详细"
ToolTip="上传查看" DataIFrameUrlFields="AwardStandardsId" DataIFrameUrlFormatString="../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/AwardStandards&menuId=8E3A5EDC-62CA-4F64-A4E7-CD3D473A6201"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="编辑奖罚标准" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="750px" Height="420px">
</f:Window>
<f:Window ID="Window4" Title="选择需要导出的列" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window4_Close" IsModal="true"
Width="450px" Height="250px" EnableAjax="false">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Icon="Delete"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/jscript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,319 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.UI;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class AwardStandards : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
////权限按钮方法
this.GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("AwardStandardsEdit.aspx") + "return false;";
// btnSelectColumns.OnClientClick = Window4.GetShowReference("AwardStandardsSelectCloumn.aspx");
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT AwardStandardsId,AwardStandardsCode,AwardStandardsName,CompileMan,CompileDate,AttachUrl,AuditMan,AuditDate,IsPass,IsBuild,UpState
FROM dbo.Technique_AwardStandards
WHERE 1 =1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.AwardStandardsName.Text.Trim()))
{
strSql += " AND AwardStandardsName LIKE @AwardStandardsName";
listStr.Add(new SqlParameter("@AwardStandardsName", "%" + this.AwardStandardsName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
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 Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <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();
var getV = BLL.AwardStandardsService.GetAwardStandardsListById(rowID);
if (getV != null)
{
BLL.LogService.AddSys_Log(this.CurrUser, getV.AwardStandardsCode, getV.AwardStandardsId, BLL.Const.AwardStandardsMenuId, Const.BtnDelete);
BLL.AwardStandardsService.DeleteAwardStandardsListById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!");
}
}
#endregion
#region
/// <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 AwardStandardsId = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("AwardStandardsEdit.aspx?AwardStandardsId={0}", AwardStandardsId, "编辑 - ")));
}
#endregion
#region Grid行双击事件
/// <summary>
/// Grid行双击事件
/// </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 TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
BLL.LogService.AddSys_Log(this.CurrUser, string.Empty, string.Empty, BLL.Const.AwardStandardsMenuId, Const.BtnQuery);
}
#endregion
#region
/// <summary>
/// 关闭导出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window4_Close(object sender, WindowCloseEventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#')));
Response.End();
}
/// <summary>
/// 导出
/// </summary>
/// <param name="grid"></param>
/// <param name="columns"></param>
/// <returns></returns>
private string GetGridTableHtml(Grid grid, string[] columns)
{
StringBuilder sb = new StringBuilder();
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
List<string> columnHeaderTexts = new List<string>(columns);
List<int> columnIndexs = new List<int>();
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
if (columnHeaderTexts.Contains(column.HeaderText))
{
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
columnIndexs.Add(column.ColumnIndex);
}
}
sb.Append("</tr>");
foreach (GridRow row in grid.Rows)
{
sb.Append("<tr>");
int columnIndex = 0;
foreach (object value in row.Values)
{
if (columnIndexs.Contains(columnIndex))
{
string html = value.ToString();
if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX))
{
// 模板列
string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length);
Control templateCtrl = row.FindControl(templateID);
html = GetRenderedHtmlSource(templateCtrl);
}
sb.AppendFormat("<td>{0}</td>", html);
}
columnIndex++;
}
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}
/// <summary>
/// 获取控件渲染后的HTML源代码
/// </summary>
/// <param name="ctrl"></param>
/// <returns></returns>
private string GetRenderedHtmlSource(Control ctrl)
{
if (ctrl != null)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
ctrl.RenderControl(htw);
return sw.ToString();
}
}
}
return String.Empty;
}
#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.AwardStandardsMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnOut))
{
// this.btnSelectColumns.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,170 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class AwardStandards
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// AwardStandardsName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox AwardStandardsName;
/// <summary>
/// btnQuery control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnQuery;
/// <summary>
/// btnNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// ToolbarSeparator1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window4;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,72 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AwardStandardsEdit.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.AwardStandardsEdit" %>
<!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" />
</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"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtAwardStandardsCode" runat="server" Label="编号" Required="true"
MaxLength="50" ShowRedStar="true" FocusOnPageLoad="true" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtAwardStandardsName" runat="server" Label="名称" Required="true"
MaxLength="500" ShowRedStar="true" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlCompileMan" runat="server" Label="编制人">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="编制日期" ID="dpkCompileDate">
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtRemark" runat="server" Label="备注" MaxLength="500" LabelAlign="Right" ></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:Button ID="btnAttachUrl" Text="附件" ToolTip="附件上传及查看" Icon="TableCell" runat="server" OnClick="btnUploadResources_Click"
ValidateForms="SimpleForm1">
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
Hidden="true" OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</body>
</html>
@@ -0,0 +1,221 @@
using BLL;
using System;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class AwardStandardsEdit : PageBase
{
#region
/// <summary>
/// 防护标准ID
/// </summary>
public string AwardStandardsId
{
get
{
return (string)ViewState["AwardStandardsId"];
}
set
{
ViewState["AwardStandardsId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
////权限按钮方法
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
//人员
UserService.InitUserDropDownList(this.ddlCompileMan, string.Empty, true);
//加载默认整理人、整理日期
this.ddlCompileMan.SelectedValue = this.CurrUser.UserId;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.AwardStandardsId = Request.Params["AwardStandardsId"];
if (!string.IsNullOrEmpty(this.AwardStandardsId))
{
var AwardStandards = BLL.AwardStandardsService.GetAwardStandardsListById(this.AwardStandardsId);
if (AwardStandards != null)
{
this.txtAwardStandardsCode.Text = AwardStandards.AwardStandardsCode;
this.txtAwardStandardsName.Text = AwardStandards.AwardStandardsName;
this.txtRemark.Text = AwardStandards.Remark;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", AwardStandards.CompileDate);
if (!string.IsNullOrEmpty(AwardStandards.CompileMan))
{
this.ddlCompileMan.SelectedItem.Text = AwardStandards.CompileMan;
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 保存数据
/// </summary>
private void SaveData()
{
Model.Technique_AwardStandards AwardStandards = new Model.Technique_AwardStandards();
if (!string.IsNullOrEmpty(this.txtAwardStandardsCode.Text.Trim()))
{
AwardStandards.AwardStandardsCode = this.txtAwardStandardsCode.Text.Trim();
}
else
{
ShowNotify("请输入编号", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtAwardStandardsName.Text.Trim()))
{
AwardStandards.AwardStandardsName = this.txtAwardStandardsName.Text.Trim();
}
else
{
ShowNotify("请输入名称", MessageBoxIcon.Warning);
return;
}
if (this.ddlCompileMan.SelectedValue != null)
{
AwardStandards.CompileMan = this.ddlCompileMan.SelectedItem.Text;
}
else
{
AwardStandards.CompileMan = this.CurrUser.UserName;
}
if (!string.IsNullOrEmpty(this.dpkCompileDate.Text))
{
AwardStandards.CompileDate = Convert.ToDateTime(this.dpkCompileDate.Text);
}
else
{
AwardStandards.CompileDate = DateTime.Now;
}
if (txtRemark.Text.Trim() != string.Empty)
{
AwardStandards.Remark = txtRemark.Text.Trim();
}
if (string.IsNullOrEmpty(this.AwardStandardsId))
{
AwardStandards.IsPass = true;
this.AwardStandardsId = AwardStandards.AwardStandardsId = SQLHelper.GetNewID(typeof(Model.Technique_AwardStandards));
BLL.AwardStandardsService.AddAwardStandardsList(AwardStandards);
BLL.LogService.AddSys_Log(this.CurrUser, AwardStandards.AwardStandardsCode, AwardStandards.AwardStandardsId, BLL.Const.AwardStandardsMenuId, Const.BtnAdd);
}
else
{
AwardStandards.AwardStandardsId = this.AwardStandardsId;
BLL.AwardStandardsService.UpdateAwardStandardsList(AwardStandards);
BLL.LogService.AddSys_Log(this.CurrUser, AwardStandards.AwardStandardsCode, AwardStandards.AwardStandardsId, BLL.Const.AwardStandardsMenuId, Const.BtnModify);
}
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUploadResources_Click(object sender, EventArgs e)
{
if (this.btnSave.Hidden)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/AwardStandards&type=-1", this.AwardStandardsId)));
}
else
{
if (string.IsNullOrEmpty(this.txtAwardStandardsCode.Text.Trim()))
{
ShowNotify("请输入方案编号", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtAwardStandardsName.Text.Trim()))
{
ShowNotify("请输入方案名称", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.AwardStandardsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/AwardStandards&menuId={1}", this.AwardStandardsId, BLL.Const.AwardStandardsMenuId)));
}
}
#endregion
#region
/// <summary>
/// 验证方案编号、名称是否存在
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
var q = Funs.DB.Technique_AwardStandards.FirstOrDefault(x => x.IsPass == true && x.AwardStandardsCode == this.txtAwardStandardsCode.Text.Trim() && (x.AwardStandardsId != this.AwardStandardsId || (this.AwardStandardsId == null && x.AwardStandardsId != null)));
if (q != null)
{
ShowNotify("输入的方案编号已存在!", MessageBoxIcon.Warning);
}
var q2 = Funs.DB.Technique_AwardStandards.FirstOrDefault(x => x.IsPass == true && x.AwardStandardsName == this.txtAwardStandardsName.Text.Trim() && (x.AwardStandardsId != this.AwardStandardsId || (this.AwardStandardsId == null && x.AwardStandardsId != null)));
if (q2 != null)
{
ShowNotify("输入的方案名称已存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.AwardStandardsMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,152 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class AwardStandardsEdit
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtAwardStandardsCode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtAwardStandardsCode;
/// <summary>
/// txtAwardStandardsName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtAwardStandardsName;
/// <summary>
/// ddlCompileMan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlCompileMan;
/// <summary>
/// dpkCompileDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DatePicker dpkCompileDate;
/// <summary>
/// txtRemark control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextArea txtRemark;
/// <summary>
/// Toolbar1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// btnAttachUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// ToolbarFill1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
}
@@ -0,0 +1,108 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionStandards.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.ConstructionStandards" %>
<!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" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="防护标准" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="ConstructionStandardsId" EnableColumnLines="true"
DataIDField="ConstructionStandardsId" AllowSorting="true" SortField="ConstructionStandardsCode" ForceFit="true"
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server">
<Items>
<f:TextBox ID="ConstructionStandardsName" runat="server" Label="名称" EmptyText="输入查询名称"
Width="250px" LabelWidth="70px">
</f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnQuery" ToolTip="查询" Icon="SystemSearch" EnablePostBack="true"
OnClick="TextBox_TextChanged" runat="server" >
</f:Button>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
Hidden="true">
</f:Button>
<%-- <f:Button ID="btnSelectColumns" runat="server" ToolTip="导出" Icon="FolderUp" EnablePostBack="false" Hidden="true"> --%>
<%-- </f:Button> --%>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField Width="160px" ColumnID="ConstructionStandardsCode" DataField="ConstructionStandardsCode" SortField="ConstructionStandardsCode"
FieldType="String" HeaderText="编号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="220px" ColumnID="ConstructionStandardsName" DataField="ConstructionStandardsName" SortField="ConstructionStandardsName"
FieldType="String" HeaderText="名称" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="CompileMan" DataField="CompileMan" SortField="CompileMan"
FieldType="String" HeaderText="编制人" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="250px" ColumnID="CompileDate" DataField="CompileDate" SortField="CompileDate"
FieldType="String" HeaderText="编制时间" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:WindowField TextAlign="Left" Width="70px" WindowID="WindowAtt" Text="详细"
ToolTip="上传查看" DataIFrameUrlFields="ConstructionStandardsId" DataIFrameUrlFormatString="../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ConstructionStandards&menuId=8E3A5EDC-62CA-4F64-A4E7-CD3D473A6201"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="编辑队伍文明施工标准" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="750px" Height="420px">
</f:Window>
<f:Window ID="Window4" Title="选择需要导出的列" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window4_Close" IsModal="true"
Width="450px" Height="250px" EnableAjax="false">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Icon="Delete"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/jscript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,319 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.UI;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ConstructionStandards : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
////权限按钮方法
this.GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("ConstructionStandardsEdit.aspx") + "return false;";
// btnSelectColumns.OnClientClick = Window4.GetShowReference("ConstructionStandardsSelectCloumn.aspx");
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT ConstructionStandardsId,ConstructionStandardsCode,ConstructionStandardsName,CompileMan,CompileDate,AttachUrl,AuditMan,AuditDate,IsPass,IsBuild,UpState
FROM dbo.Technique_ConstructionStandards
WHERE 1 =1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.ConstructionStandardsName.Text.Trim()))
{
strSql += " AND ConstructionStandardsName LIKE @ConstructionStandardsName";
listStr.Add(new SqlParameter("@ConstructionStandardsName", "%" + this.ConstructionStandardsName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
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 Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <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();
var getV = BLL.ConstructionStandardsService.GetConstructionStandardsListById(rowID);
if (getV != null)
{
BLL.LogService.AddSys_Log(this.CurrUser, getV.ConstructionStandardsCode, getV.ConstructionStandardsId, BLL.Const.ConstructionStandardsMenuId, Const.BtnDelete);
BLL.ConstructionStandardsService.DeleteConstructionStandardsListById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!");
}
}
#endregion
#region
/// <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 ConstructionStandardsId = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionStandardsEdit.aspx?ConstructionStandardsId={0}", ConstructionStandardsId, "编辑 - ")));
}
#endregion
#region Grid行双击事件
/// <summary>
/// Grid行双击事件
/// </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 TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
BLL.LogService.AddSys_Log(this.CurrUser, string.Empty, string.Empty, BLL.Const.ConstructionStandardsMenuId, Const.BtnQuery);
}
#endregion
#region
/// <summary>
/// 关闭导出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window4_Close(object sender, WindowCloseEventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#')));
Response.End();
}
/// <summary>
/// 导出
/// </summary>
/// <param name="grid"></param>
/// <param name="columns"></param>
/// <returns></returns>
private string GetGridTableHtml(Grid grid, string[] columns)
{
StringBuilder sb = new StringBuilder();
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
List<string> columnHeaderTexts = new List<string>(columns);
List<int> columnIndexs = new List<int>();
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
if (columnHeaderTexts.Contains(column.HeaderText))
{
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
columnIndexs.Add(column.ColumnIndex);
}
}
sb.Append("</tr>");
foreach (GridRow row in grid.Rows)
{
sb.Append("<tr>");
int columnIndex = 0;
foreach (object value in row.Values)
{
if (columnIndexs.Contains(columnIndex))
{
string html = value.ToString();
if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX))
{
// 模板列
string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length);
Control templateCtrl = row.FindControl(templateID);
html = GetRenderedHtmlSource(templateCtrl);
}
sb.AppendFormat("<td>{0}</td>", html);
}
columnIndex++;
}
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}
/// <summary>
/// 获取控件渲染后的HTML源代码
/// </summary>
/// <param name="ctrl"></param>
/// <returns></returns>
private string GetRenderedHtmlSource(Control ctrl)
{
if (ctrl != null)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
ctrl.RenderControl(htw);
return sw.ToString();
}
}
}
return String.Empty;
}
#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.ConstructionStandardsMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnOut))
{
// this.btnSelectColumns.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,170 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ConstructionStandards
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// ConstructionStandardsName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox ConstructionStandardsName;
/// <summary>
/// btnQuery control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnQuery;
/// <summary>
/// btnNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// ToolbarSeparator1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window4;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,72 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ConstructionStandardsEdit.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.ConstructionStandardsEdit" %>
<!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" />
</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"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtConstructionStandardsCode" runat="server" Label="编号" Required="true"
MaxLength="50" ShowRedStar="true" FocusOnPageLoad="true" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtConstructionStandardsName" runat="server" Label="名称" Required="true"
MaxLength="500" ShowRedStar="true" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlCompileMan" runat="server" Label="编制人">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="编制日期" ID="dpkCompileDate">
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtRemark" runat="server" Label="备注" MaxLength="500" LabelAlign="Right" ></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:Button ID="btnAttachUrl" Text="附件" ToolTip="附件上传及查看" Icon="TableCell" runat="server" OnClick="btnUploadResources_Click"
ValidateForms="SimpleForm1">
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
Hidden="true" OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</body>
</html>
@@ -0,0 +1,221 @@
using BLL;
using System;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ConstructionStandardsEdit : PageBase
{
#region
/// <summary>
/// 防护标准ID
/// </summary>
public string ConstructionStandardsId
{
get
{
return (string)ViewState["ConstructionStandardsId"];
}
set
{
ViewState["ConstructionStandardsId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
////权限按钮方法
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
//人员
UserService.InitUserDropDownList(this.ddlCompileMan, string.Empty, true);
//加载默认整理人、整理日期
this.ddlCompileMan.SelectedValue = this.CurrUser.UserId;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.ConstructionStandardsId = Request.Params["ConstructionStandardsId"];
if (!string.IsNullOrEmpty(this.ConstructionStandardsId))
{
var ConstructionStandards = BLL.ConstructionStandardsService.GetConstructionStandardsListById(this.ConstructionStandardsId);
if (ConstructionStandards != null)
{
this.txtConstructionStandardsCode.Text = ConstructionStandards.ConstructionStandardsCode;
this.txtConstructionStandardsName.Text = ConstructionStandards.ConstructionStandardsName;
this.txtRemark.Text = ConstructionStandards.Remark;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", ConstructionStandards.CompileDate);
if (!string.IsNullOrEmpty(ConstructionStandards.CompileMan))
{
this.ddlCompileMan.SelectedItem.Text = ConstructionStandards.CompileMan;
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 保存数据
/// </summary>
private void SaveData()
{
Model.Technique_ConstructionStandards ConstructionStandards = new Model.Technique_ConstructionStandards();
if (!string.IsNullOrEmpty(this.txtConstructionStandardsCode.Text.Trim()))
{
ConstructionStandards.ConstructionStandardsCode = this.txtConstructionStandardsCode.Text.Trim();
}
else
{
ShowNotify("请输入编号", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtConstructionStandardsName.Text.Trim()))
{
ConstructionStandards.ConstructionStandardsName = this.txtConstructionStandardsName.Text.Trim();
}
else
{
ShowNotify("请输入名称", MessageBoxIcon.Warning);
return;
}
if (this.ddlCompileMan.SelectedValue != null)
{
ConstructionStandards.CompileMan = this.ddlCompileMan.SelectedItem.Text;
}
else
{
ConstructionStandards.CompileMan = this.CurrUser.UserName;
}
if (!string.IsNullOrEmpty(this.dpkCompileDate.Text))
{
ConstructionStandards.CompileDate = Convert.ToDateTime(this.dpkCompileDate.Text);
}
else
{
ConstructionStandards.CompileDate = DateTime.Now;
}
if (txtRemark.Text.Trim() != string.Empty)
{
ConstructionStandards.Remark = txtRemark.Text.Trim();
}
if (string.IsNullOrEmpty(this.ConstructionStandardsId))
{
ConstructionStandards.IsPass = true;
this.ConstructionStandardsId = ConstructionStandards.ConstructionStandardsId = SQLHelper.GetNewID(typeof(Model.Technique_ConstructionStandards));
BLL.ConstructionStandardsService.AddConstructionStandardsList(ConstructionStandards);
BLL.LogService.AddSys_Log(this.CurrUser, ConstructionStandards.ConstructionStandardsCode, ConstructionStandards.ConstructionStandardsId, BLL.Const.ConstructionStandardsMenuId, Const.BtnAdd);
}
else
{
ConstructionStandards.ConstructionStandardsId = this.ConstructionStandardsId;
BLL.ConstructionStandardsService.UpdateConstructionStandardsList(ConstructionStandards);
BLL.LogService.AddSys_Log(this.CurrUser, ConstructionStandards.ConstructionStandardsCode, ConstructionStandards.ConstructionStandardsId, BLL.Const.ConstructionStandardsMenuId, Const.BtnModify);
}
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUploadResources_Click(object sender, EventArgs e)
{
if (this.btnSave.Hidden)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ConstructionStandards&type=-1", this.ConstructionStandardsId)));
}
else
{
if (string.IsNullOrEmpty(this.txtConstructionStandardsCode.Text.Trim()))
{
ShowNotify("请输入方案编号", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtConstructionStandardsName.Text.Trim()))
{
ShowNotify("请输入方案名称", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.ConstructionStandardsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ConstructionStandards&menuId={1}", this.ConstructionStandardsId, BLL.Const.ConstructionStandardsMenuId)));
}
}
#endregion
#region
/// <summary>
/// 验证方案编号、名称是否存在
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
var q = Funs.DB.Technique_ConstructionStandards.FirstOrDefault(x => x.IsPass == true && x.ConstructionStandardsCode == this.txtConstructionStandardsCode.Text.Trim() && (x.ConstructionStandardsId != this.ConstructionStandardsId || (this.ConstructionStandardsId == null && x.ConstructionStandardsId != null)));
if (q != null)
{
ShowNotify("输入的方案编号已存在!", MessageBoxIcon.Warning);
}
var q2 = Funs.DB.Technique_ConstructionStandards.FirstOrDefault(x => x.IsPass == true && x.ConstructionStandardsName == this.txtConstructionStandardsName.Text.Trim() && (x.ConstructionStandardsId != this.ConstructionStandardsId || (this.ConstructionStandardsId == null && x.ConstructionStandardsId != null)));
if (q2 != null)
{
ShowNotify("输入的方案名称已存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ConstructionStandardsMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,152 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ConstructionStandardsEdit
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtConstructionStandardsCode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtConstructionStandardsCode;
/// <summary>
/// txtConstructionStandardsName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtConstructionStandardsName;
/// <summary>
/// ddlCompileMan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlCompileMan;
/// <summary>
/// dpkCompileDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DatePicker dpkCompileDate;
/// <summary>
/// txtRemark control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextArea txtRemark;
/// <summary>
/// Toolbar1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// btnAttachUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// ToolbarFill1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
}
@@ -0,0 +1,108 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProtectionStandards.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.ProtectionStandards" %>
<!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" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="防护标准" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="ProtectionStandardsId" EnableColumnLines="true"
DataIDField="ProtectionStandardsId" AllowSorting="true" SortField="ProtectionStandardsCode" ForceFit="true"
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server">
<Items>
<f:TextBox ID="ProtectionStandardsName" runat="server" Label="名称" EmptyText="输入查询名称"
Width="250px" LabelWidth="70px">
</f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnQuery" ToolTip="查询" Icon="SystemSearch" EnablePostBack="true"
OnClick="TextBox_TextChanged" runat="server" >
</f:Button>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
Hidden="true">
</f:Button>
<%-- <f:Button ID="btnSelectColumns" runat="server" ToolTip="导出" Icon="FolderUp" EnablePostBack="false" Hidden="true"> --%>
<%-- </f:Button> --%>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField Width="160px" ColumnID="ProtectionStandardsCode" DataField="ProtectionStandardsCode" SortField="ProtectionStandardsCode"
FieldType="String" HeaderText="编号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="220px" ColumnID="ProtectionStandardsName" DataField="ProtectionStandardsName" SortField="ProtectionStandardsName"
FieldType="String" HeaderText="名称" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="CompileMan" DataField="CompileMan" SortField="CompileMan"
FieldType="String" HeaderText="编制人" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="250px" ColumnID="CompileDate" DataField="CompileDate" SortField="CompileDate"
FieldType="String" HeaderText="编制时间" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:WindowField TextAlign="Left" Width="70px" WindowID="WindowAtt" Text="详细"
ToolTip="上传查看" DataIFrameUrlFields="ProtectionStandardsId" DataIFrameUrlFormatString="../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ProtectionStandards&menuId=8E3A5EDC-62CA-4F64-A4E7-CD3D473A6201"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="编辑防护标准" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="750px" Height="420px">
</f:Window>
<f:Window ID="Window4" Title="选择需要导出的列" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window4_Close" IsModal="true"
Width="450px" Height="250px" EnableAjax="false">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Icon="Delete"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/jscript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,319 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.UI;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ProtectionStandards : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
////权限按钮方法
this.GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("ProtectionStandardsEdit.aspx") + "return false;";
// btnSelectColumns.OnClientClick = Window4.GetShowReference("ProtectionStandardsSelectCloumn.aspx");
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT ProtectionStandardsId,ProtectionStandardsCode,ProtectionStandardsName,CompileMan,CompileDate,AttachUrl,AuditMan,AuditDate,IsPass,IsBuild,UpState
FROM dbo.Technique_ProtectionStandards
WHERE 1 =1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.ProtectionStandardsName.Text.Trim()))
{
strSql += " AND ProtectionStandardsName LIKE @ProtectionStandardsName";
listStr.Add(new SqlParameter("@ProtectionStandardsName", "%" + this.ProtectionStandardsName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
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 Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <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();
var getV = BLL.ProtectionStandardsService.GetProtectionStandardsListById(rowID);
if (getV != null)
{
BLL.LogService.AddSys_Log(this.CurrUser, getV.ProtectionStandardsCode, getV.ProtectionStandardsId, BLL.Const.ProtectionStandardsMenuId, Const.BtnDelete);
BLL.ProtectionStandardsService.DeleteProtectionStandardsListById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!");
}
}
#endregion
#region
/// <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 ProtectionStandardsId = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProtectionStandardsEdit.aspx?ProtectionStandardsId={0}", ProtectionStandardsId, "编辑 - ")));
}
#endregion
#region Grid行双击事件
/// <summary>
/// Grid行双击事件
/// </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 TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
BLL.LogService.AddSys_Log(this.CurrUser, string.Empty, string.Empty, BLL.Const.ProtectionStandardsMenuId, Const.BtnQuery);
}
#endregion
#region
/// <summary>
/// 关闭导出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window4_Close(object sender, WindowCloseEventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#')));
Response.End();
}
/// <summary>
/// 导出
/// </summary>
/// <param name="grid"></param>
/// <param name="columns"></param>
/// <returns></returns>
private string GetGridTableHtml(Grid grid, string[] columns)
{
StringBuilder sb = new StringBuilder();
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
List<string> columnHeaderTexts = new List<string>(columns);
List<int> columnIndexs = new List<int>();
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
if (columnHeaderTexts.Contains(column.HeaderText))
{
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
columnIndexs.Add(column.ColumnIndex);
}
}
sb.Append("</tr>");
foreach (GridRow row in grid.Rows)
{
sb.Append("<tr>");
int columnIndex = 0;
foreach (object value in row.Values)
{
if (columnIndexs.Contains(columnIndex))
{
string html = value.ToString();
if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX))
{
// 模板列
string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length);
Control templateCtrl = row.FindControl(templateID);
html = GetRenderedHtmlSource(templateCtrl);
}
sb.AppendFormat("<td>{0}</td>", html);
}
columnIndex++;
}
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}
/// <summary>
/// 获取控件渲染后的HTML源代码
/// </summary>
/// <param name="ctrl"></param>
/// <returns></returns>
private string GetRenderedHtmlSource(Control ctrl)
{
if (ctrl != null)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
ctrl.RenderControl(htw);
return sw.ToString();
}
}
}
return String.Empty;
}
#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.ProtectionStandardsMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnOut))
{
// this.btnSelectColumns.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,170 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ProtectionStandards
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// ProtectionStandardsName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox ProtectionStandardsName;
/// <summary>
/// btnQuery control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnQuery;
/// <summary>
/// btnNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// ToolbarSeparator1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window4;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,73 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProtectionStandardsEdit.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.ProtectionStandardsEdit" %>
<!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" />
</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"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtProtectionStandardsCode" runat="server" Label="编号" Required="true"
MaxLength="50" ShowRedStar="true" FocusOnPageLoad="true" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtProtectionStandardsName" runat="server" Label="名称" Required="true"
MaxLength="500" ShowRedStar="true" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlCompileMan" runat="server" Label="编制人">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="编制日期" ID="dpkCompileDate">
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtRemark" runat="server" Label="备注" MaxLength="500" LabelAlign="Right" ></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:Button ID="btnAttachUrl" Text="附件" ToolTip="附件上传及查看" Icon="TableCell" runat="server" OnClick="btnUploadResources_Click"
ValidateForms="SimpleForm1">
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
Hidden="true" OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</body>
</html>
@@ -0,0 +1,223 @@
using BLL;
using System;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ProtectionStandardsEdit : PageBase
{
#region
/// <summary>
/// 防护标准ID
/// </summary>
public string ProtectionStandardsId
{
get
{
return (string)ViewState["ProtectionStandardsId"];
}
set
{
ViewState["ProtectionStandardsId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
////权限按钮方法
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
//人员
UserService.InitUserDropDownList(this.ddlCompileMan, string.Empty, true);
//加载默认整理人、整理日期
this.ddlCompileMan.SelectedValue = this.CurrUser.UserId;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.ProtectionStandardsId = Request.Params["ProtectionStandardsId"];
if (!string.IsNullOrEmpty(this.ProtectionStandardsId))
{
var ProtectionStandards = BLL.ProtectionStandardsService.GetProtectionStandardsListById(this.ProtectionStandardsId);
if (ProtectionStandards != null)
{
this.txtProtectionStandardsCode.Text = ProtectionStandards.ProtectionStandardsCode;
this.txtProtectionStandardsName.Text = ProtectionStandards.ProtectionStandardsName;
this.txtRemark.Text = ProtectionStandards.Remark;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", ProtectionStandards.CompileDate);
if (!string.IsNullOrEmpty(ProtectionStandards.CompileMan))
{
this.ddlCompileMan.SelectedItem.Text = ProtectionStandards.CompileMan;
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 保存数据
/// </summary>
private void SaveData()
{
Model.Technique_ProtectionStandards ProtectionStandards = new Model.Technique_ProtectionStandards();
if (!string.IsNullOrEmpty(this.txtProtectionStandardsCode.Text.Trim()))
{
ProtectionStandards.ProtectionStandardsCode = this.txtProtectionStandardsCode.Text.Trim();
}
else
{
ShowNotify("请输入编号", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtProtectionStandardsName.Text.Trim()))
{
ProtectionStandards.ProtectionStandardsName = this.txtProtectionStandardsName.Text.Trim();
}
else
{
ShowNotify("请输入名称", MessageBoxIcon.Warning);
return;
}
if (this.ddlCompileMan.SelectedValue != null)
{
ProtectionStandards.CompileMan = this.ddlCompileMan.SelectedItem.Text;
}
else
{
ProtectionStandards.CompileMan = this.CurrUser.UserName;
}
if (!string.IsNullOrEmpty(this.dpkCompileDate.Text))
{
ProtectionStandards.CompileDate = Convert.ToDateTime(this.dpkCompileDate.Text);
}
else
{
ProtectionStandards.CompileDate = DateTime.Now;
}
if (txtRemark.Text.Trim() != string.Empty)
{
ProtectionStandards.Remark = txtRemark.Text.Trim();
}
if (string.IsNullOrEmpty(this.ProtectionStandardsId))
{
ProtectionStandards.IsPass = true;
this.ProtectionStandardsId = ProtectionStandards.ProtectionStandardsId = SQLHelper.GetNewID(typeof(Model.Technique_ProtectionStandards));
BLL.ProtectionStandardsService.AddProtectionStandardsList(ProtectionStandards);
BLL.LogService.AddSys_Log(this.CurrUser, ProtectionStandards.ProtectionStandardsCode, ProtectionStandards.ProtectionStandardsId, BLL.Const.ProtectionStandardsMenuId, Const.BtnAdd);
}
else
{
ProtectionStandards.ProtectionStandardsId = this.ProtectionStandardsId;
BLL.ProtectionStandardsService.UpdateProtectionStandardsList(ProtectionStandards);
BLL.LogService.AddSys_Log(this.CurrUser, ProtectionStandards.ProtectionStandardsCode, ProtectionStandards.ProtectionStandardsId, BLL.Const.ProtectionStandardsMenuId, Const.BtnModify);
}
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUploadResources_Click(object sender, EventArgs e)
{
if (this.btnSave.Hidden)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ProtectionStandards&type=-1", this.ProtectionStandardsId)));
}
else
{
if (string.IsNullOrEmpty(this.txtProtectionStandardsCode.Text.Trim()))
{
ShowNotify("请输入方案编号", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtProtectionStandardsName.Text.Trim()))
{
ShowNotify("请输入方案名称", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.ProtectionStandardsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ProtectionStandards&menuId={1}", this.ProtectionStandardsId, BLL.Const.ProtectionStandardsMenuId)));
}
}
#endregion
#region
/// <summary>
/// 验证方案编号、名称是否存在
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
var q = Funs.DB.Technique_ProtectionStandards.FirstOrDefault(x => x.IsPass == true && x.ProtectionStandardsCode == this.txtProtectionStandardsCode.Text.Trim() && (x.ProtectionStandardsId != this.ProtectionStandardsId || (this.ProtectionStandardsId == null && x.ProtectionStandardsId != null)));
if (q != null)
{
ShowNotify("输入的方案编号已存在!", MessageBoxIcon.Warning);
}
var q2 = Funs.DB.Technique_ProtectionStandards.FirstOrDefault(x => x.IsPass == true && x.ProtectionStandardsName == this.txtProtectionStandardsName.Text.Trim() && (x.ProtectionStandardsId != this.ProtectionStandardsId || (this.ProtectionStandardsId == null && x.ProtectionStandardsId != null)));
if (q2 != null)
{
ShowNotify("输入的方案名称已存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProtectionStandardsMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,152 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class ProtectionStandardsEdit
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtProtectionStandardsCode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtProtectionStandardsCode;
/// <summary>
/// txtProtectionStandardsName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtProtectionStandardsName;
/// <summary>
/// ddlCompileMan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlCompileMan;
/// <summary>
/// dpkCompileDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DatePicker dpkCompileDate;
/// <summary>
/// txtRemark control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextArea txtRemark;
/// <summary>
/// Toolbar1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// btnAttachUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// ToolbarFill1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
}
@@ -0,0 +1,108 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SafetyResponsibilities.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.SafetyResponsibilities" %>
<!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" />
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="安全职责" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="SafetyResponsibilitiesId" EnableColumnLines="true"
DataIDField="SafetyResponsibilitiesId" AllowSorting="true" SortField="SafetyResponsibilitiesCode" ForceFit="true"
SortDirection="ASC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true"
PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" EnableRowDoubleClickEvent="true"
OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar3" Position="Top" runat="server">
<Items>
<f:TextBox ID="SafetyResponsibilitiesName" runat="server" Label="名称" EmptyText="输入查询名称"
Width="250px" LabelWidth="70px">
</f:TextBox>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnQuery" ToolTip="查询" Icon="SystemSearch" EnablePostBack="true"
OnClick="TextBox_TextChanged" runat="server" >
</f:Button>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
Hidden="true">
</f:Button>
<%-- <f:Button ID="btnSelectColumns" runat="server" ToolTip="导出" Icon="FolderUp" EnablePostBack="false" Hidden="true"> --%>
<%-- </f:Button> --%>
</Items>
</f:Toolbar>
</Toolbars>
<Columns>
<f:RowNumberField EnablePagingNumber="true" HeaderText="序号" Width="50px" HeaderTextAlign="Center" TextAlign="Center" />
<f:RenderField Width="160px" ColumnID="SafetyResponsibilitiesCode" DataField="SafetyResponsibilitiesCode" SortField="SafetyResponsibilitiesCode"
FieldType="String" HeaderText="编号" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="220px" ColumnID="SafetyResponsibilitiesName" DataField="SafetyResponsibilitiesName" SortField="SafetyResponsibilitiesName"
FieldType="String" HeaderText="名称" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="CompileMan" DataField="CompileMan" SortField="CompileMan"
FieldType="String" HeaderText="编制人" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="250px" ColumnID="CompileDate" DataField="CompileDate" SortField="CompileDate"
FieldType="String" HeaderText="编制时间" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:WindowField TextAlign="Left" Width="70px" WindowID="WindowAtt" Text="详细"
ToolTip="上传查看" DataIFrameUrlFields="SafetyResponsibilitiesId" DataIFrameUrlFormatString="../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/SafetyResponsibilities&menuId=8E3A5EDC-62CA-4F64-A4E7-CD3D473A6201"/>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
</Listeners>
<PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator>
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
</f:ToolbarText>
<f:DropDownList runat="server" ID="ddlPageSize" Width="80px" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
</f:DropDownList>
</PageItems>
</f:Grid>
</Items>
</f:Panel>
<f:Window ID="Window1" Title="编辑安全职责" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window1_Close" IsModal="true"
Width="750px" Height="420px">
</f:Window>
<f:Window ID="Window4" Title="选择需要导出的列" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" OnClose="Window4_Close" IsModal="true"
Width="450px" Height="250px" EnableAjax="false">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true"
Hidden="true" runat="server" Text="编辑" Icon="Pencil">
</f:MenuButton>
<f:MenuButton ID="btnMenuDelete" OnClick="btnMenuDelete_Click" EnablePostBack="true" Icon="Delete"
Hidden="true" ConfirmText="删除选中行?" ConfirmTarget="Parent" runat="server" Text="删除">
</f:MenuButton>
</f:Menu>
</form>
<script type="text/jscript">
var menuID = '<%= Menu1.ClientID %>';
// 返回false,来阻止浏览器右键菜单
function onRowContextMenu(event, rowId) {
F(menuID).show(); //showAt(event.pageX, event.pageY);
return false;
}
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
</script>
</body>
</html>
@@ -0,0 +1,319 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Web.UI;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class SafetyResponsibilities : PageBase
{
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Funs.DropDownPageSize(this.ddlPageSize);
////权限按钮方法
this.GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("SafetyResponsibilitiesEdit.aspx") + "return false;";
// btnSelectColumns.OnClientClick = Window4.GetShowReference("SafetyResponsibilitiesSelectCloumn.aspx");
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT SafetyResponsibilitiesId,SafetyResponsibilitiesCode,SafetyResponsibilitiesName,CompileMan,CompileDate,AttachUrl,AuditMan,AuditDate,IsPass,IsBuild,UpState
FROM dbo.Technique_SafetyResponsibilities
WHERE 1 =1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(this.SafetyResponsibilitiesName.Text.Trim()))
{
strSql += " AND SafetyResponsibilitiesName LIKE @SafetyResponsibilitiesName";
listStr.Add(new SqlParameter("@SafetyResponsibilitiesName", "%" + this.SafetyResponsibilitiesName.Text.Trim() + "%"));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
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 Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
/// <summary>
/// 分页显示条数下拉框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
/// <summary>
/// 排序
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
/// <summary>
/// 关闭窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
BindGrid();
}
#endregion
#region
/// <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();
var getV = BLL.SafetyResponsibilitiesService.GetSafetyResponsibilitiesListById(rowID);
if (getV != null)
{
BLL.LogService.AddSys_Log(this.CurrUser, getV.SafetyResponsibilitiesCode, getV.SafetyResponsibilitiesId, BLL.Const.SafetyResponsibilitiesMenuId, Const.BtnDelete);
BLL.SafetyResponsibilitiesService.DeleteSafetyResponsibilitiesListById(rowID);
}
}
BindGrid();
ShowNotify("删除数据成功!");
}
}
#endregion
#region
/// <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 SafetyResponsibilitiesId = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SafetyResponsibilitiesEdit.aspx?SafetyResponsibilitiesId={0}", SafetyResponsibilitiesId, "编辑 - ")));
}
#endregion
#region Grid行双击事件
/// <summary>
/// Grid行双击事件
/// </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 TextBox_TextChanged(object sender, EventArgs e)
{
this.BindGrid();
BLL.LogService.AddSys_Log(this.CurrUser, string.Empty, string.Empty, BLL.Const.SafetyResponsibilitiesMenuId, Const.BtnQuery);
}
#endregion
#region
/// <summary>
/// 关闭导出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window4_Close(object sender, WindowCloseEventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Write(GetGridTableHtml(Grid1, e.CloseArgument.Split('#')));
Response.End();
}
/// <summary>
/// 导出
/// </summary>
/// <param name="grid"></param>
/// <param name="columns"></param>
/// <returns></returns>
private string GetGridTableHtml(Grid grid, string[] columns)
{
StringBuilder sb = new StringBuilder();
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
List<string> columnHeaderTexts = new List<string>(columns);
List<int> columnIndexs = new List<int>();
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
sb.Append("<tr>");
foreach (GridColumn column in grid.Columns)
{
if (columnHeaderTexts.Contains(column.HeaderText))
{
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
columnIndexs.Add(column.ColumnIndex);
}
}
sb.Append("</tr>");
foreach (GridRow row in grid.Rows)
{
sb.Append("<tr>");
int columnIndex = 0;
foreach (object value in row.Values)
{
if (columnIndexs.Contains(columnIndex))
{
string html = value.ToString();
if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX))
{
// 模板列
string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length);
Control templateCtrl = row.FindControl(templateID);
html = GetRenderedHtmlSource(templateCtrl);
}
sb.AppendFormat("<td>{0}</td>", html);
}
columnIndex++;
}
sb.Append("</tr>");
}
sb.Append("</table>");
return sb.ToString();
}
/// <summary>
/// 获取控件渲染后的HTML源代码
/// </summary>
/// <param name="ctrl"></param>
/// <returns></returns>
private string GetRenderedHtmlSource(Control ctrl)
{
if (ctrl != null)
{
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
ctrl.RenderControl(htw);
return sw.ToString();
}
}
}
return String.Empty;
}
#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.SafetyResponsibilitiesMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
this.btnMenuEdit.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnDelete))
{
this.btnMenuDelete.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnOut))
{
// this.btnSelectColumns.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,170 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class SafetyResponsibilities
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// Panel1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// Toolbar3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar3;
/// <summary>
/// SafetyResponsibilitiesName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox SafetyResponsibilitiesName;
/// <summary>
/// btnQuery control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnQuery;
/// <summary>
/// btnNew control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// ToolbarSeparator1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1;
/// <summary>
/// ToolbarText1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarText ToolbarText1;
/// <summary>
/// ddlPageSize control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlPageSize;
/// <summary>
/// Window1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window Window4;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
/// <summary>
/// Menu1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Menu Menu1;
/// <summary>
/// btnMenuEdit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuEdit;
/// <summary>
/// btnMenuDelete control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.MenuButton btnMenuDelete;
}
}
@@ -0,0 +1,72 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SafetyResponsibilitiesEdit.aspx.cs" Inherits="FineUIPro.Web.HSSE.Technique.SafetyResponsibilitiesEdit" %>
<!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" />
</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"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:TextBox ID="txtSafetyResponsibilitiesCode" runat="server" Label="编号" Required="true"
MaxLength="50" ShowRedStar="true" FocusOnPageLoad="true" AutoPostBack="true"
OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtSafetyResponsibilitiesName" runat="server" Label="名称" Required="true"
MaxLength="500" ShowRedStar="true" AutoPostBack="true" OnTextChanged="TextBox_TextChanged">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="ddlCompileMan" runat="server" Label="编制人">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DatePicker runat="server" Label="编制日期" ID="dpkCompileDate">
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextArea ID="txtRemark" runat="server" Label="备注" MaxLength="500" LabelAlign="Right"></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:Button ID="btnAttachUrl" Text="附件" ToolTip="附件上传及查看" Icon="TableCell" runat="server" OnClick="btnUploadResources_Click"
ValidateForms="SimpleForm1">
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server"></f:ToolbarFill>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ValidateForms="SimpleForm1"
Hidden="true" OnClick="btnSave_Click">
</f:Button>
<f:Button ID="btnClose" EnablePostBack="false" ToolTip="关闭" runat="server" Icon="SystemClose">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
</f:Form>
</form>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
</body>
</html>
@@ -0,0 +1,221 @@
using BLL;
using System;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HSSE.Technique
{
public partial class SafetyResponsibilitiesEdit : PageBase
{
#region
/// <summary>
/// 防护标准ID
/// </summary>
public string SafetyResponsibilitiesId
{
get
{
return (string)ViewState["SafetyResponsibilitiesId"];
}
set
{
ViewState["SafetyResponsibilitiesId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
////权限按钮方法
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
//人员
UserService.InitUserDropDownList(this.ddlCompileMan, string.Empty, true);
//加载默认整理人、整理日期
this.ddlCompileMan.SelectedValue = this.CurrUser.UserId;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.SafetyResponsibilitiesId = Request.Params["SafetyResponsibilitiesId"];
if (!string.IsNullOrEmpty(this.SafetyResponsibilitiesId))
{
var SafetyResponsibilities = BLL.SafetyResponsibilitiesService.GetSafetyResponsibilitiesListById(this.SafetyResponsibilitiesId);
if (SafetyResponsibilities != null)
{
this.txtSafetyResponsibilitiesCode.Text = SafetyResponsibilities.SafetyResponsibilitiesCode;
this.txtSafetyResponsibilitiesName.Text = SafetyResponsibilities.SafetyResponsibilitiesName;
this.txtRemark.Text = SafetyResponsibilities.Remark;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", SafetyResponsibilities.CompileDate);
if (!string.IsNullOrEmpty(SafetyResponsibilities.CompileMan))
{
this.ddlCompileMan.SelectedItem.Text = SafetyResponsibilities.CompileMan;
}
}
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 保存数据
/// </summary>
private void SaveData()
{
Model.Technique_SafetyResponsibilities SafetyResponsibilities = new Model.Technique_SafetyResponsibilities();
if (!string.IsNullOrEmpty(this.txtSafetyResponsibilitiesCode.Text.Trim()))
{
SafetyResponsibilities.SafetyResponsibilitiesCode = this.txtSafetyResponsibilitiesCode.Text.Trim();
}
else
{
ShowNotify("请输入编号", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtSafetyResponsibilitiesName.Text.Trim()))
{
SafetyResponsibilities.SafetyResponsibilitiesName = this.txtSafetyResponsibilitiesName.Text.Trim();
}
else
{
ShowNotify("请输入名称", MessageBoxIcon.Warning);
return;
}
if (this.ddlCompileMan.SelectedValue != null)
{
SafetyResponsibilities.CompileMan = this.ddlCompileMan.SelectedItem.Text;
}
else
{
SafetyResponsibilities.CompileMan = this.CurrUser.UserName;
}
if (!string.IsNullOrEmpty(this.dpkCompileDate.Text))
{
SafetyResponsibilities.CompileDate = Convert.ToDateTime(this.dpkCompileDate.Text);
}
else
{
SafetyResponsibilities.CompileDate = DateTime.Now;
}
if (txtRemark.Text.Trim() != string.Empty)
{
SafetyResponsibilities.Remark = txtRemark.Text.Trim();
}
if (string.IsNullOrEmpty(this.SafetyResponsibilitiesId))
{
SafetyResponsibilities.IsPass = true;
this.SafetyResponsibilitiesId = SafetyResponsibilities.SafetyResponsibilitiesId = SQLHelper.GetNewID(typeof(Model.Technique_SafetyResponsibilities));
BLL.SafetyResponsibilitiesService.AddSafetyResponsibilitiesList(SafetyResponsibilities);
BLL.LogService.AddSys_Log(this.CurrUser, SafetyResponsibilities.SafetyResponsibilitiesCode, SafetyResponsibilities.SafetyResponsibilitiesId, BLL.Const.SafetyResponsibilitiesMenuId, Const.BtnAdd);
}
else
{
SafetyResponsibilities.SafetyResponsibilitiesId = this.SafetyResponsibilitiesId;
BLL.SafetyResponsibilitiesService.UpdateSafetyResponsibilitiesList(SafetyResponsibilities);
BLL.LogService.AddSys_Log(this.CurrUser, SafetyResponsibilities.SafetyResponsibilitiesCode, SafetyResponsibilities.SafetyResponsibilitiesId, BLL.Const.SafetyResponsibilitiesMenuId, Const.BtnModify);
}
}
#endregion
#region
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnUploadResources_Click(object sender, EventArgs e)
{
if (this.btnSave.Hidden)
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/SafetyResponsibilities&type=-1", this.SafetyResponsibilitiesId)));
}
else
{
if (string.IsNullOrEmpty(this.txtSafetyResponsibilitiesCode.Text.Trim()))
{
ShowNotify("请输入方案编号", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtSafetyResponsibilitiesName.Text.Trim()))
{
ShowNotify("请输入方案名称", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.SafetyResponsibilitiesId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/SafetyResponsibilities&menuId={1}", this.SafetyResponsibilitiesId, BLL.Const.SafetyResponsibilitiesMenuId)));
}
}
#endregion
#region
/// <summary>
/// 验证方案编号、名称是否存在
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TextBox_TextChanged(object sender, EventArgs e)
{
var q = Funs.DB.Technique_SafetyResponsibilities.FirstOrDefault(x => x.IsPass == true && x.SafetyResponsibilitiesCode == this.txtSafetyResponsibilitiesCode.Text.Trim() && (x.SafetyResponsibilitiesId != this.SafetyResponsibilitiesId || (this.SafetyResponsibilitiesId == null && x.SafetyResponsibilitiesId != null)));
if (q != null)
{
ShowNotify("输入的方案编号已存在!", MessageBoxIcon.Warning);
}
var q2 = Funs.DB.Technique_SafetyResponsibilities.FirstOrDefault(x => x.IsPass == true && x.SafetyResponsibilitiesName == this.txtSafetyResponsibilitiesName.Text.Trim() && (x.SafetyResponsibilitiesId != this.SafetyResponsibilitiesId || (this.SafetyResponsibilitiesId == null && x.SafetyResponsibilitiesId != null)));
if (q2 != null)
{
ShowNotify("输入的方案名称已存在!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private void GetButtonPower()
{
if (Request.Params["value"] == "0")
{
return;
}
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.SafetyResponsibilitiesMenuId);
if (buttonList.Count() > 0)
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnSave.Hidden = false;
}
}
}
#endregion
}
}
@@ -0,0 +1,152 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.HSSE.Technique
{
public partial class SafetyResponsibilitiesEdit
{
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtSafetyResponsibilitiesCode control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtSafetyResponsibilitiesCode;
/// <summary>
/// txtSafetyResponsibilitiesName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextBox txtSafetyResponsibilitiesName;
/// <summary>
/// ddlCompileMan control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DropDownList ddlCompileMan;
/// <summary>
/// dpkCompileDate control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.DatePicker dpkCompileDate;
/// <summary>
/// txtRemark control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.TextArea txtRemark;
/// <summary>
/// Toolbar1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// lbTemp control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// btnAttachUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// ToolbarFill1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// btnSave control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnClose control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// WindowAtt control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
}