ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/common/BaseInfo/DepartEdit.aspx.cs

89 lines
3.4 KiB
C#

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
/// <summary>
/// 加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
}
}