173 lines
5.3 KiB
C#
173 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.HSSE.HazardousMG
|
|
{
|
|
/// <summary>
|
|
/// 安全技术交底页面
|
|
/// </summary>
|
|
public partial class SafetyDisclosure : PageBase
|
|
{
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增按钮事件
|
|
/// </summary>
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.CurrUser == null || string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
{
|
|
Alert.ShowInTop("请先选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference("SafetyDisclosureEdit.aspx"));
|
|
}
|
|
#endregion
|
|
|
|
#region 数据绑定
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
if (this.CurrUser == null || string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
{
|
|
Alert.ShowInTop("请先登录或选择项目!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
List<Model.HSSE_SafetyDisclosure> list = BLL.SafetyDisclosureService.GetList(this.CurrUser.LoginProjectId);
|
|
////查询条件过滤
|
|
string projectName = this.txtProjectName.Text.Trim();
|
|
if (!string.IsNullOrEmpty(projectName))
|
|
{
|
|
list = list.Where(x => x.HazardProjectName.Contains(projectName)).ToList();
|
|
}
|
|
Grid1.RecordCount = list.Count;
|
|
var table = this.GetPagedDataTable(Grid1, list);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页事件
|
|
/// </summary>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 每页记录数改变事件
|
|
/// </summary>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
|
this.BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序事件
|
|
/// </summary>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 双击行编辑事件
|
|
/// </summary>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
this.EditData();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 右键菜单编辑事件
|
|
/// </summary>
|
|
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 id = Grid1.SelectedRowID;
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SafetyDisclosureEdit.aspx?DisclosureId={0}", id)));
|
|
}
|
|
#endregion
|
|
|
|
#region 删除
|
|
/// <summary>
|
|
/// 右键菜单删除事件
|
|
/// </summary>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
{
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
BLL.SafetyDisclosureService.Delete(rowID);
|
|
}
|
|
this.BindGrid();
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编辑窗口关闭事件
|
|
/// </summary>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 附件查看
|
|
/// <summary>
|
|
/// 附件查看(参考专项施工方案,弹出附件列表窗口)
|
|
/// </summary>
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
if (e.CommandName == "attchUrl")
|
|
{
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/SafetyDisclosure&menuId={2}",
|
|
-1, e.RowID, BLL.Const.ProjectHSETechnicalMenuId)));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|