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(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); } /// /// 返回业务流程服务区编码 /// /// /// 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 = " {1}"; 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 = " " + 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(ObjectDataSource1, GridPageEx1, DictionaryHelper.GetDictionary(Transaction, "TENDER_TYPE")); } #endregion #region 方法 -> 查询 protected void ButtonSearch_CallBackClick(object sender, ClientSetEventArgs e) { GridViewEx1.Selecting(ObjectDataSource1, GridPageEx1); //设置UI变化 e.SetValue(GridViewEx1); e.SetValue(GridPageEx1); } #endregion #region 方法 -> 翻页事件 protected void GridPageEx1_CallBackPageChanged(object src, ClientSetEventArgs e) { GridViewEx1.Pagging(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(), "" + TextBox_Search.Text.Trim() + ""); //项目名称 e.Row.Cells[2].Text = e.Row.Cells[2].Text.Replace(TextBox_Search.Text.Trim(), "" + TextBox_Search.Text.Trim() + ""); //招标人 e.Row.Cells[3].Text = e.Row.Cells[3].Text.Replace(TextBox_Search.Text.Trim(), "" + TextBox_Search.Text.Trim() + ""); } e.Row.Attributes.Add("onclick", "return WorkFlowPlatform_Transact(event,\"?NowActInst_ID=" + _NowActInst_ID + "&Module_ID=" + Request["Module_ID"] + "&ProInst_ID=" + _ProInst_ID + "\",false);"); } } #endregion } }