using SuperMap.RealEstate.Utility; using SuperMap.RealEstate.Web.UI; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Business = SuperMap.RealEstate.Personnel.Storage.Business; using Historys = SuperMap.RealEstate.Personnel.History.Business; namespace SuperMap.RealEstate.Personnel.Modules.Position { public partial class POSITIONPage : SuperMap.RealEstate.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; //载入数据 ButtonDelete.Enabled = POSITION1.LoadData(); //设置删除提示 SetControlConfirm(ButtonDelete, "您确认删除该记录,删除后将无法恢复数据?"); //设置按钮状态 SetControlClientAction(ButtonDelete, false, true, true); SetControlClientAction(ButtonSave); //注册遮罩式窗口关闭脚本 SetControlClosePopDialog(ButtonClose); InitWebControlState(); //if (!string.IsNullOrEmpty(Request["ID"])) //{ // ButtonDelete.Visible = true; //} } protected void ButtonSave_Click(object sender, EventArgs e) { try { //刷新类型 bool _RefreshType = ButtonDelete.Enabled; //保存数据 ButtonDelete.Enabled = POSITION1.Save(); ButtonDelete.Visible = ButtonDelete.Enabled; //人事异动 Business.POSITION _POSITION = POSITION1.CurrObject; if (_POSITION == null) { throw new Exception("保存失败!可能的原因:\n 数据已失效。"); } #region 实际数据展示 if (Request["ISADD"] == null || (Request["ISADD"] != null && Request["ISADD"].ToString() != "false")) { switch (POSITION1.CurrObject.VARIANT_TYPE) { case 1: case 2: case 3: case 4: _POSITION.CURRENT_POSITION = POSITION1.CurrObject.QUASI_POST; //现任岗位为拟任职务 //_POSITION.QUASI_EXEMPT_DUTY = POSITION1.CurrObject.QUASI_POST; //拟免职务为现任岗位 _POSITION.QUASI_POST = null; //清空拟任职务 break; case 5: _POSITION.CURRENT_POSITION = null; //清空现任岗位 _POSITION.QUASI_POST = null; //清空拟任职务 break; case 6: _POSITION.QUASI_POST = null; //清空拟任职务 break; } POSITION1.BindObjectToControl(_POSITION); } #endregion //刷新弹出页列表 RefreshOpenerGridPage(_RefreshType ? RefreshGridPageType.Update : RefreshGridPageType.Insert); InitWebControlState(); ExecClientScript("$('#pop-dialog-frame-StaffPage',parent.parent.document).attr('src'," + "'/Personnel/Modules/Staff/StaffPage.aspx?ID=" + Request["STAFF_ID"] + "&PopDialogPageName=F_R_GridPageEx1&PopDialogName=StaffPage&r=0.0176470112473186')"); //提示信息 Alert("保存成功!", 3); } 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 = !POSITION1.Delete(); //刷新弹出页列表(更新人员信息操作) RefreshOpenerGridPage(RefreshGridPageType.Update); //提示信息 Alert("删除成功!", 3); ClosePopDialog("STAFF_Default"); } 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("STAFFPopDialog"); } #endregion private void InitWebControlState() { if (POSITION1.CurrObject.POSITION_ID == null || POSITION1.CurrObject.POSITION_ID == 0) { Button_File.OnClientClick = GetAlertStr("请先保存对应的任免信息"); Button_Edit.OnClientClick = GetAlertStr("请先保存对应的任免信息"); Button_Print.OnClientClick = GetAlertStr("请先保存对应的档案信息"); return; } else { Button_File.OnClientClick = this.GetOpenPopDialogClientScript("Attachment/ATTACHMENTList.aspx?RELATION_ID=" + POSITION1.CurrObject.POSITION_ID_Encrypt + "&STAFF_ID=" + POSITION1.CurrObject.STAFF_ID.ToEncrypt(), "ATTACHMENTPagePopDialog", 1000, 800); Button_Edit.OnClientClick = this.GetOpenPopDialogClientScript("Attachment/ATTACHMENTListBindUser.aspx?RELATION_ID=" + POSITION1.CurrObject.POSITION_ID_Encrypt + "&STAFF_ID=" + POSITION1.CurrObject.STAFF_ID.ToEncrypt(), "ATTACHMENTListBindUserPopDialog", 1000, 800); Button_Print.OnClientClick = this.GetOpenPopDialogClientScript("Print/POSITIONPrint.aspx?RELATION_ID=" + POSITION1.CurrObject.POSITION_ID_Encrypt + "&STAFF_ID=" + POSITION1.CurrObject.STAFF_ID.ToEncrypt(), "ATTACHMENTPage_PrintPopDialog", 1000, 800); } } } }