138 lines
5.1 KiB
C#
138 lines
5.1 KiB
C#
using SuperMap.RealEstate.ServiceModel;
|
|
using SuperMap.RealEstate.Utility;
|
|
using SuperMap.RealEstate.Web.UI;
|
|
using SuperMap.RealEstate.Web.UI.WebControls;
|
|
using System;
|
|
namespace SuperMap.RealEstate.Personnel.Modules.Staff
|
|
{
|
|
public partial class StaffPageGs : SuperMap.RealEstate.Web.UI.PageValid
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
tableId.Text = Request["ID"];
|
|
tableName.Text = "T_STAFF".ToEncrypt();
|
|
//载入数据
|
|
ButtonDelete.Enabled = Staff1.LoadData();
|
|
//设置删除提示
|
|
SetControlConfirm(ButtonDelete, "您确认删除该记录,删除后将无法恢复数据?");
|
|
//设置按钮状态
|
|
SetControlClientAction(ButtonDelete, false, true, true);
|
|
SetControlClientAction(ButtonSave);
|
|
//注册遮罩式窗口关闭脚本
|
|
SetControlClosePopDialog(ButtonClose);
|
|
if (string.IsNullOrEmpty(Request["ID"]))
|
|
{
|
|
BtnAdd.Visible = false;
|
|
Button_Print.Visible = false;
|
|
ButtonFile.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
BtnAdd.Visible = true;
|
|
Button_Print.Visible = true;
|
|
ButtonFile.Visible = true;
|
|
}
|
|
if (Staff1.CurrObject.AVATAR_ADDRESS == "")
|
|
{
|
|
TextBoxEx _TextBoxEx = Staff1.FindControl("AVATAR_ADDRESS") as TextBoxEx;
|
|
_TextBoxEx.Text = "img/photo_icon.png";
|
|
}
|
|
string _TableName = "T_STAFF";
|
|
Staff1.GridViewEx11.SetOpenControl(ButtonFile, "../Staff/Attachment/AttachmentPage.aspx?ID=" + Request["ID"]+"&NAME="+ _TableName.ToEncrypt());
|
|
ExecClientScript("BindImg()");
|
|
InitWebControlState();
|
|
if (!string.IsNullOrEmpty(Request["ReadOnly"]))
|
|
{
|
|
ButtonSave.Visible = false;
|
|
ButtonDelete.Visible = false;
|
|
ButtonFile.Visible = false;
|
|
BtnAdd.Visible = false;
|
|
Button_DataPrint.Visible = false;
|
|
}
|
|
}
|
|
|
|
protected void ButtonSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//刷新类型
|
|
bool _RefreshType = ButtonDelete.Enabled;
|
|
//保存数据
|
|
if (Staff1.Save())
|
|
{
|
|
ButtonDelete.Enabled = true;
|
|
Button_Print.Visible = true;
|
|
//刷新弹出页列表
|
|
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 = !Staff1.Delete();
|
|
//刷新弹出页列表
|
|
RefreshOpenerGridPage(RefreshGridPageType.Delete);
|
|
//提示信息
|
|
Alert("删除成功!", 3);
|
|
ClosePopDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//回滚事务
|
|
Transaction.Rollback();
|
|
//记录日志
|
|
ErrorLogHelper.Write(ex);
|
|
#if DEBUG
|
|
Alert("删除失败!可能的原因:\n" + ex.Message);
|
|
#else
|
|
Alert("删除失败!");
|
|
#endif
|
|
}
|
|
}
|
|
|
|
private void InitWebControlState()
|
|
{
|
|
if (Staff1.CurrObject.STAFF_ID == null || Staff1.CurrObject.STAFF_ID == 0)
|
|
{
|
|
Button_Print.OnClientClick = GetAlertStr("请先保存对应的档案信息");
|
|
BtnAdd.OnClientClick = GetAlertStr("请先保存对应的档案信息");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
Button_DataPrint.Visible = true;
|
|
Button_Print.Visible = true;
|
|
Button_DataPrint.OnClientClick =
|
|
this.GetOpenPopDialogClientScript("Print/StaffPrintInfoGs.aspx?ID=" + Request["ID"],
|
|
"ATTACHMENTPage_PrintPopDialog", 1000, 800);
|
|
Button_Print.OnClientClick =
|
|
this.GetOpenPopDialogClientScript("Print/StaffPrintGs.aspx?STAFF_ID=" + Staff1.CurrObject.STAFF_ID_Encrypt,
|
|
"ATTACHMENTPage_PrintPopDialog", 1000, 800);
|
|
BtnAdd.OnClientClick=
|
|
this.GetOpenPopDialogClientScript("ADDITIONALList.aspx?STAFF_ID=" + Staff1.CurrObject.STAFF_ID_Encrypt,
|
|
"ADDITIONALList", 600, 400);
|
|
}
|
|
}
|
|
}
|
|
} |