213 lines
8.0 KiB
C#
213 lines
8.0 KiB
C#
|
using System;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using BLL;
|
|||
|
|
|||
|
namespace FineUIPro.Web.ZHGL.HSSESystem
|
|||
|
{
|
|||
|
public partial class HSSEOrganize : PageBase
|
|||
|
{
|
|||
|
#region 项目主键
|
|||
|
/// <summary>
|
|||
|
/// 项目主键
|
|||
|
/// </summary>
|
|||
|
public string ProjectId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ProjectId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ProjectId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#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;
|
|||
|
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
|||
|
{
|
|||
|
this.ProjectId = Request.Params["projectId"];
|
|||
|
}
|
|||
|
|
|||
|
this.ucTree.UnitId = this.CurrUser.UnitId;
|
|||
|
this.ucTree.ProjectId = this.ProjectId;
|
|||
|
|
|||
|
/*if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|||
|
{
|
|||
|
this.panelLeftRegion.Hidden = true;
|
|||
|
// this.Grid1.Columns[0].Hidden = true;
|
|||
|
////权限按钮方法
|
|||
|
this.GetButtonPower();
|
|||
|
} */
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
protected void changeTree(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.ProjectId = this.ucTree.ProjectId;
|
|||
|
this.GetButtonPower();
|
|||
|
|
|||
|
var organize = BLL.HSSEOrganizeService.GetHSSEOrganizeByUnitIdAndProjectId(ucTree.UnitId, this.ProjectId);
|
|||
|
if (organize != null)
|
|||
|
{
|
|||
|
this.txtSeeFile.Text = HttpUtility.HtmlDecode(organize.SeeFile);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.txtSeeFile.Text = "";
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
#region 获取按钮权限
|
|||
|
bool isBelongUnitAndProject(string unitid, string projectid)
|
|||
|
{
|
|||
|
bool isBelongUnitAndProject = false;
|
|||
|
if (this.ucTree.UnitId == CurrUser.UnitId)
|
|||
|
{
|
|||
|
isBelongUnitAndProject = true;
|
|||
|
}
|
|||
|
else if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId) && this.ucTree.ProjectId == CurrUser.LoginProjectId)
|
|||
|
{
|
|||
|
isBelongUnitAndProject = true;
|
|||
|
|
|||
|
}
|
|||
|
else if (CurrUser.UserId == Const.sysglyId || CurrUser.UserId == Const.hfnbdId)
|
|||
|
{
|
|||
|
isBelongUnitAndProject = true;
|
|||
|
}
|
|||
|
return isBelongUnitAndProject;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 获取按钮权限
|
|||
|
/// </summary>
|
|||
|
/// <param name="button"></param>
|
|||
|
/// <returns></returns>
|
|||
|
private void GetButtonPower()
|
|||
|
{
|
|||
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HSSEOrganizeMenuId);
|
|||
|
if (buttonList.Count() > 0)
|
|||
|
{
|
|||
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|||
|
{
|
|||
|
|
|||
|
if (isBelongUnitAndProject(ucTree.UnitId, ucTree.ProjectId))
|
|||
|
{
|
|||
|
btnSave.Hidden = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/*if ((string.IsNullOrEmpty(this.CurrUser.LoginProjectId) && !string.IsNullOrEmpty(this.ProjectId)) || !string.IsNullOrEmpty(this.ucTree.UnitId))
|
|||
|
{
|
|||
|
this.btnSave.Hidden = true;
|
|||
|
var units = BLL.CommonService.GetIsThisUnit();
|
|||
|
if (this.ucTree.UnitId == units.UnitId)
|
|||
|
{
|
|||
|
this.btnSave.Hidden = false;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
string menuId = !string.IsNullOrEmpty(this.CurrUser.LoginProjectId) ? Const.HSSEOrganizeMenuId : Const.HSSEOrganizeMenuId;
|
|||
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId);
|
|||
|
if (buttonList.Count() > 0)
|
|||
|
{
|
|||
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|||
|
{
|
|||
|
this.btnSave.Hidden = false;
|
|||
|
}
|
|||
|
}*/
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存按钮事件
|
|||
|
/// </summary>
|
|||
|
/// <param name="isClose"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(ucTree.UnitId))
|
|||
|
{
|
|||
|
|
|||
|
var organize = BLL.HSSEOrganizeService.GetHSSEOrganizeByUnitIdAndProjectId(ucTree.UnitId, this.ProjectId);
|
|||
|
if (organize != null)
|
|||
|
{
|
|||
|
organize.SeeFile = HttpUtility.HtmlEncode(this.txtSeeFile.Text);
|
|||
|
organize.UnitId = ucTree.UnitId;
|
|||
|
organize.ProjectId = ucTree.ProjectId;
|
|||
|
BLL.HSSEOrganizeService.UpdateHSSEOrganize(organize);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, null, organize.HSSEOrganizeId, BLL.Const.HSSEOrganizeMenuId, BLL.Const.BtnAdd);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Model.HSSESystem_HSSEOrganize neworganize = new Model.HSSESystem_HSSEOrganize();
|
|||
|
neworganize.HSSEOrganizeId = SQLHelper.GetNewID(typeof(Model.HSSESystem_HSSEOrganize));
|
|||
|
neworganize.SeeFile = HttpUtility.HtmlEncode(this.txtSeeFile.Text);
|
|||
|
neworganize.UnitId = ucTree.UnitId;
|
|||
|
neworganize.ProjectId = ucTree.ProjectId;
|
|||
|
BLL.HSSEOrganizeService.AddHSSEOrganize(neworganize);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, null, neworganize.HSSEOrganizeId, BLL.Const.HSSEOrganizeMenuId, BLL.Const.BtnModify);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
//this.UpHSSEOrganize(organize);
|
|||
|
ShowNotify("数据保存成功!", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ShowNotify("请先选择单位!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 组织体系上报到集团单位
|
|||
|
/// <summary>
|
|||
|
/// 上报方法
|
|||
|
/// </summary>
|
|||
|
/// <param name="lawRegulation"></param>
|
|||
|
public void UpHSSEOrganize(Model.HSSESystem_HSSEOrganize organize)
|
|||
|
{ /////创建客户端服务
|
|||
|
//var poxy = Web.ServiceProxy.CreateServiceClient();
|
|||
|
//poxy.DataInsertHSSESystem_HSSEOrganizeTableCompleted += new EventHandler<HSSEService.DataInsertHSSESystem_HSSEOrganizeTableCompletedEventArgs>(poxy_DataInsertHSSESystem_HSSEOrganizeTableCompleted);
|
|||
|
//var newOrganize = new HSSEService.HSSESystem_HSSEOrganize
|
|||
|
//{
|
|||
|
// UnitId = organize.UnitId,
|
|||
|
// SeeFile = organize.SeeFile
|
|||
|
//};
|
|||
|
//poxy.DataInsertHSSESystem_HSSEOrganizeTableAsync(newOrganize);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 组织体系上报到集团单位
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
//private void poxy_DataInsertHSSESystem_HSSEOrganizeTableCompleted(object sender, HSSEService.DataInsertHSSESystem_HSSEOrganizeTableCompletedEventArgs e)
|
|||
|
//{
|
|||
|
// if (e.Error == null)
|
|||
|
// {
|
|||
|
// ShowNotify("【安全体系】上报成功!", MessageBoxIcon.Success);
|
|||
|
// BLL.LogService.AddSys_Log(this.CurrUser, "【安全体系】上传到服务器1条数据;", null, BLL.Const.HSSEOrganizeMenuId, BLL.Const.BtnUploadResources);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// ShowNotify("【安全体系】上报失败!", MessageBoxIcon.Error);
|
|||
|
// BLL.LogService.AddSys_Log(this.CurrUser, "【安全体系】上传到服务器失败;", null, BLL.Const.HSSEOrganizeMenuId, BLL.Const.BtnUploadResources);
|
|||
|
// }
|
|||
|
//}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|