128 lines
4.3 KiB
C#
128 lines
4.3 KiB
C#
using BLL;
|
|
using System;
|
|
|
|
namespace FineUIPro.Web.Person
|
|
{
|
|
public partial class PersonTrainEdit : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 人员主键
|
|
/// </summary>
|
|
private string PersonId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["PersonId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["PersonId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
private string PersonTrainId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["PersonTrainId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["PersonTrainId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
this.PersonId = Request.Params["PersonId"];
|
|
this.PersonTrainId = Request.Params["PersonTrainId"];
|
|
|
|
TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true);
|
|
if (!string.IsNullOrEmpty(this.PersonTrainId))
|
|
{
|
|
var getData = BLL.Person_PersonTrainService.getDataById(this.PersonTrainId);
|
|
if (getData != null)
|
|
{
|
|
this.PersonId = getData.PersonId;
|
|
this.drpTrainType.SelectedValue = getData.TrainTypeId;
|
|
this.txtTrainDate.Text = string.Format("{0:yyyy-MM-dd}", getData.TrainDate);
|
|
this.txtTrainPlace.Text = getData.TrainPlace;
|
|
this.txtTrainResult.Text = getData.TrainResult;
|
|
}
|
|
}
|
|
|
|
var person = BLL.Person_PersonsService.GetPerson_PersonsById(this.PersonId);
|
|
if (person != null)
|
|
{
|
|
this.txtPersonName.Text = person.PersonName;
|
|
this.txtIdentityCard.Text = person.IdentityCard;
|
|
}
|
|
|
|
if (Request.Params["value"] == "0")
|
|
{
|
|
this.btnSave.Hidden = true;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
SaveData();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 保存数据
|
|
/// </summary>
|
|
private void SaveData()
|
|
{
|
|
if (!String.IsNullOrEmpty(this.PersonId))
|
|
{
|
|
Model.Person_PersonTrain newData = new Model.Person_PersonTrain
|
|
{
|
|
PersonId = this.PersonId,
|
|
PersonTrainId = this.PersonTrainId,
|
|
TrainDate = Funs.GetNewDateTime(this.txtTrainDate.Text.Trim()),
|
|
TrainPlace = this.txtTrainPlace.Text.Trim(),
|
|
TrainResult = this.txtTrainResult.Text.Trim(),
|
|
};
|
|
|
|
if (!string.IsNullOrEmpty(this.PersonTrainId))
|
|
{
|
|
BLL.Person_PersonTrainService.UpdateData(newData);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, this.txtPersonName.Text, newData.PersonTrainId, BLL.Const.DepartPersonMenuId, BLL.Const.BtnModify);
|
|
}
|
|
else
|
|
{
|
|
this.PersonTrainId = SQLHelper.GetNewID();
|
|
newData.PersonTrainId = this.PersonTrainId;
|
|
BLL.Person_PersonTrainService.AddData(newData);
|
|
BLL.LogService.AddSys_Log(this.CurrUser, this.txtPersonName.Text, newData.PersonTrainId, BLL.Const.DepartPersonMenuId, BLL.Const.BtnAdd);
|
|
}
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |