using BLL; using System; using System.Linq; using System.Web.UI.WebControls; namespace FineUIPro.Web.ZHGL.HSSESystem { public partial class HSSEManageItemNewEdit : PageBase { public string HSSEManageItemId { get { return (string)ViewState["HSSEManageItemId"]; } set { ViewState["HSSEManageItemId"] = value; } } #region 项目主键 /// /// 项目主键 /// public string ProjectId { get { return (string)ViewState["ProjectId"]; } set { ViewState["ProjectId"] = value; } } public string Unitid { get { return (string)ViewState["Unitid"]; } set { ViewState["Unitid"] = value; } } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.GetButtonPower(); btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.Unitid = Request.Params["UnitId"]; this.ProjectId = Request.Params["ProjectId"]; this.HSSEManageItemId = Request.Params["HSSEManageItemId"]; if (!string.IsNullOrEmpty(this.HSSEManageItemId)) { var item = BLL.HSSEManageItemNewService.GetHSSEManageItemById(this.HSSEManageItemId); if (item != null) { this.txtPost.Text = item.Post; this.txtNames.Text = item.Names; this.txtTelephone.Text = item.Telephone; this.txtMobilePhone.Text = item.MobilePhone; this.txtEMail.Text = item.EMail; this.txtDuty.Text = item.Duty; this.txtSortIndex.Text = item.SortIndex; } } } } /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { Model.HSSESystem_HSSEManageItem_New newItem = new Model.HSSESystem_HSSEManageItem_New { Post = this.txtPost.Text.Trim(), ProjectId=ProjectId, UnitId=Unitid, Names = this.txtNames.Text.Trim(), Telephone = this.txtTelephone.Text.Trim(), MobilePhone = this.txtMobilePhone.Text.Trim(), EMail = this.txtEMail.Text.Trim(), Duty = this.txtDuty.Text.Trim(), SortIndex = this.txtSortIndex.Text.Trim() }; if (string.IsNullOrEmpty(this.HSSEManageItemId)) { //newItem.HSSEManageId = this.HSSEManageId; this.HSSEManageItemId = SQLHelper.GetNewID(typeof(Model.HSSESystem_HSSEManageItem)); newItem.HSSEManageItemId = this.HSSEManageItemId; BLL.HSSEManageItemNewService.AddHSSEManageItem(newItem); BLL.LogService.AddSys_Log(this.CurrUser, null, newItem.HSSEManageItemId, BLL.Const.HSSEManage_NewMenuId, BLL.Const.BtnAdd); } else { var i = BLL.HSSEManageItemNewService.GetHSSEManageItemById(this.HSSEManageItemId); if (i != null) { newItem.HSSEManageId = i.HSSEManageId; } newItem.HSSEManageItemId = this.HSSEManageItemId; BLL.HSSEManageItemNewService.UpdateHSSEManageItem(newItem); BLL.LogService.AddSys_Log(this.CurrUser, null, newItem.HSSEManageItemId, BLL.Const.HSSEManage_NewMenuId, BLL.Const.BtnModify); } /////更新集团组织机构 //this.UpHSSEManageList(this.HSSEManageId); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #region 获取按钮权限 /// /// 获取按钮权限 /// /// /// private void GetButtonPower() { var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HSSEManage_NewMenuId); if (buttonList.Count() > 0) { if (buttonList.Contains(BLL.Const.BtnSave)) { this.btnSave.Hidden = false; } } } #endregion } }