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

283 lines
14 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Configuration;
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.ServiceModel;
using SuperMap.RealEstate.Utility;
using SuperMap.RealEstate.Web.UI;
using SuperMap.RealEstate.Web.UI.WebControls;
using SuperMap.RealEstate.Web.Utility;
using Business = SuperMap.RealEstate.HighWay.Running.Business;
using WFSB = SuperMap.RealEstate.WorkFlow.Support.Business;
namespace SuperMap.RealEstate.HighWay.Compents.ProinstCompact
{
public partial class CompactSign : UserControl<Business.JOINTLYSIGN>
{
protected string _ActInst_Name = ConfigurationManager.AppSettings["ActInst_Name"].ToString();
Running.Business.HIGHWAYPROINST _HighWayProInst = null;
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
_HighWayProInst = Running.Business.HIGHWAYPROINST.CreateInstance(Page);
}
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//2017/11/17朱梓毅修改环节回退时不可修改会审人员
_ActInst_Name = _ActInst_Name.Replace("'", "");
if (_HighWayProInst != null && _HighWayProInst.ProInst != null && _HighWayProInst.ProInst.NowActInst != null &&
(string.IsNullOrEmpty(_ActInst_Name) || _HighWayProInst.ProInst.NowActInst.ActInst_Name != _ActInst_Name.Split(',')[0]))
{
if (new WorkFlow.Instance.Business.ActInst(_HighWayProInst).GetCount("WHERE Proinst_ID = " +
_HighWayProInst.Proinst_ID + " AND ActDef_ID = " + _HighWayProInst.ProInst.NowActInst.ActDef_ID +
" AND ActInst_ID <> " + _HighWayProInst.ProInst.NowActInst.ActInst_ID) > 0 &&
(string.IsNullOrEmpty(ACTDEF_ID.SelectedValue) || (!string.IsNullOrEmpty(ACTDEF_ID.SelectedValue) &&
_HighWayProInst.ExecuteDataTable(@"SELECT 1 FROM WORKFLOW_INSTANCE.T_APPROVED A,WORKFLOW_INSTANCE.T_ACTINST B
WHERE A.Proinst_ID = B.Proinst_ID AND TO_CHAR(B.ACTINST_ID) = A.APPROVED_STAFF AND A.Proinst_ID = " +
_HighWayProInst.Proinst_ID + " AND B.ActDef_ID = " + ACTDEF_ID.SelectedValue).Rows.Count > 0)))
{
ACTDEF_ID.Enabled = false;
USER_IDS.Enabled = false;
}
}
}
//在此加入界面的数据初始化(Page_Load之前)如DropDownList的数据源绑定等
public override void InitializeWebControl()
{
//Approved_Type.Items.Clear();
//DictionaryHelper.BindingDropDownList("Approved_Type", Approved_Type.Items, this.Transaction);
//Business.ApprovedType _ApprovedType = new Business.ApprovedType(Transaction);
//_ApprovedType.BindingDropDownList(ApprovedType_ID.Items, string.Empty);
}
public override bool LoadData()
{
bool Flag = true;
SearchParameter _SearchParameter = new SearchParameter();
this.CurrObject.AddSearchParameter("HIGHWAYPROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID);
Running.Business.PROINSTCOMPACT _PROINSTCOMPACT = new Business.PROINSTCOMPACT(CurrObject);
_PROINSTCOMPACT.AddSearchParameter("HIGHWAYPROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID);
if (_PROINSTCOMPACT.Search())
{
CurrObject.AddSearchParameter("TENDER_ID", _PROINSTCOMPACT.PROINSTCOMPACT_ID);
}
#region
ACTDEF_ID.Items.Clear();
if (ModifyType == ModifyTypeEnum.ReadOnly || ModifyType == ModifyTypeEnum.ReadOnlyVisible)
{
WorkFlow.Support.Business.ActDef _ActDef = new WFSB.ActDef(CurrObject);
_ActDef.ActDef_ID = _HighWayProInst.ProInst.NowActInst.ActDef_ID;
if (_ActDef.Select())
{
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = _ActDef.ActDef_Name;
_ListItemEx.Value = _ActDef.ActDef_ID.ToString();
ACTDEF_ID.Items.Add(_ListItemEx);
CurrObject.SearchParameters.Remove(_SearchParameter);
_SearchParameter.Name = "ACTDEF_ID";
_SearchParameter.Value = _ActDef.ActDef_ID;
CurrObject.SearchParameters.Add(_SearchParameter);
//CurrObject.AddSearchParameter("ACTDEF_ID", _ActDef.ActDef_ID);
if (this.CurrObject.Search())
{
this.BindObjectToControl();
}
}
}
else
{
foreach (WorkFlow.Support.Business.ActDef _ActDef in new WorkFlow.Support.Business.ActDef(CurrObject).FillCollection(
"WHERE ACTDEF_ID IN (SELECT NEXTACTDEF_ID FROM WORKFLOW_SUPPORT.T_ROUTE WHERE ACTDEF_ID = " +
_HighWayProInst.ProInst.NowActInst.ActDef_ID + ")"))
{
if (_ActDef.ActDef_Type.ToInt32() == 3020)
{
foreach (WFSB.ActDef _NextActDef in new WFSB.ActDef(CurrObject).FillCollection(
"WHERE ACTDEF_ID IN (SELECT NEXTACTDEF_ID FROM WORKFLOW_SUPPORT.T_ROUTE WHERE ACTDEF_ID = " +
_ActDef.ActDef_ID + ")"))
{
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = _NextActDef.ActDef_Name;
_ListItemEx.Value = _NextActDef.ActDef_ID.ToString();
ACTDEF_ID.Items.Add(_ListItemEx);
CurrObject.SearchParameters.Remove(_SearchParameter);
_SearchParameter.Name = "ACTDEF_ID";
_SearchParameter.Value = _NextActDef.ActDef_ID;
CurrObject.SearchParameters.Add(_SearchParameter);
//CurrObject.AddSearchParameter("ACTDEF_ID", _NextActDef.ActDef_ID);
if (this.CurrObject.Search() && Flag)
{
this.BindObjectToControl();
Flag = false;
}
}
}
else
{
ListItemEx _ListItemEx = new ListItemEx();
_ListItemEx.Text = _ActDef.ActDef_Name;
_ListItemEx.Value = _ActDef.ActDef_ID.ToString();
ACTDEF_ID.Items.Add(_ListItemEx);
CurrObject.SearchParameters.Remove(_SearchParameter);
_SearchParameter.Name = "ACTDEF_ID";
_SearchParameter.Value = _ActDef.ActDef_ID;
CurrObject.SearchParameters.Add(_SearchParameter);
//CurrObject.AddSearchParameter("ACTDEF_ID", _ActDef.ActDef_ID);
if (this.CurrObject.Search() && Flag)
{
this.BindObjectToControl();
Flag = false;
}
}
}
}
#endregion
#region
if (!string.IsNullOrEmpty(JOINTLYSIGN_ID.Text))
{
CurrObject.ResetProperty();
CurrObject.JOINTLYSIGN_ID_Encrypt = JOINTLYSIGN_ID.Text.ToEncrypt();
if (CurrObject.Select())
{
USER_IDS.Clear();
foreach (DataRow _DataRow in _HighWayProInst.ExecuteDataTable(@"SELECT * FROM PLATFORM_FRAMEWORK.T_USER A
WHERE EXISTS(SELECT 1 FROM WORKFLOW_SUPPORT.T_ROLE B,WORKFLOW_SUPPORT.T_USERROLE C
WHERE A.USER_ID = C.USER_ID AND B.ROLE_ID = C.ROLE_ID AND B.ACTDEF_ID = " +
CurrObject.ACTDEF_ID + ")").Rows)
{
ListItemEx _ListItem = new ListItemEx();
_ListItem.Text = _DataRow["USER_NAME"].ToString();
_ListItem.Value = _DataRow["USER_ID"].ToString();
USER_IDS.Items.Add(_ListItem);
}
if (!string.IsNullOrEmpty(CurrObject.USER_IDS))
{
USER_IDS.SelectedValue = CurrObject.USER_IDS;
}
}
}
else if (!string.IsNullOrEmpty(ACTDEF_ID.SelectedValue))
{
USER_IDS.Clear();
foreach (DataRow _DataRow in _HighWayProInst.ExecuteDataTable(@"SELECT * FROM PLATFORM_FRAMEWORK.T_USER A
WHERE EXISTS(SELECT 1 FROM WORKFLOW_SUPPORT.T_ROLE B,WORKFLOW_SUPPORT.T_USERROLE C
WHERE A.USER_ID = C.USER_ID AND B.ROLE_ID = C.ROLE_ID AND B.ACTDEF_ID = " +
ACTDEF_ID.SelectedValue + ")").Rows)
{
ListItemEx _ListItem = new ListItemEx();
_ListItem.Text = _DataRow["USER_NAME"].ToString();
_ListItem.Value = _DataRow["USER_ID"].ToString();
USER_IDS.Items.Add(_ListItem);
}
}
#endregion
return true;
}
public override bool LoadDataEx(Web.UI.WebControls.ClientSetEventArgs ClientSet)
{
return base.LoadDataEx(ClientSet);
}
//OnDataAction_XXXXX 有一个系列可用,在此加入界面的逻辑处理
//e.CancelDataAction 来处理是否取消该动作;
//失败的原因可以用Page.Alert()传递到页面
public override void OnDataAction_BeforeSave(DataActionEventArgs<Running.Business.JOINTLYSIGN> e)
{
e.CurrObject.HIGHWAYPROINST_ID = _HighWayProInst.HIGHWAYPROINST_ID;
Running.Business.PROINSTCOMPACT _PROINSTCOMPACT = new Business.PROINSTCOMPACT(CurrObject);
_PROINSTCOMPACT.AddSearchParameter("HIGHWAYPROINST_ID", _HighWayProInst.HIGHWAYPROINST_ID);
if (_PROINSTCOMPACT.Search())
{
CurrObject.TENDER_ID = _PROINSTCOMPACT.PROINSTCOMPACT_ID;
}
else
{
throw new Exception("请保存合同信息后再填写会审人员!");
}
if (USER_IDS.Enabled)
{
if (string.IsNullOrEmpty(CurrObject.USER_IDS))
{
throw new Exception("请选择会审人员后,再点击保存!");
}
else
{
string _USER_NAMES = "";
foreach (FrameWork.Business.User _User in new FrameWork.Business.User(CurrObject).FillCollection(
"WHERE USER_ID IN (" + CurrObject.USER_IDS + ")"))
{
_USER_NAMES += (string.IsNullOrEmpty(_USER_NAMES) ? "" : ",") + _User.User_Name;
}
USER_NAMES.Text = _USER_NAMES;
CurrObject.USER_NAMES = _USER_NAMES;
}
}
else
{
Business.JOINTLYSIGN _JOINTLYSIGN = new Business.JOINTLYSIGN(CurrObject);
_JOINTLYSIGN.JOINTLYSIGN_ID_Encrypt = JOINTLYSIGN_ID.Text.ToEncrypt();
if (_JOINTLYSIGN.Select())
{
if (!string.IsNullOrEmpty(_JOINTLYSIGN.USER_IDS))
{
USER_IDS.SelectedValue = _JOINTLYSIGN.USER_IDS;
e.CurrObject.USER_IDS = _JOINTLYSIGN.USER_IDS;
string _USER_NAMES = "";
foreach (FrameWork.Business.User _User in new FrameWork.Business.User(CurrObject).FillCollection(
"WHERE USER_ID IN (" + _JOINTLYSIGN.USER_IDS + ")"))
{
_USER_NAMES += (string.IsNullOrEmpty(_USER_NAMES) ? "" : ",") + _User.User_Name;
}
USER_NAMES.Text = _USER_NAMES;
CurrObject.USER_NAMES = _USER_NAMES;
}
}
}
base.OnDataAction_BeforeSave(e);
}
public override void OnDataAction_AfterSave(DataActionEventArgs<Business.JOINTLYSIGN> e)
{
base.OnDataAction_AfterSave(e);
}
protected void ACTDEF_ID_CallBackSetControl(object sender, ClientSetEventArgs e)
{
USER_IDS.Clear();
if (!string.IsNullOrEmpty(e.Argument))
{
foreach (DataRow _DataRow in _HighWayProInst.ExecuteDataTable(@"SELECT * FROM PLATFORM_FRAMEWORK.T_USER A
WHERE EXISTS(SELECT 1 FROM WORKFLOW_SUPPORT.T_ROLE B,WORKFLOW_SUPPORT.T_USERROLE C
WHERE A.USER_ID = C.USER_ID AND B.ROLE_ID = C.ROLE_ID AND B.ACTDEF_ID = " +
ACTDEF_ID.SelectedValue + ")").Rows)
{
ListItemEx _ListItem = new ListItemEx();
_ListItem.Text = _DataRow["USER_NAME"].ToString();
_ListItem.Value = _DataRow["USER_ID"].ToString();
USER_IDS.Items.Add(_ListItem);
}
e.SetDropDownListEx(USER_IDS);
}
}
}
}