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

291 lines
13 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;
using HWSB = SuperMap.RealEstate.HighWay.Storage.Business;
namespace SuperMap.RealEstate.HighWay.Compents.TenderDocument
{
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);
}
//绑定下拉框
try
{
ListItemEx _ListItemEx = null;
//获取业务类型枚举
FieldExplain _FieldExplain = DictionaryHelper.GetFieldExplain("OPERATION_TYPE", Transaction);
//绑定业务类型下拉框
OPERATION_TYPE.Clear();
OPERATION_TYPE.Items.Add(new ListItemEx("全部", "1=1"));
foreach (FieldEnum _FieldEnum in new FieldEnum(Transaction).FillCollection("WHERE FIELDEXPLAIN_ID = " +
_FieldExplain.FieldExplain_ID + " AND FIELDENUM_VALUE LIKE '32%' ORDER BY FIELDENUM_INDEX,FIELDENUM_VALUE"))
{
_ListItemEx = new ListItemEx();
_ListItemEx.Text = _FieldEnum.FieldEnum_Name;
_ListItemEx.Value = _FieldEnum.FieldEnum_Value;
_ListItemEx.Level = 1;
OPERATION_TYPE.Items.Add(_ListItemEx);
}
OPERATION_TYPE.SelectedValue = "1=1";
//流程状态 ProInst_State
ProInst_State.Items.Clear();
ProInst_State.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "-1" });
DictionaryHelper.BindingDropDownList<Enums.ProInstState>(ProInst_State.Items, false);
ProInst_State.Items.RemoveAt(2);
//服务区
SERVERPART_ID.Clear();
SERVERPART_ID.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "1=1" });
new HWSB.SERVERPART(Transaction).BindingDropDownList(SERVERPART_ID.Items, "", PassportInfo.CityAuthority,
true, 1, " AND STATISTICS_TYPE IN (1000,1010) AND STATISTIC_TYPE = 1000");
SERVERPART_ID.SelectedIndex = 1;
//招标方式
TENDER_TYPE.Clear();
TENDER_TYPE.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "1=1" });
DictionaryHelper.BindingDropDownList("TENDER_TYPE", TENDER_TYPE.Items, Transaction);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
//所有城区权限时,不在显示
//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,
DictionaryHelper.GetDictionary(Transaction, "TENDER_TYPE"));
}
#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());
}
else if (!string.IsNullOrWhiteSpace(OPERATION_TYPE.SelectedValue) && OPERATION_TYPE.SelectedValue != "1=1")
{
e.AddAndParams("OPERATION_TYPE", OPERATION_TYPE.SelectedValue);
}
//--只显示对应的办结信息
if (ProInst_State.Value != "-1")
{
e.AddAndParams("ProInst_State", ProInst_State.Value);
}
if (SERVERPART_ID.SelectedIndex > 0 && SERVERPART_ID.SelectedValue != "1=1")
{
e.AddAndParams("SERVERPART_ID", SERVERPART_ID.SelectedValue.ToDecrypt());
}
else if (!string.IsNullOrEmpty(Request["STAFFID"]))
{
string _SERVERPART_ID = new HWSB.SERVERPART(Transaction).GetPassportServerPartID(PassportInfo.CityAuthority);
e.SetOtherUserCustomWhereSqlString += (e.SetOtherUserCustomWhereSqlString == "" ? "" : " AND ") +
"SERVERPART_ID IN (" + _SERVERPART_ID + ")";
}
if (!string.IsNullOrEmpty(TENDER_TYPE.SelectedValue) && TENDER_TYPE.SelectedValue != "1=1")
{
e.AddAndParams("TENDER_TYPE", TENDER_TYPE.SelectedValue);
}
//排序
e.AddOrderByParams(GridViewOrderBy1);
}
#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
}
}