using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.Model;
|
using CY.BLL;
|
using CY.Infrastructure.Common;
|
using CY.BLL.Sys;
|
using CY.BLL.EC;
|
using CY.Infrastructure.DESEncrypt;
|
|
namespace CY.WebForm.Pages.personnel
|
{
|
//吴辉
|
//员工详情
|
public partial class DepartmentEdit : BasePage
|
{
|
OA_DepartmentBll departmentBll = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
|
//初始化
|
public DepartmentEdit()
|
{
|
departmentBll = new OA_DepartmentBll();
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
}
|
|
//页面加载
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
InitData();
|
}
|
}
|
|
//数据加载
|
public void InitData()
|
{
|
this.txtName.Focus();
|
OA_Department m_OA_Department = departmentBll.GetModelByKeyid(Request["keyid"].ToInt32());
|
this.selStatus.DataSource = bll_Sys_DictionaryBLL.GetDataByType("部门状态");
|
this.selStatus.DataTextField = "Name";
|
this.selStatus.DataValueField = "Name";
|
this.DataBind();
|
if (m_OA_Department != null)
|
{
|
this.txtName.Value = m_OA_Department.Name.ToString2();
|
this.selStatus.Value = m_OA_Department.Status.ToString2();
|
this.txtRemarks.Value = m_OA_Department.Remark.ToString2();
|
}
|
}
|
|
//提交事件
|
protected void btn_submit_form(object sender, EventArgs e)
|
{
|
try
|
{
|
DateTime nowTime = DateTime.Now;
|
OA_Department m_OA_Department = departmentBll.GetModelByKeyid(Request["keyid"].ToInt32());
|
if (m_OA_Department == null)
|
{
|
m_OA_Department = new OA_Department();
|
}
|
m_OA_Department.FirmId = CurrentUser.MemberId;
|
m_OA_Department.Name = this.txtName.Value.ToString2();
|
m_OA_Department.Operator = CurrentUser.ShortName;
|
m_OA_Department.LastUpdateTime = nowTime;
|
m_OA_Department.Remark = this.txtRemarks.Value;
|
m_OA_Department.Status = this.selStatus.Value;
|
|
if (Request["keyid"].ToInt32() > 0)
|
{
|
if (departmentBll.UpdateModel(m_OA_Department))
|
JavaScript.MessageBox("操作成功", this, "top.frmright.ReLoad();top.Dialog.close();");
|
else
|
JavaScript.MessageBox("操作失败", this);
|
}
|
else
|
{
|
if (departmentBll.InsertModel(m_OA_Department))
|
{
|
this.txtName.Value = "";
|
this.txtRemarks.Value = "";
|
JavaScript.MessageBox("操作成功", this, false, true);
|
}
|
else
|
{
|
JavaScript.MessageBox("新增失败", this);
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
PAGEHandleException(ex);
|
JavaScript.MessageBox("更新失败", this);
|
}
|
|
}
|
}
|
}
|