using BLL; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.common.BaseInfo { public partial class DepartEdit : PageBase { #region 加载 /// /// 加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnClose.OnClientClick = ActiveWindow.GetHideReference(); string departId = Request.Params["departId"]; if (!string.IsNullOrEmpty(departId)) { var depart = BLL.Base_DepartService.GetDepart(departId); if (depart != null) { this.txtDepartCode.Text = depart.DepartCode; this.txtDepartName.Text = depart.DepartName; this.txtDepartHead.Text = depart.DepartHead; this.txtRemark.Text = depart.Remark; } } } } #endregion #region 保存 /// /// 提交按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.DepartMenuId, Const.BtnSave)) { string departId= Request.Params["departId"]; if (BLL.Base_DepartService.IsExistDepart(departId, this.txtDepartCode.Text.Trim(), this.txtDepartName.Text.Trim())) { Alert.ShowInParent("部门编号或名称已存在!"); return; } else { Model.Base_Depart depart = new Model.Base_Depart(); depart.DepartCode = this.txtDepartCode.Text.Trim(); depart.DepartName = this.txtDepartName.Text.Trim(); depart.DepartHead = this.txtDepartHead.Text.Trim(); depart.Remark = txtRemark.Text.Trim(); if (string.IsNullOrEmpty(departId)) { BLL.Base_DepartService.AddDepart(depart); BLL.Sys_LogService.AddLog(BLL.Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加部门信息"); ShowNotify("增加部门数据成功!(表格数据已重新绑定)"); } else { depart.DepartId = departId; BLL.Base_DepartService.UpdateDepart(depart); BLL.Sys_LogService.AddLog(BLL.Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改部门信息"); ShowNotify("修改部门数据成功!(表格数据已重新绑定)"); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } else { ShowNotify("您没有这个权限,请与管理员联系!"); } } #endregion } }