122 lines
4.4 KiB
C#
122 lines
4.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using SuperMap.RealEstate.CoreFrameWork;
|
|
using SuperMap.RealEstate.ServiceModel;
|
|
using SuperMap.RealEstate.Utility;
|
|
using SuperMap.RealEstate.Web.UI;
|
|
using SuperMap.RealEstate.Web.UI.WebControls;
|
|
using SuperMap.RealEstate.Web.Utility;
|
|
using MSB = SuperMap.RealEstate.MainTenance.Storage.Business;
|
|
using System.Data;
|
|
|
|
namespace SuperMap.RealEstate.MainTenance.Storage.Modules.Proinst
|
|
{
|
|
public partial class ProinstPage : SuperMap.RealEstate.Web.UI.PageValid
|
|
{
|
|
#region 加载事件
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
//载入数据
|
|
ButtonDelete.Enabled = PROINST1.LoadData();
|
|
//设置删除提示
|
|
SetControlConfirm(ButtonDelete, "您确认删除该记录,删除后将无法恢复数据?");
|
|
//设置按钮状态
|
|
SetControlClientAction(ButtonDelete, false, true, true);
|
|
SetControlClientAction(ButtonSave);
|
|
//注册遮罩式窗口关闭脚本
|
|
SetControlClosePopDialog(ButtonClose);
|
|
|
|
//判断业务状态,设置按钮样式
|
|
string PROINST_ID = Request["ID"].ToString().ToDecrypt();
|
|
MSB.PROINST _PROINST = new MSB.PROINST(Transaction);
|
|
if (PROINST_ID != "")
|
|
{
|
|
DataTable dt = _PROINST.ExecuteDataTable(
|
|
@"SELECT PROINST_STATE FROM MAINTENANCE_STORAGE.T_PROINST
|
|
WHERE PROINST_ID =" + PROINST_ID + "");
|
|
if (dt.Rows[0][0].ToString() == "9000")
|
|
{
|
|
ButtonDelete.Visible = false;
|
|
ButtonSave.Visible = false;
|
|
}
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 保存事件
|
|
protected void ButtonSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//判断传入的状态
|
|
string state = Request.QueryString["state"].ToString();
|
|
if (state == "1")
|
|
{
|
|
string UserName = this.PassportInfo.Name.ToString();
|
|
PROINST1.AssignMent(UserName);
|
|
}
|
|
//刷新类型
|
|
bool _RefreshType = ButtonDelete.Enabled;
|
|
//保存数据
|
|
ButtonDelete.Enabled = PROINST1.Save();
|
|
//刷新弹出页列表
|
|
RefreshOpenerGridPage(_RefreshType ? RefreshGridPageType.Update : RefreshGridPageType.Insert);
|
|
//刷新父页面
|
|
Alert("保存成功!");
|
|
ClientScript.RegisterStartupScript(
|
|
this.GetType(), "","<script language=javascript>this.parent.location.href=this.parent.location.href;</script>");
|
|
//ExecClientScript("$('#pop-dialog-frame-mask',parent.document).attr('src', " +
|
|
// "'/MainTenance/Modules/Proinst/ProinstList.aspx?" +
|
|
// "&PopDialogPageName=F_R_GridPageEx1&PopDialogName=mask&r=0.6476292717593188')");
|
|
//ClosePopDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//回滚事务
|
|
Transaction.Rollback();
|
|
//记录日志
|
|
ErrorLogHelper.Write(ex);
|
|
#if DEBUG
|
|
Alert("保存失败!可能的原因:\n" + ex.Message);
|
|
#else
|
|
Alert("保存失败!");
|
|
#endif
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除事件
|
|
protected void ButtonDelete_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//删除数据
|
|
ButtonDelete.Enabled = !PROINST1.Delete();
|
|
//刷新弹出页列表
|
|
RefreshOpenerGridPage(RefreshGridPageType.Delete);
|
|
//提示信息
|
|
Alert("删除成功!", 3);
|
|
ClosePopDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//回滚事务
|
|
Transaction.Rollback();
|
|
//记录日志
|
|
ErrorLogHelper.Write(ex);
|
|
#if DEBUG
|
|
Alert("删除失败!可能的原因:\n" + ex.Message);
|
|
#else
|
|
Alert("删除失败!");
|
|
#endif
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |