2025-03-27 15:05:14 +08:00

126 lines
4.9 KiB
C#

using SuperMap.RealEstate.Utility;
using SuperMap.RealEstate.Web.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace SuperMap.RealEstate.Personnel.Modules.Personnelfiles
{
public partial class PERSONNELFILESPage : SuperMap.RealEstate.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//载入数据
ButtonDelete.Enabled = PERSONNELFILES1.LoadData();
//设置删除提示
SetControlConfirm(ButtonDelete, "您确认删除该记录,删除后将无法恢复数据?");
//设置按钮状态
SetControlClientAction(ButtonDelete, false, true, true);
SetControlClientAction(ButtonSave);
//注册遮罩式窗口关闭脚本
//SetControlClosePopDialog(ButtonClose);
InitWebControlState();
}
protected void ButtonSave_Click(object sender, EventArgs e)
{
try
{
//刷新类型
bool _RefreshType = ButtonDelete.Enabled;
//保存数据
ButtonDelete.Enabled = PERSONNELFILES1.Save();
//刷新弹出页列表
RefreshOpenerGridPage(_RefreshType ? RefreshGridPageType.Update : RefreshGridPageType.Insert);
InitWebControlState();
//提示信息
Alert("保存成功!", 3);
//ClosePopDialog();
}
catch (Exception ex)
{
//回滚事务
Transaction.Rollback();
//记录日志
ErrorLogHelper.Write(ex);
#if DEBUG
Alert("保存失败!可能的原因:\n" + ex.Message);
#else
Alert("保存失败!");
#endif
}
}
protected void ButtonDelete_Click(object sender, EventArgs e)
{
try
{
//删除数据
ButtonDelete.Enabled = !PERSONNELFILES1.Delete();
//刷新弹出页列表
RefreshOpenerGridPage(RefreshGridPageType.Delete);
//提示信息
Alert("删除成功!", 3);
ClosePopDialog();
}
catch (Exception ex)
{
//回滚事务
Transaction.Rollback();
//记录日志
ErrorLogHelper.Write(ex);
#if DEBUG
Alert("删除失败!可能的原因:\n" + ex.Message);
#else
Alert("删除失败!");
#endif
}
}
#region ->
protected void ButtonClose_Click(object sender, EventArgs e)
{
ClosePopDialog("PERSONNELFILESPopDialog");
}
#endregion
private void InitWebControlState()
{
if (PERSONNELFILES1.CurrObject.PERSONNELFILES_ID == null || PERSONNELFILES1.CurrObject.PERSONNELFILES_ID == 0)
{
Button_File.OnClientClick = GetAlertStr("请先保存对应的档案信息");
Button_Recipient.OnClientClick = GetAlertStr("请先保存对应的档案信息");
Button_Filesinfo.OnClientClick = GetAlertStr("请先保存对应的档案信息");
Button_Print.OnClientClick = GetAlertStr("请先保存对应的档案信息");
return;
}
else
{
Button_File.OnClientClick =
this.GetOpenPopDialogClientScript("Attachment/ATTACHMENTPage_Personnelfiles.aspx?RELATION_ID=" +
PERSONNELFILES1.CurrObject.PERSONNELFILES_ID_Encrypt + "&STAFF_ID=" + PERSONNELFILES1.CurrObject.STAFF_ID.ToEncrypt(),
"ATTACHMENTPage_PersonnelfilesPopDialog", 600, 400);
Button_Recipient.OnClientClick =
this.GetOpenPopDialogClientScript("STAFFTree_Recipient.aspx?PERSONNELFILES_ID=" +
PERSONNELFILES1.CurrObject.PERSONNELFILES_ID_Encrypt, "STAFFTree_RecipientPopDialog", 800, 600);
Button_Filesinfo.OnClientClick =
this.GetOpenPopDialogClientScript("FILESINFOTree_Recipient.aspx?PERSONNELFILES_ID=" +
PERSONNELFILES1.CurrObject.PERSONNELFILES_ID_Encrypt + "&STAFF_ID=" + PERSONNELFILES1.CurrObject.STAFF_ID.ToEncrypt(),
"FILESINFOTree_RecipientPopDialog", 800, 600);
Button_Print.OnClientClick =
this.GetOpenPopDialogClientScript("Print/PERSONNELFILESPrint.aspx?RELATION_ID=" +
PERSONNELFILES1.CurrObject.PERSONNELFILES_ID_Encrypt + "&STAFF_ID=" + PERSONNELFILES1.CurrObject.STAFF_ID.ToEncrypt(),
"FILESINFOTree_RecipientPopDialog", 1000, 800);
}
}
}
}