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

159 lines
6.8 KiB
C#

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 SuperMap.RealEstate.CoreFrameWork;
using SuperMap.RealEstate.Enums;
using SuperMap.RealEstate.Web.UI.WebControls;
using SuperMap.RealEstate.Web.Utility;
using SuperMap.RealEstate.WorkFlow.Instance.Business;
namespace SuperMap.RealEstate.Finance.Modules.CompactSign
{
public partial class CompactSign : SuperMap.RealEstate.Web.UI.PageValid
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
this.Master_SizeBox.SetToolBarControl(ButtonMore);
ProInst_Type.Items.Clear();
ProInst_Type.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "-1" });
DictionaryHelper.BindingDropDownList<Enums.ProInstType>(ProInst_Type.Items, false);
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);
Operation_Type.Items.Clear();
Operation_Type.Items.Add(new Web.UI.WebControls.ListItemEx() { Text = "全部", Value = "-1" });
DictionaryHelper.BindingDropDownList("Operation_Type", Operation_Type.Items, Transaction);
BindGridVew();
//设置回车焦点按钮
SetControlClientAction(ButtonSearch);
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
private void BindGridVew()
{
//加载列表
GridViewEx1.SelectingWithInit<NowActInst>(ObjectDataSource1, GridPageEx1,
DictionaryHelper.GetDictionary(Transaction, "Division_Code"),
DictionaryHelper.GetDictionary<Enums.ProInstType>("ProInst_Type"),
DictionaryHelper.GetDictionary<Enums.ProInstState>("ProInst_State"),
DictionaryHelper.GetDictionary<Enums.ActInstType>("ActInst_Type"),
DictionaryHelper.GetDictionary<Enums.ActInstState>("ActInst_State"));
}
private string NewMethod(string Enabled_Division)
{
if (Enabled_Division == "1")
{
return "&Enabled_Division=" + Division_Code.ClientID;
}
return "";
}
//翻页事件
protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e)
{
GridViewEx1.Pagging<NowActInst>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
}
//异步查询
protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e)
{
GridViewEx1.Selecting<NowActInst>(ObjectDataSource1, GridPageEx1);
//设置UI变化
e.SetValue(GridViewEx1);
e.SetValue(GridPageEx1);
}
//查询参数
protected void GridViewEx1_SelectMethodParameters(object sender, SelectMethodParametersArgs e)
{
//搜索选项的搜索条件过滤
if (!string.IsNullOrEmpty(TextBox_Search.Text))
e.AddOrParams(GridViewSearch1, TextBox_Search.Text);
if (ProInst_Type.Value != "-1")
e.AddAndParams("ProInst_Type", ProInst_Type.Value);
if (Division_Code.Value != "-1")
{
if (Division_Code.Value == "0")
e.AddAndParams("Enabled_Division", Division_Code.Value);
else
e.AddAndParams("Division_Code", Division_Code.Value);
}
//过滤用户
//e.AddAndParams("User_ID", PassportInfo.ID);
e.SetOtherUserCustomWhereSqlString = "',' || USER_IDS || ',' LIKE '%," + PassportInfo.ID + ",%'";
//排序
e.AddOrderByParams(GridViewOrderBy1);
}
protected void GridViewEx1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "return WorkFlowPlatform_Transact(event,\"?" +
"NowActInst_ID=" + GridViewEx1.DataKeys[e.Row.RowIndex].Values[0].ToEncrypt() +
"&ProInst_ID=" + GridViewEx1.DataKeys[e.Row.RowIndex][2].ToString().ToEncrypt() + "\");");
if (!string.IsNullOrEmpty(GridViewEx1.DataKeys[e.Row.RowIndex][1].ToString()))
{
GridViewEx1.SetCellText(e.Row, "ProDef_Name", GridViewEx1.DataKeys[e.Row.RowIndex][1].ToString() +
" - " + GridViewEx1.GetCellText(e.Row, "ProDef_Name"));
}
}
if (CheckBoxExActInst.Checked && GridViewEx1.DataTableName != "T_NowActInst" &&
GridViewEx1.DataTableName != "V_NOWACTINSTEX")
{
GridViewEx1.SetCellVisible(e.Row, false, "ActInst_Name");
}
else
{
GridViewEx1.SetCellText(e.Row, "ActInst_Name", GridViewEx1.GetCellText(e.Row, "ProDef_Name") +
" - " + GridViewEx1.GetCellText(e.Row, "ActInst_Name"));
GridViewEx1.SetCellVisible(e.Row, false, "ProDef_Name");
}
FixProInstCode(e.Row);
}
private void FixProInstCode(GridViewRow Row)
{
GridViewEx1.SetCellVisible(Row, false, "ProInst_Type");
GridViewEx1.SetCellVisible(Row, false, "ActInst_State");
GridViewEx1.SetCellText(Row, "ActInst_Type", GridViewEx1.GetCellText(Row, "ActInst_Type").Replace("正在", ""));
List<string> _Text = new List<string>();
_Text.Add(FixProInstCode(Row, "ProInst_Type", "绿", "grean"));
_Text.Add(FixProInstCode(Row, "ProInst_Type", "交", "grean"));
_Text.Add(FixProInstCode(Row, "ProInst_Type", "急", "red"));
_Text.Add(FixProInstCode(Row, "ActInst_State", "退", "red"));
_Text.Add(FixProInstCode(Row, "ActInst_State", "移"));
_Text.RemoveAll(delegate(string item) { return string.IsNullOrEmpty(item); });
if (_Text.Count > 0)
GridViewEx1.SetCellText(Row, "ProInst_Code", GridViewEx1.GetCellText(Row, "ProInst_Code") +
"「" + string.Join("&nbsp", _Text.ToArray()) + "」");
}
private string FixProInstCode(GridViewRow Row, string columnName, string value, string color = "#ff5c00")
{
if (GridViewEx1.GetCellText(Row, columnName).IndexOf(value) > -1)
{
return "<font style='color:" + color + "'>" + value + "</font>";
}
return string.Empty;
}
}
}