191 lines
7.4 KiB
C#
191 lines
7.4 KiB
C#
using SuperMap.RealEstate.Web.UI;
|
||
using SuperMap.RealEstate.Web.UI.WebControls;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using HWSB = SuperMap.RealEstate.HighWay.Storage.Business;
|
||
|
||
namespace SuperMap.RealEstate.HighWay.Common
|
||
{
|
||
public partial class IMAGE : UserControl<HWSB.IMAGE>
|
||
{
|
||
string _TABLE_NAME = "HIGHWAY_STORAGE.T_METERBILL";
|
||
DateTime _StartDate = DateTime.MinValue;
|
||
DateTime _EndDate = DateTime.MinValue;
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (IsPostBack)
|
||
return;
|
||
|
||
if (!string.IsNullOrEmpty(Request["TABLE_NAME"]))
|
||
{
|
||
_TABLE_NAME = Request["TABLE_NAME"].ToDecrypt();
|
||
if (_TABLE_NAME == "HIGHWAY_STORAGE.T_METERBILL")
|
||
{
|
||
DateTime.TryParse(Request["startDate"], out _StartDate);
|
||
DateTime.TryParse(Request["EndDate"], out _EndDate);
|
||
}
|
||
}
|
||
|
||
BindTreeView();
|
||
}
|
||
|
||
//在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等
|
||
public override void InitializeWebControl()
|
||
{
|
||
//是否有效
|
||
//ISVALID.Clear();
|
||
//DictionaryHelper.BindingDropDownList("ISVALID", ISVALID.Items, this.Transaction);
|
||
}
|
||
|
||
#region BindTreeView()
|
||
public void BindTreeView()
|
||
{
|
||
DataTable _DataTable = null;
|
||
MyTreeView.Nodes.Clear();
|
||
int RowCount = 0;
|
||
//获得图片信息
|
||
string sqlWhere = "where TABLE_NAME = '" + _TABLE_NAME + "' AND TABLE_ID = " + Request["TABLE_ID"].ToDecrypt();
|
||
if (_StartDate != DateTime.MinValue && _EndDate != DateTime.MinValue && _TABLE_NAME == "HIGHWAY_STORAGE.T_METERBILL")
|
||
{
|
||
sqlWhere = "WHERE TABLE_NAME = '" + _TABLE_NAME + "' AND TABLE_ID IN (SELECT METERBILL_ID " +
|
||
"FROM HIGHWAY_STORAGE.T_METERBILL WHERE METERBILL_STATE = 2000 AND END_DATE > TO_DATE('" +
|
||
_StartDate.ToShortDateString() + "','YYYY/MM/DD') AND END_DATE < TO_DATE('" +
|
||
_EndDate.ToShortDateString() + "','YYYY/MM/DD')+1 AND SERVERPART_ID = " +
|
||
Request["SERVERPART_ID"] + " AND METERBILL_TYPE = " + Request["METERBILL_TYPE"] + " )";
|
||
|
||
_DataTable = new HWSB.SERVERPART(Transaction).ExecuteDataTable(
|
||
string.Format(@"SELECT A.METERBILL_ID,A.MOUTH
|
||
FROM
|
||
HIGHWAY_STORAGE.T_METERBILL A,HIGHWAY_STORAGE.T_METERDETAIL B
|
||
WHERE
|
||
A.METERBILL_ID = B.METERBILL_ID AND A.METERBILL_STATE = 2000 AND A.END_DATE >
|
||
TO_DATE('{0}','YYYY/MM/DD') AND A.END_DATE < TO_DATE('{1}','YYYY/MM/DD')+1
|
||
AND A.SERVERPART_ID = {2} AND A.METERBILL_TYPE = {3} AND B.SERVERPARTSHOP_ID IN ({4})",
|
||
_StartDate.ToShortDateString(), _EndDate.ToShortDateString(), Request["SERVERPART_ID"],
|
||
Request["METERBILL_TYPE"], Request["SERVERPARTSHOP_ID"]));
|
||
}
|
||
if (!string.IsNullOrEmpty(Request["IMAGE_TYPE"]))
|
||
{
|
||
sqlWhere += " AND IMAGE_TYPE =" + Request["IMAGE_TYPE"];
|
||
}
|
||
foreach (HWSB.IMAGE _IMAGE in (new HWSB.IMAGE(this.Transaction)).FillCollection(sqlWhere))
|
||
{
|
||
RowCount++;
|
||
TreeNode _TreeNode = new TreeNode();
|
||
_TreeNode.NavigateUrl = null;
|
||
_TreeNode.Text = "[" + RowCount.ToString() + "] " + _IMAGE.IMAGE_TITLE;
|
||
_TreeNode.Value = _IMAGE.Image_ID_Encrypt;
|
||
if (_DataTable != null)
|
||
{
|
||
DataRow[] _Rows = _DataTable.Select("METERBILL_ID = '" + _IMAGE.Table_ID + "'");
|
||
if (_Rows.Length > 0)
|
||
{
|
||
_TreeNode.Text = _Rows[0]["MOUTH"] + "月";
|
||
MyTreeView.Nodes.Add(_TreeNode);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
MyTreeView.Nodes.Add(_TreeNode);
|
||
}
|
||
}
|
||
MyTreeView.ExpandAll();
|
||
}
|
||
#endregion
|
||
|
||
//载入数据
|
||
public override bool LoadData()
|
||
{
|
||
if (!string.IsNullOrEmpty(Request["TABLE_NAME"]))
|
||
{
|
||
_TABLE_NAME = Request["TABLE_NAME"].ToDecrypt();
|
||
}
|
||
|
||
//初始化并加载列表
|
||
//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<HWSB.IMAGE> e)
|
||
{
|
||
|
||
|
||
base.OnDataAction_BeforeSave(e);
|
||
}
|
||
|
||
public override void OnDataAction_AfterSave(DataActionEventArgs<HWSB.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;
|
||
}
|
||
|
||
public override void OnDataAction_AfterDelete(DataActionEventArgs<HWSB.IMAGE> e)
|
||
{
|
||
base.OnDataAction_AfterDelete(e);
|
||
}
|
||
protected void BtnAdd_Click(object sender, EventArgs e)
|
||
{
|
||
IMAGE_ID.Text = "";
|
||
//IMAGE_DESC.Text = "";
|
||
TABLE_NAME.Text = _TABLE_NAME;
|
||
TABLE_ID.Text = Request["TABLE_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()");
|
||
}
|
||
}
|
||
} |