204 lines
8.0 KiB
C#
204 lines
8.0 KiB
C#
using System;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Collections.Generic;
|
||
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 HBusiness = SuperMap.RealEstate.HighWay.Storage.Business;
|
||
using Business = SuperMap.RealEstate.Finance.Storage.Business;
|
||
|
||
namespace SuperMap.RealEstate.Finance.Modules.FinanceBudget
|
||
{
|
||
/// <summary>
|
||
/// T_BUDGETPROJECT_预算项目表 的WebUserControl
|
||
/// <summary>
|
||
public partial class BUDGETPROJECT : UserControl<Business.BUDGETPROJECT>
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
HBusiness.AUTOTYPE _AUTOTYPE = new HBusiness.AUTOTYPE(Transaction);
|
||
if (!string.IsNullOrEmpty(BUDGETPROJECT_TYPE.SelectedValue))
|
||
{
|
||
_AUTOTYPE.AUTOTYPE_ID_Encrypt = BUDGETPROJECT_TYPE.SelectedValue.ToEncrypt();
|
||
if (_AUTOTYPE.Select())
|
||
{
|
||
switch (_AUTOTYPE.AUTOTYPE_CODE)
|
||
{
|
||
case "2000":
|
||
case "3000":
|
||
case "4000":
|
||
case "6000":
|
||
liBUDGETPROJECT.Attributes["style"] = "display:none;";
|
||
break;
|
||
default:
|
||
liBUDGETPROJECT.Attributes["style"] = "display:block;";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等
|
||
public override void InitializeWebControl()
|
||
{
|
||
ListItemEx _ListItemEx = new ListItemEx();
|
||
bool isShow = false;
|
||
SERVERPART_ID.Clear();
|
||
List<HBusiness.SERVERPART> _ListSERVERPART = (new HBusiness.SERVERPART(this.Transaction)).GetPassportServerPart(Page.PassportInfo.CityAuthority);
|
||
foreach (HBusiness.SERVERPART _SERVERPART in _ListSERVERPART)
|
||
{
|
||
_ListItemEx = new ListItemEx();
|
||
_ListItemEx.Text = _SERVERPART.SERVERPART_NAME;
|
||
_ListItemEx.Value = _SERVERPART.SERVERPART_ID.ToString();
|
||
if (_SERVERPART.SERVERPART_NAME.Contains("驿佳") || _SERVERPART.SERVERPART_NAME.Contains("华运"))
|
||
{
|
||
isShow = true;
|
||
_ListItemEx.Selected = true;
|
||
}
|
||
SERVERPART_ID.Items.Add(_ListItemEx);
|
||
}
|
||
//预算类型
|
||
BUDGETPROJECT_TYPE.Clear();
|
||
new HBusiness.AUTOTYPE(Transaction).BindingDropDownList(BUDGETPROJECT_TYPE.Items, 1000, "");
|
||
|
||
BUDGETPROJECT_TYPE.SelectedIndex = 1;
|
||
List<ListItemEx> _list = new List<ListItemEx>();
|
||
foreach (ListItemEx item in BUDGETPROJECT_TYPE.Items)
|
||
{
|
||
if (item.Text.Contains("]"))
|
||
item.Text = item.Text.Split("]")[1];
|
||
if (!isShow)
|
||
{
|
||
//SERVERPART_ID.Enabled = false;
|
||
if (item.Text.Contains("机关"))
|
||
{
|
||
_list.Add(item);
|
||
}
|
||
}
|
||
if (item.Text.Contains("预算总表"))
|
||
{
|
||
_list.Add(item);
|
||
}
|
||
}
|
||
for (int i = 0; i < _list.Count; i++)
|
||
{
|
||
BUDGETPROJECT_TYPE.Items.Remove(_list[i]);
|
||
}
|
||
|
||
BUDGETPROJECT_YEAR.Clear();
|
||
BUDGETPROJECT_YEAR.Items.Add(new ListItemEx(DateTime.Now.Year.ToString(), DateTime.Now.Year.ToString()));
|
||
BUDGETPROJECT_YEAR.Items.Add(new ListItemEx(DateTime.Now.AddYears(1).Year.ToString(),
|
||
DateTime.Now.AddYears(1).Year.ToString()));
|
||
}
|
||
|
||
//载入数据
|
||
public override bool LoadData()
|
||
{
|
||
if (DateTime.Now.Month > 6)
|
||
BUDGETPROJECT_YEAR.SelectedValue = DateTime.Now.AddYears(1).Year.ToString();
|
||
else
|
||
BUDGETPROJECT_YEAR.SelectedValue = DateTime.Now.Year.ToString();
|
||
BUDGETPROJECT_DATE.Text = DateTime.Now.ToString();
|
||
STAFF_ID.Text = Page.PassportInfo.ID.ToString();
|
||
STAFF_NAME.Text = Page.PassportInfo.Name;
|
||
|
||
|
||
//如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码
|
||
if (!String.IsNullOrEmpty(Request["ID"]))
|
||
{
|
||
CurrObject.BUDGETPROJECT_ID_Encrypt = Request["ID"];
|
||
return this.Select();
|
||
}
|
||
//默认返回值,工作流组件返回True,功能模块返回False。
|
||
return (WorkFlowPage != null);
|
||
}
|
||
|
||
//OnDataAction_XXXXX 有一个系列可用,在此加入界面的逻辑处理
|
||
//e.CancelDataAction 来处理是否取消该动作;
|
||
//失败的原因可以用Page.Alert()传递到页面
|
||
public override void OnDataAction_BeforeSave(DataActionEventArgs<Business.BUDGETPROJECT> e)
|
||
{
|
||
int a = SERVERPART_ID.SelectedIndex;
|
||
if (!string.IsNullOrEmpty(Request["BUDGETPROJECT_STATE"]) && Request["BUDGETPROJECT_STATE"] == "9999")
|
||
{
|
||
CurrObject.BUDGETPROJECT_STATE = 9999;
|
||
}
|
||
base.OnDataAction_BeforeSave(e);
|
||
}
|
||
|
||
#region 方法 -> 绑定审批信息
|
||
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
|
||
{
|
||
GridViewEx1.Selecting<HBusiness.BUDGETAPPROVE>(ObjectDataSource1, null);
|
||
//设置UI变化
|
||
e.SetValue(GridViewEx1);
|
||
}
|
||
|
||
//翻页事件
|
||
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
|
||
{
|
||
GridViewEx1.Pagging<HBusiness.BUDGETAPPROVE>(ObjectDataSource1, null);
|
||
//设置UI变化
|
||
e.SetValue(GridViewEx1);
|
||
}
|
||
|
||
//查询SQL设置
|
||
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
|
||
{
|
||
//搜索选项的搜索条件过滤
|
||
if (Request["ID"] != null)
|
||
{
|
||
e.AddAndParams("BUDGETPROJECT_ID", Request["ID"].ToDecrypt());
|
||
}
|
||
else
|
||
{
|
||
e.SetOtherUserCustomWhereSqlString = "1!=1";
|
||
}
|
||
e.AddOrderByParams("BUDGETAPPROVE_DATE", true);
|
||
}
|
||
|
||
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
|
||
{
|
||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||
{
|
||
if (e.Row.Cells[2].Text.Length > 20)
|
||
{
|
||
e.Row.ToolTip = e.Row.Cells[2].Text;
|
||
e.Row.Cells[2].Text = e.Row.Cells[2].Text.Substring(0, 20) + "...";
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
protected void BUDGETPROJECT_TYPE_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
HBusiness.AUTOTYPE _AUTOTYPE = new HBusiness.AUTOTYPE(Transaction);
|
||
_AUTOTYPE.AUTOTYPE_ID_Encrypt = BUDGETPROJECT_TYPE.SelectedValue.ToEncrypt();
|
||
if (_AUTOTYPE.Select())
|
||
{
|
||
switch (_AUTOTYPE.AUTOTYPE_CODE)
|
||
{
|
||
case "2000":
|
||
case "3000":
|
||
case "4000":
|
||
case "6000":
|
||
liBUDGETPROJECT.Attributes["style"] = "display:none;";
|
||
//SERVERPART_ID.Enabled = true;
|
||
break;
|
||
default:
|
||
liBUDGETPROJECT.Attributes["style"] = "display:block;";
|
||
//SERVERPART_ID.SelectedValue = "41";
|
||
//SERVERPART_ID.Enabled = false;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|