2025-03-27 15:05:14 +08:00

186 lines
7.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
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;
using CMB = SuperMap.RealEstate.Coop.Merchant.Business;
namespace SuperMap.RealEstate.HighWay.Running
{
/// <summary>
/// T_SUPPLYACCOUNT_补录账期信息 的WebUserControl
/// <summary>
public partial class SUPPLYACCOUNT : UserControl<Business.SUPPLYACCOUNT>
{
private string _HIGHWAYPROINST_ID
{
get
{
try
{
return Request["HIGHWAYPROINST_ID"].ToDecrypt();
}
catch
{
return "";
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//经营业态、经营品牌
BUSINESS_TRADE.Clear();
if (!string.IsNullOrEmpty(PROVINCE_CODE.Text))
{
CMB.AUTOSTATISTICS _AUTOSTATISTICS = new CMB.AUTOSTATISTICS(Transaction);
string _ProvinceCode = Storage.Business.CommonHelper.GetProvinceCode(Convert.ToInt32(PROVINCE_CODE.Text), Transaction);
_AUTOSTATISTICS.BindingDropDownList(BUSINESS_TRADE.Items, "2000", null, Convert.ToInt32(_ProvinceCode), "", "", true, true);
}
if (CurrObject.BUSINESS_TRADE != null)
{
BUSINESS_TRADE.SelectedValue = CurrObject.BUSINESS_TRADE.ToString();
}
if (!string.IsNullOrWhiteSpace(HIGHWAYPROINST_ID.Text) && !string.IsNullOrWhiteSpace(SUPPLYACCOUNT_ID.Text))
{
GridViewEx1.SelectingWithInit<Business.SUPPLYACCOUNT>(ObjectDataSource1, null);
}
if (GridViewEx1.Rows.Count > 0)
{
Historyfieldset.Visible = true;
}
else
{
Historyfieldset.Visible = false;
}
}
//在此加入界面的数据初始化(Page_Load之前)如DropDownList的数据源绑定等
public override void InitializeWebControl()
{
//经营业态
//BUSINESS_TRADE.Clear();
//DictionaryHelper.BindingDropDownList("BUSINESS_TRADE", BUSINESS_TRADE.Items, this.Transaction);
}
//载入数据
public override bool LoadData()
{
STAFF_ID.Text = Page.PassportInfo.ID.ToString();
STAFF_NAME.Text = Page.PassportInfo.Name;
OPERATE_DATE.Text = DateTime.Now.ToString();
HIGHWAYPROINST_ID.Text = _HIGHWAYPROINST_ID;
if (!string.IsNullOrWhiteSpace(_HIGHWAYPROINST_ID))
{
Running.Business.HIGHWAYPROINST _HIGHWAYPROINST = new Business.HIGHWAYPROINST(Transaction);
_HIGHWAYPROINST.HIGHWAYPROINST_ID_Encrypt = _HIGHWAYPROINST_ID.ToEncrypt();
if (_HIGHWAYPROINST.Select())
{
if (_HIGHWAYPROINST.__ProInst != null && _HIGHWAYPROINST.__ProInst.Division_Code != null)
{
Storage.Business.SERVERPART _SERVERPART = new Storage.Business.SERVERPART(Transaction);
_SERVERPART.AddSearchParameter("SERVERPART_CODE", _HIGHWAYPROINST.__ProInst.Division_Code_BaseValue);
if (_SERVERPART.Search())
{
PROVINCE_CODE.Text = _SERVERPART.PROVINCE_CODE.ToString();
SERVERPART_ID.Text = _SERVERPART.SERVERPART_ID.ToString();
SERVERPARTCODE.Text = _SERVERPART.SERVERPART_CODE;
SERVERPART_NAME.Text = _SERVERPART.SERVERPART_NAME;
}
}
}
}
//如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码
if (!String.IsNullOrEmpty(Request["ID"]))
{
CurrObject.SUPPLYACCOUNT_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.SUPPLYACCOUNT> e)
{
e.CurrObject.STAFF_ID = Page.PassportInfo.ID;
e.CurrObject.STAFF_NAME = Page.PassportInfo.Name;
e.CurrObject.OPERATE_DATE = DateTime.Now;
if (!string.IsNullOrWhiteSpace(BUSINESS_TRADE.SelectedValue))
{
e.CurrObject.BUSINESS_TRADENAME = BUSINESS_TRADE.SelectedItem.Text;
}
if (e.CurrObject.SUPPLYACCOUNT_ID != null)
{
Business.SUPPLYACCOUNT _SUPPLYACCOUNT = new Business.SUPPLYACCOUNT(CurrObject);
_SUPPLYACCOUNT.SUPPLYACCOUNT_ID = e.CurrObject.SUPPLYACCOUNT_ID;
if (_SUPPLYACCOUNT.Select() && _SUPPLYACCOUNT.STAFF_ID != Page.PassportInfo.ID)
{
History.Business.SUPPLYACCOUNT _HSUPPLYACCOUNT = new History.Business.SUPPLYACCOUNT(CurrObject);
_HSUPPLYACCOUNT.CopyFrom(_SUPPLYACCOUNT);
_HSUPPLYACCOUNT.Insert();
}
}
base.OnDataAction_BeforeSave(e);
}
#region ->
//查询
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
{
GridViewEx1.Selecting<Business.SUPPLYACCOUNT>(ObjectDataSource1, null);
//设置UI变化
e.SetValue(GridViewEx1);
//e.SetValue(GridPageEx1);
}
//翻页事件
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
{
GridViewEx1.Pagging<Business.SUPPLYACCOUNT>(ObjectDataSource1, null);
//设置UI变化
e.SetValue(GridViewEx1);
}
//查询SQL设置
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
{
//且搜索条件
e.AddAndParams("HIGHWAYPROINST_ID", HIGHWAYPROINST_ID.Text);
//经营业态
e.AddAndParams("SUPPLYACCOUNT_ID", SUPPLYACCOUNT_ID.Text);
//排序
e.AddOrderByParams("OPERATE_DATE", true);
}
#endregion
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (ListItemEx _ListItemEx in BUSINESS_TYPE.Items)
{
if (_ListItemEx.Value == e.Row.Cells[5].Text)
{
e.Row.Cells[5].Text = _ListItemEx.Text;
}
}
}
}
}
}