188 lines
7.1 KiB
C#
188 lines
7.1 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 Business = SuperMap.RealEstate.Coop.Merchant.Business;
|
||
using MSPB = SuperMap.RealEstate.MobileServicePlatform.Business;
|
||
|
||
namespace Coop.Merchant.CommonPage
|
||
{
|
||
public partial class IMAGE : UserControl<Business.IMAGE>
|
||
{
|
||
string _TABLE_NAME = "MOBILESERVICE_PLATFORM.T_SERVERPARTSHOP";
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(Request["TABLE_NAME"]))
|
||
{
|
||
_TABLE_NAME = Request["TABLE_NAME"].ToDecrypt();
|
||
}
|
||
|
||
if (IsPostBack)
|
||
return;
|
||
|
||
BindTreeView();
|
||
|
||
if (!string.IsNullOrEmpty(Request["IMG_ID"]))
|
||
{
|
||
CurrObject.IMAGE_ID_Encrypt = Request["IMG_ID"];
|
||
this.Select();
|
||
Page.ExecClientScript("BindImg()");
|
||
}
|
||
}
|
||
|
||
//在此加入界面的数据初始化(Page_Load之前),如DropDownList的数据源绑定等
|
||
public override void InitializeWebControl()
|
||
{
|
||
//是否有效
|
||
//ISVALID.Clear();
|
||
//DictionaryHelper.BindingDropDownList("ISVALID", ISVALID.Items, this.Transaction);
|
||
}
|
||
|
||
#region BindTreeView()
|
||
public void BindTreeView()
|
||
{
|
||
MyTreeView.Nodes.Clear();
|
||
int RowCount = 0;
|
||
//获得图片信息
|
||
string sqlWhere = "where TABLE_NAME = '" + _TABLE_NAME + "' AND TABLE_ID = " + Request["TABLE_ID"].ToDecrypt();
|
||
if (!string.IsNullOrEmpty(Request["IMAGE_TYPE"]))
|
||
{
|
||
sqlWhere += " AND NVL(IMAGE_TYPE,1000) =" + Request["IMAGE_TYPE"];
|
||
}
|
||
foreach (Business.IMAGE _IMAGE in (new Business.IMAGE(this.Transaction)).FillCollection(sqlWhere+ " order by IMAGE_INDEX,image_date desc"))
|
||
{
|
||
RowCount++;
|
||
TreeNode _TreeNode = new TreeNode();
|
||
_TreeNode.NavigateUrl = null;
|
||
_TreeNode.Text = "[" + RowCount.ToString() + "] " + _IMAGE.IMAGE_TITLE;
|
||
_TreeNode.Value = _IMAGE.IMAGE_ID_Encrypt;
|
||
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<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;
|
||
}
|
||
|
||
public override void OnDataAction_AfterDelete(DataActionEventArgs<Business.IMAGE> e)
|
||
{
|
||
|
||
//删除后
|
||
string otherShopId = "";
|
||
if (_TABLE_NAME == "MOBILESERVICE_PLATFORM.T_SERVERPARTSHOP")
|
||
{
|
||
string serverPartId = Request["SERVERPARTID"].ToDecrypt();
|
||
string provinceCode = Request["PROVINCECODE"].ToDecrypt();
|
||
string shopShortName = Request["SHOPSHORTNAME"].ToDecrypt();
|
||
string shopId = Request["SHOPID"].ToDecrypt();
|
||
string sql = string.Format(@"SELECT SERVERPARTSHOP_ID FROM MOBILESERVICE_PLATFORM.T_SERVERPARTSHOP
|
||
WHERE SERVERPART_ID = {0} AND PROVINCE_CODE='{1}' AND SHOPSHORTNAME='{2}' AND
|
||
SERVERPARTSHOP_ID<> {3}", serverPartId, provinceCode, shopShortName, shopId);
|
||
MSPB.SERVERPARTSHOP _SERVERPARTSHOP = new MSPB.SERVERPARTSHOP(this.Transaction);
|
||
DataTable dt = _SERVERPARTSHOP.ExecuteDataTable(sql);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
otherShopId = provinceCode + dt.Rows[0]["SERVERPARTSHOP_ID"].ToString();
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(otherShopId))
|
||
{
|
||
string sql = string.Format(@"DELETE COOP_MERCHANT.T_IMAGE WHERE TABLE_ID ={0} AND
|
||
TABLE_NAME = '{1}' AND IMAGE_TYPE={2} AND IMAGE_PATH = '{3}'",
|
||
otherShopId, _TABLE_NAME, Request["IMAGE_TYPE"], IMAGE_PATH.Text);
|
||
Business.IMAGE _IMAGE = new Business.IMAGE(this.Transaction);
|
||
_IMAGE.ExecuteNonQuery(sql, null);
|
||
}
|
||
|
||
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()");
|
||
}
|
||
}
|
||
} |