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

241 lines
9.0 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 Business = SuperMap.RealEstate.HighWay.Storage.Business;
using System.IO;
namespace SuperMap.RealEstate.HighWay.Compents.ExpenseBill
{
/// <summary>
/// T_IMAGE_图片表 的WebUserControl
/// <summary>
public partial class IMAGE : UserControl<Business.IMAGE>
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
BindTreeView();
}
//在此加入界面的数据初始化(Page_Load之前)如DropDownList的数据源绑定等
public override void InitializeWebControl()
{
//是否有效
ISVALID.Clear();
DictionaryHelper.BindingDropDownList("ISVALID", ISVALID.Items, this.Transaction);
}
#region BindTreeView()
public void BindTreeView()
{
MyTreeView.Nodes.Clear();
string PartString = string.Empty;
string ProwerString = string.Empty;
int i = 0;
if (!string.IsNullOrEmpty(Request["EXPENSEBILL_ID"]))
{
//获得图片信息
foreach (Storage.Business.IMAGE _IMAGE in (new Storage.Business.IMAGE(this.Transaction)).FillCollection(
"where TABLE_NAME = 'T_EXPENSEBILL' AND TABLE_ID = " + Request["EXPENSEBILL_ID"].ToDecrypt()))
{
TreeNode _TreeNode = new TreeNode();
i++;
_TreeNode.NavigateUrl = null;
_TreeNode.Text = "[" + i.ToString() + "]&nbsp;&nbsp;" + _IMAGE.IMAGE_TITLE;
_TreeNode.Value = _IMAGE.Image_ID_Encrypt;
MyTreeView.Nodes.Add(_TreeNode);
}
}
else if (!string.IsNullOrEmpty(Request["FUNDAPPLY_ID"]))
{
//获得图片信息
foreach (Storage.Business.IMAGE _IMAGE in (new Storage.Business.IMAGE(this.Transaction)).FillCollection(
"where TABLE_NAME = 'T_FUNDAPPLY' AND TABLE_ID = " + Request["FUNDAPPLY_ID"].ToDecrypt()))
{
TreeNode _TreeNode = new TreeNode();
i++;
_TreeNode.NavigateUrl = null;
_TreeNode.Text = "[" + i.ToString() + "]&nbsp;&nbsp;" + _IMAGE.IMAGE_TITLE;
_TreeNode.Value = _IMAGE.Image_ID_Encrypt;
MyTreeView.Nodes.Add(_TreeNode);
}
}
MyTreeView.ExpandAll();
}
#endregion
//载入数据
public override bool LoadData()
{
//初始化并加载列表
//GridViewEx1.SelectingWithInit<Business.IMAGE>(ObjectDataSource1, GridPageEx1,
// DictionaryHelper.GetDictionary(Transaction, "ISVALID"));
////设置回车焦点按钮
//Page.SetControlClientAction(ButtonSearch);
//如果是工作流组件请自行修改载入的逻辑,以下是功能模块的默认代码
if (!String.IsNullOrEmpty(Request["ID"]))
{
CurrObject.Image_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.IMAGE> e)
{
base.OnDataAction_BeforeSave(e);
}
public override void OnDataAction_AfterSave(DataActionEventArgs<Business.IMAGE> e)
{
//绑定列表
base.OnDataAction_AfterSave(e);
BindTreeView();
}
public override bool Save(bool AutoBindData = true)
{
//判断是否有
bool FLAG = base.Save(AutoBindData);
//初始化并加载列表
//GridViewEx1.SelectingWithInit<Business.IMAGE>(ObjectDataSource1, GridPageEx1,
// DictionaryHelper.GetDictionary(Transaction, "ISVALID"));
////设置回车焦点按钮
//Page.SetControlClientAction(ButtonSearch);
Image_ID.Text = "";
// IMAGE_DESC.Text = "";
return FLAG;
}
public override bool SaveEx(ClientSetEventArgs ClientSet)
{
return base.SaveEx(ClientSet);
}
public override bool Delete(bool AutoBindData = true)
{
bool Flag = base.Delete(AutoBindData);
BindTreeView();
return Flag;
}
/*#region 方法 -> 绑定列表
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
{
GridViewEx1.Selecting<Business.IMAGE>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
e.SetValue(GridPageEx1);
}
//翻页事件
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
{
GridViewEx1.Pagging<Business.IMAGE>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
}
//查询SQL设置
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
{
//搜索选项的搜索条件过滤
if (!string.IsNullOrEmpty(TextBox_Search.Text))
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
//且搜索条件
//e.AddAndParams(字段名, 值);
e.AddAndParams("TABLE_NAME", "T_EXPENSEBILL");
e.AddAndParams("TABLE_ID", Request["EXPENSEBILL_ID"].ToDecrypt());
//或搜索条件
//e.AddOrParams(字段名, 值);
//排序
e.AddOrderByParams(GridViewOrderBy1);
}
#endregion
#region 方法 -> 选择
protected void SelectButton_CallBackClick(object sender, ClientSetEventArgs e)
{
CallBackButton _button = (CallBackButton)sender;
GridViewRow _Row = (GridViewRow)_button.NamingContainer;
string _Image_ID = GridViewEx1.DataKeys[_Row.RowIndex][0].ToString();
Business.IMAGE _IMAGE = new Business.IMAGE(this.Transaction);
_IMAGE.Image_ID = int.Parse(_Image_ID);
if (_IMAGE.Select())
{
e.SetValue(Image_ID, _IMAGE.Image_ID.Value.ToString());
e.SetValue(IMAGE_PATH, _IMAGE.IMAGE_PATH);
e.SetValue(IMAGE_DESC, _IMAGE.IMAGE_DESC);
e.ExcuteClientScript("BindImg()");
}
}
#endregion
#region 方法 -> 删除
protected void DeleteButton_CallBackClick(object sender, ClientSetEventArgs e)
{
CallBackButton _button = (CallBackButton)sender;
GridViewRow _Row = (GridViewRow)_button.NamingContainer;
string _Image_ID = GridViewEx1.DataKeys[_Row.RowIndex][0].ToString();
Business.IMAGE _IMAGE = new Business.IMAGE(this.Transaction);
_IMAGE.Delete(int.Parse(_Image_ID));
e.SetValue(Image_ID, "");
e.SetValue(IMAGE_TITLE, "");
e.SetValue(IMAGE_DESC, "");
e.SetValue(Table_Name, "T_EXPENSEBILL");
e.SetValue(Table_ID, Request["EXPENSEBILL_ID"].ToDecrypt());
//刷新列表信息
//GridViewEx1.SelectingWithInit<Business.IMAGE>(ObjectDataSource1, GridPageEx1);
////设置UI变化
//e.SetValue(GridViewEx1);
//e.SetValue(GridPageEx1);
}
#endregion*/
protected void BtnAdd_Click(object sender, EventArgs e)
{
Image_ID.Text = "";
//IMAGE_DESC.Text = "";
if (!string.IsNullOrEmpty(Request["EXPENSEBILL_ID"]))
{
Table_Name.Text = "T_EXPENSEBILL";
Table_ID.Text = Request["EXPENSEBILL_ID"].ToDecrypt();
}
else if (!string.IsNullOrEmpty(Request["FUNDAPPLY_ID"]))
{
Table_Name.Text = "T_FUNDAPPLY";
Table_ID.Text = Request["FUNDAPPLY_ID"].ToDecrypt();
}
rotImg.Src = "";
}
protected void MyTreeView_SelectedNodeChanged(object sender, EventArgs e)
{
TreeView _TreeView = (TreeView)sender;
CurrObject.Image_ID_Encrypt = _TreeView.SelectedNode.Value;
this.Select();
Page.ExecClientScript("BindImg()");
}
}
}