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

225 lines
9.7 KiB
C#

using System;
using System.Data;
using System.Linq;
using System.Web.UI.WebControls;
using SuperMap.RealEstate.CoreFrameWork;
using SuperMap.RealEstate.CoreFrameWork.Dictionary.Business;
using SuperMap.RealEstate.Enums;
using SuperMap.RealEstate.Web.Utility;
using SuperMap.RealEstate.Web.UI.WebControls;
using SuperMap.RealEstate.WorkFlow;
using Support = SuperMap.RealEstate.WorkFlow.Support.Business;
using Instance = SuperMap.RealEstate.WorkFlow.Instance.Business;
namespace SuperMap.RealEstate.HighWay.Compents.Mnangement
{
public partial class Default : SuperMap.RealEstate.Web.UI.PageModule
{
#region ->
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
BindDropDownList_SERVERPART();
#region
DataSet _DataSet = new DataSet();
if (Request["DataType"] == "List" && !string.IsNullOrEmpty(Request["Operation_Type"]))
{
Support.ProDefType _ProDefType = new Support.ProDefType(Transaction);
//获取所有的分类节点
DataTable _DataTableType = _ProDefType.FillDataTable("order by ProDefType_PID,ProDefType_Index,ProDefType_ID");
//按照权限来过滤节点
string _SQLStr = @"Select A.* From V_ListAccept A,PlatForm_Dictionary.V_FieldEnum B,PlatForm_Dictionary.T_FieldEnum C
Where A.User_ID = " + PassportInfo.ID + " And B.FieldExplain_Field = 'OPERATION_TYPE' And C.FieldEnum_Value = '" +
Request["Operation_Type"] + "' And A.Operation_Type = B.FieldEnum_Value And B.FieldEnum_Pid = C.FieldEnum_ID";
DataTable _DataTableUser = _ProDefType.ExecuteDataTable(_SQLStr);
_DataSet.Tables.Add(_DataTableType.Copy());
_DataSet.Tables.Add(_DataTableUser.Copy());
_DataSet.AcceptChanges();
}
else
{
if (!string.IsNullOrEmpty(Request["Operation_Type"]))
{
_DataSet = SupportHelper.GetAcceptDataSet(PassportInfo.ID.ToString(), Request["Operation_Type"].ToDecrypt(), Transaction);
}
else
{
_DataSet = SupportHelper.GetAcceptDataSet(PassportInfo.ID.ToString(), "-1", this.Transaction);
}
}
#endregion
//绑定业务流程树
if (_DataSet.Tables[1].Rows.Count == 1)
{
LayoutButtonAccept.Visible = false;
CallBackButtonAccept.Attributes["key"] = _DataSet.Tables[1].Rows[0]["ProDef_ID"].ToEncrypt() + "&Module_ID=" +
this.ModuleInfo.ID.Value.ToEncrypt() + NewMethod(_DataSet.Tables[1].Rows[0]["Enabled_Division"].ToString());
CallBackButtonAccept.OnClientClick = "return WorkFlowPlatform_Accept(event,this);";
}
else
{
LayoutButtonAccept.Visible = _DataSet.Tables[1].Rows.Count > 0;
CallBackButtonAccept.Visible = false;
TreeViewBinding("-1", MyTreeView.Nodes, _DataSet);
}
//所有城区权限时,不在显示
//Division_Code.Visible = PassportInfo.EnabledCityAuthority;
BindGridVew();
//设置回车焦点按钮
SetControlClientAction(ButtonSearch);
}
/// <summary>
/// 返回业务流程服务区编码
/// </summary>
/// <param name="Enabled_Division"></param>
/// <returns></returns>
private string NewMethod(string Enabled_Division)
{
if (Enabled_Division == "1")
{
return "&Enabled_Division=" + Division_Code.ClientID;
}
return "";
}
#region guid
protected override void OnInit(EventArgs e)
{
if (Request["Module_ID"] != null)
{
this.AddModule_Guid(Guid.Empty.ToString());
}
this.AddModule_Guid("45ca39de-5de5-465f-9718-969e16023711");
base.OnInit(e);
}
#endregion
#region
public void BindDropDownList_SERVERPART()
{
//绑定业务所在区域
Division_Code.Items.Clear();
Division_Code.Items.Add(new ListItemEx("全部", "-1"));
Division_Code.Items.Add(new ListItemEx("非区域流程", "0") { Level = 1 });
DictionaryHelper.BindingDivisionCode(PassportInfo, Division_Code.Items, this.Transaction);
}
#endregion
#region
string _NavigateElement = "<span key='{0}' onclick='return WorkFlowPlatform_Accept(event,this);' >&nbsp;{1}</span>";
private void TreeViewBinding(string pid, TreeNodeCollection Nodes, DataSet dataSet)
{
var pairCollection1 = from m in dataSet.Tables[0].Select("ProDefType_PID=" + pid)
select new TreeNode()
{
Text = "&nbsp;" + m["ProDefType_Name"].ToString(),
Value = m["ProDefType_ID"].ToString(),
NavigateUrl = "javascript:void(0);",
ImageUrl = TreeNodeImageUrl.BusinessSystem
};
foreach (var pair1 in pairCollection1)
{
TreeViewBinding(pair1.Value, pair1.ChildNodes, dataSet);
var pairCollection2 = from m in dataSet.Tables[1].Select("ProDefType_ID=" + pair1.Value)
select new TreeNode()
{
Text = string.Format(_NavigateElement, m["ProDef_ID"].ToEncrypt() +
"&Module_ID=" + this.ModuleInfo.ID.Value.ToEncrypt() +
NewMethod(m["Enabled_Division"].ToString()), m["ProDef_Name"].ToString()),
Value = m["ProDef_ID"].ToString(),
NavigateUrl = "javascript:void(0);",
ImageUrl = TreeNodeImageUrl.Module
};
foreach (var pair2 in pairCollection2)
{
pair1.ChildNodes.Add(pair2);
}
if (pair1.ChildNodes.Count > 0)
{
Nodes.Add(pair1);
}
}
}
#endregion
#endregion
#region ->
private void BindGridVew()
{
GridViewEx1.SelectingWithInit<Instance.NowActInst>(ObjectDataSource1, GridPageEx1);
}
#endregion
#region ->
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
{
GridViewEx1.Selecting<Instance.NowActInst>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
e.SetValue(GridPageEx1);
}
#endregion
#region ->
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
{
GridViewEx1.Pagging<Instance.NowActInst>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
}
#endregion
#region -> SQL设置
public string sqlWhere = string.Empty;
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
{
//搜索选项的搜索条件过滤
if (!string.IsNullOrEmpty(TextBox_Search.Text))
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
//且搜索条件
e.AddAndParams("USER_ID", PassportInfo.ID);
if (!string.IsNullOrEmpty(Request["Operation_Type"]))
{
e.AddAndParams("Operation_Type", Request["Operation_Type"].ToDecrypt());
}
e.AddOrderByParams("ACTINST_STARTDATE", true);
}
#endregion
#region ->
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string _ProInst_ID = GridViewEx1.DataKeys[e.Row.RowIndex]["ProInst_ID"].ToEncrypt();
string _NowActInst_ID = GridViewEx1.DataKeys[e.Row.RowIndex]["NowActInst_ID"].ToEncrypt();
if (!string.IsNullOrWhiteSpace(TextBox_Search.Text.Trim()))
{
//招商主体
e.Row.Cells[1].Text = e.Row.Cells[1].Text.Replace(TextBox_Search.Text.Trim(),
"<font style='color:red'>" + TextBox_Search.Text.Trim() + "</font>");
//项目名称
e.Row.Cells[2].Text = e.Row.Cells[2].Text.Replace(TextBox_Search.Text.Trim(),
"<font style='color:red'>" + TextBox_Search.Text.Trim() + "</font>");
//发起人员
e.Row.Cells[3].Text = e.Row.Cells[3].Text.Replace(TextBox_Search.Text.Trim(),
"<font style='color:red'>" + TextBox_Search.Text.Trim() + "</font>");
}
e.Row.Attributes.Add("onclick", "return WorkFlowPlatform_Transact(event,\"?NowActInst_ID=" +
_NowActInst_ID + "&Module_ID=" + Request["Module_ID"] + "&ProInst_ID=" + _ProInst_ID + "\",false);");
}
}
#endregion
}
}