132 lines
5.8 KiB
C#
132 lines
5.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
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;
|
|
|
|
namespace SuperMap.RealEstate.Finance.Modules.FinanceBudget
|
|
{
|
|
public partial class BUDGETPROJECTPage : SuperMap.RealEstate.Web.UI.Page
|
|
{
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (IsPostBack) return;
|
|
//载入数据
|
|
ButtonDelete.Enabled = BUDGETPROJECT1.LoadData();
|
|
if (BUDGETPROJECT1.CurrObject.BUDGETPROJECT_ID == null)
|
|
{
|
|
BUDGETPROJECT1.FindControl("cssGroupBar_SP").Visible = false;
|
|
}
|
|
//设置删除提示
|
|
SetControlConfirm(ButtonDelete, "您确认删除该记录,删除后将无法恢复数据?");
|
|
//设置按钮状态
|
|
SetControlClientAction(ButtonDelete, false, true, true);
|
|
SetControlClientAction(ButtonSave);
|
|
//注册遮罩式窗口关闭脚本
|
|
SetControlClosePopDialog(ButtonClose);
|
|
if (Request["BUDGETPROJECT_STATE"] == "1000" || Request["BUDGETPROJECT_STATE"] == "9999")
|
|
{
|
|
ButtonSave.Visible = true;
|
|
ButtonDelete.Visible = true;
|
|
}
|
|
else if (string.IsNullOrEmpty(Request["BUDGETPROJECT_STATE"]))
|
|
{
|
|
ButtonSave.Visible = true;
|
|
}
|
|
}
|
|
|
|
protected void ButtonSave_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//刷新类型
|
|
bool _RefreshType = ButtonDelete.Enabled;
|
|
//保存数据
|
|
ButtonDelete.Enabled = BUDGETPROJECT1.Save();
|
|
//刷新弹出页列表
|
|
RefreshOpenerGridPage(_RefreshType ? RefreshGridPageType.Update : RefreshGridPageType.Insert);
|
|
|
|
//string _BUDGETPROJECT_ID = (BUDGETPROJECT1.FindControl("BUDGETPROJECT_ID") as TextBoxEx).Text;
|
|
//string _BUDGETPROJECT_CODE = (BUDGETPROJECT1.FindControl("BUDGETPROJECT_CODE") as TextBoxEx).Text;
|
|
//string _BUDGETPROJECT_TYPE = (BUDGETPROJECT1.FindControl("BUDGETPROJECT_TYPE") as DropDownListEx).SelectedValue;
|
|
//string _SERVERPART_ID = (BUDGETPROJECT1.FindControl("SERVERPART_ID") as DropDownListEx).SelectedValue;
|
|
//string sqlWhere = "WHERE BUDGETPROJECT_TYPE=" + _BUDGETPROJECT_TYPE +
|
|
// " AND SERVERPART_ID = " + _SERVERPART_ID + " AND BUDGETPROJECT_ID <> " + _BUDGETPROJECT_ID + " AND BUDGETPROJECT_CODE LIKE " +
|
|
// "'" + (Convert.ToInt32(_BUDGETPROJECT_CODE.Split('-')[0]) - 1).ToString() + "-" + _BUDGETPROJECT_CODE.Split('-')[1].ToString() + "-%'";
|
|
//foreach (Business.BUDGETPROJECT _BUDGETPROJECT in new Business.BUDGETPROJECT(Transaction).FillCollection(sqlWhere))
|
|
//{
|
|
// Business.SERVERPARTBUDGET _SERVERPARTBUDGET = new Business.SERVERPARTBUDGET(Transaction);
|
|
// _SERVERPARTBUDGET.AddSearchParameter("BUDGETPROJECT_ID", _BUDGETPROJECT_ID);
|
|
// if (!_SERVERPARTBUDGET.Search())
|
|
// {
|
|
// foreach (Business.SERVERPARTBUDGET _BUDGET in new Business.SERVERPARTBUDGET(Transaction).FillCollection(
|
|
// "WHERE BUDGETPROJECT_ID = " + _BUDGETPROJECT.BUDGETPROJECT_ID))
|
|
// {
|
|
// _SERVERPARTBUDGET.ResetProperty();
|
|
// _SERVERPARTBUDGET.AUTOTYPE_ID = _BUDGET.AUTOTYPE_ID;
|
|
// _SERVERPARTBUDGET.BUDGETPROJECT_ID = Convert.ToInt32(_BUDGETPROJECT_ID);
|
|
// _SERVERPARTBUDGET.LASTYEAR_RESULTS = _BUDGET.LASTYEAR_RESULTS;
|
|
// _SERVERPARTBUDGET.LASTYEAR_PREDICT = _BUDGET.LASTYEAR_PREDICT;
|
|
// _SERVERPARTBUDGET.LASTYEAR_BUDGETISSUE = _BUDGET.LASTYEAR_BUDGETISSUE;
|
|
// _SERVERPARTBUDGET.CURYEAR_BUDGET = _BUDGET.CURYEAR_BUDGET;
|
|
// _SERVERPARTBUDGET.YEARONYEAR = _BUDGET.YEARONYEAR;
|
|
// _SERVERPARTBUDGET.SERVERPARTBUDGET_DESC = _BUDGET.SERVERPARTBUDGET_DESC;
|
|
// _SERVERPARTBUDGET.Insert();
|
|
// }
|
|
// }
|
|
|
|
//}
|
|
//提示信息
|
|
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 = !BUDGETPROJECT1.Delete();
|
|
//刷新弹出页列表
|
|
RefreshOpenerGridPage(RefreshGridPageType.Delete);
|
|
//提示信息
|
|
Alert("删除成功!", 3);
|
|
ClosePopDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//回滚事务
|
|
Transaction.Rollback();
|
|
//记录日志
|
|
ErrorLogHelper.Write(ex);
|
|
#if DEBUG
|
|
Alert("删除失败!可能的原因:\n" + ex.Message);
|
|
#else
|
|
Alert("删除失败!");
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
}
|