提交代码
This commit is contained in:
@@ -0,0 +1,306 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.Hazard
|
||||
{
|
||||
public partial class ConstructionRiskView : PageBase
|
||||
{
|
||||
#region 定义变量
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string ConstructionRiskId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ConstructionRiskId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ConstructionRiskId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 项目主键
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 办理类型
|
||||
/// </summary>
|
||||
public string State
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["State"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["State"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 定义集合
|
||||
/// </summary>
|
||||
private static List<Model.HSSE_ConstructionRiskControl> constructionRiskControls = new List<Model.HSSE_ConstructionRiskControl>();
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
this.InitDropDownList();
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
constructionRiskControls.Clear();
|
||||
this.ConstructionRiskId = Request.Params["ConstructionRiskId"];
|
||||
var constructionRisk = Funs.DB.HSSE_ConstructionRisk.FirstOrDefault(x => x.ConstructionRiskId == this.ConstructionRiskId);
|
||||
if (constructionRisk != null)
|
||||
{
|
||||
this.hdConstructionRiskId.Text = this.ConstructionRiskId;
|
||||
this.ProjectId = constructionRisk.ProjectId;
|
||||
this.dpDateA.Text = string.Format("{0:yyyy-MM-dd}", constructionRisk.DateA);
|
||||
this.dpDateZ.Text = string.Format("{0:yyyy-MM-dd}", constructionRisk.DateZ);
|
||||
|
||||
if (!string.IsNullOrEmpty(constructionRisk.WorkAreaId))
|
||||
{
|
||||
drpWorkArea.SelectedValue = constructionRisk.WorkAreaId;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(constructionRisk.UnitId))
|
||||
{
|
||||
drpUnit.SelectedValue = constructionRisk.UnitId;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(constructionRisk.RefLicense))
|
||||
{
|
||||
drpRefLicense.SelectedValueArray = constructionRisk.RefLicense.Split(',');
|
||||
this.drpRiskLevel.DataSource = BLL.ConstructionRiskListService.RiskLevelList2();
|
||||
this.drpRiskLevel.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpRiskLevel);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(constructionRisk.RiskLevel))
|
||||
{
|
||||
drpRiskLevel.SelectedValue = constructionRisk.RiskLevel;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(constructionRisk.ConstructionContent))
|
||||
{
|
||||
this.txtConstructionContent.Text = HttpUtility.HtmlDecode(constructionRisk.ConstructionContent);
|
||||
}
|
||||
this.hdConstructionContentId.Text = constructionRisk.ConstructionContentId;
|
||||
if (!string.IsNullOrEmpty(constructionRisk.RiskLevel))
|
||||
{
|
||||
this.drpRiskLevel.SelectedValueArray = constructionRisk.RiskLevel.Split(',');
|
||||
}
|
||||
if (!string.IsNullOrEmpty(constructionRisk.LicenseDes))
|
||||
{
|
||||
this.drpLicenseDes.SelectedValueArray = constructionRisk.LicenseDes.Split(',');
|
||||
}
|
||||
this.hdCoordinate.Text = constructionRisk.Coordinate;
|
||||
constructionRiskControls = (from x in Funs.DB.HSSE_ConstructionRiskControl where x.ConstructionRiskId == this.ConstructionRiskId orderby x.ShowIndex select x).ToList();
|
||||
gvApprove.DataSource = BLL.ConstructionRiskApproveService.getListData(this.ConstructionRiskId);
|
||||
gvApprove.DataBind();
|
||||
if (!string.IsNullOrEmpty(constructionRisk.States))
|
||||
{
|
||||
State = constructionRisk.States;
|
||||
}
|
||||
else
|
||||
{
|
||||
State = BLL.Const.ConstructionRisk_Compile;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpUnit.SelectedValue = this.CurrUser.UnitId;
|
||||
}
|
||||
Grid1.DataSource = constructionRiskControls;
|
||||
Grid1.DataBind();
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 初始化下拉框
|
||||
/// </summary>
|
||||
private void InitDropDownList()
|
||||
{
|
||||
///区域下拉框
|
||||
BLL.MainItemService.InitMainItemDownList(this.drpWorkArea, this.ProjectId, true);
|
||||
|
||||
drpRefLicense.DataValueField = "LicenseTypeName";
|
||||
drpRefLicense.DataTextField = "LicenseTypeName";
|
||||
drpRefLicense.DataSource = (from x in Funs.DB.Base_LicenseType orderby x.LicenseTypeCode select x).ToList();
|
||||
drpRefLicense.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpRefLicense);
|
||||
this.drpRiskLevel.DataTextField = "Text";
|
||||
this.drpRiskLevel.DataValueField = "Value";
|
||||
this.drpRiskLevel.DataSource = BLL.ConstructionRiskListService.RiskLevelList();
|
||||
this.drpRiskLevel.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpRiskLevel);
|
||||
Funs.FineUIPleaseSelect(this.drpLicenseDes);
|
||||
UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnit, this.ProjectId, Const.ProjectUnitType_2, false);
|
||||
}
|
||||
|
||||
#region 关闭弹出窗
|
||||
/// <summary>
|
||||
/// 关闭弹出窗
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
constructionRiskControls = (from x in Funs.DB.HSSE_ConstructionRiskControl where x.ConstructionRiskId == this.hdConstructionRiskId.Text orderby x.ShowIndex select x).ToList();
|
||||
Grid1.DataSource = constructionRiskControls;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭弹出窗
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window2_Close(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Grid双击事件
|
||||
/// <summary>
|
||||
/// Grid行双击事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
btnMenuEdit_Click(null, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑
|
||||
/// <summary>
|
||||
/// 编辑按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string rowID = Grid1.SelectedRowID;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskControlEdit.aspx?ConstructionRiskId={0}&ControlId={1}", ConstructionRiskId, rowID, "编辑 - ")));
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var constructionRiskControl = Funs.DB.HSSE_ConstructionRiskControl.FirstOrDefault(x => x.ControlId == rowID);
|
||||
Funs.DB.HSSE_ConstructionRiskControl.DeleteOnSubmit(constructionRiskControl);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
constructionRiskControls = (from x in Funs.DB.HSSE_ConstructionRiskControl where x.ConstructionRiskId == this.ConstructionRiskId orderby x.ShowIndex select x).ToList();
|
||||
Grid1.DataSource = constructionRiskControls;
|
||||
Grid1.DataBind();
|
||||
ShowNotify("删除数据成功!(表格数据已重新绑定)");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 区域选择框事件
|
||||
/// <summary>
|
||||
/// 区域选择框事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void dpDateA_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ConstructionRiskId))
|
||||
{
|
||||
this.hdConstructionRiskId.Text = SQLHelper.GetNewID(typeof(Model.Hazard_EnvironmentalRiskList));
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionRiskControlEdit.aspx?ConstructionRiskId=" + this.hdConstructionRiskId.Text, "添加 - ")));
|
||||
}
|
||||
|
||||
protected void btnMap_Click(object sender, EventArgs e)
|
||||
{
|
||||
string window = String.Format("LocationSelect.aspx?type=see&ConstructionRiskId=" + this.ConstructionRiskId);
|
||||
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdCoordinate.ClientID) + Window2.GetShowReference(window));
|
||||
//PageContext.RegisterStartupScript(Window2.GetShowReference());
|
||||
}
|
||||
|
||||
protected void drpRefLicense_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (this.drpRefLicense.SelectedValueArray.Length == 1 && this.drpRefLicense.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
this.drpRiskLevel.DataSource = BLL.ConstructionRiskListService.RiskLevelList();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.drpRiskLevel.DataSource = BLL.ConstructionRiskListService.RiskLevelList2();
|
||||
}
|
||||
this.drpRiskLevel.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpRiskLevel);
|
||||
this.drpRiskLevel.SelectedValue = BLL.Const._Null;
|
||||
}
|
||||
|
||||
#region 关闭弹出窗口
|
||||
/// <summary>
|
||||
/// 关闭弹出窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window3_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(hdConstructionContentId.Text))
|
||||
{
|
||||
var c = BLL.ControlItemAndCycleService.GetControlItemAndCycleById(hdConstructionContentId.Text);
|
||||
if (c != null)
|
||||
{
|
||||
this.txtConstructionContent.Text = c.ControlItemContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user