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

156 lines
6.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Xml.Xsl;
using System.Reflection;
using SuperMap.RealEstate.Configuration;
using SuperMap.RealEstate.CoreFrameWork;
using SuperMap.RealEstate.Utility;
using SuperMap.RealEstate.Web.UI;
using SuperMap.RealEstate.Web.UI.WebControls;
using SuperMap.RealEstate.ServiceModel;
using SuperMap.RealEstate.WorkFlow;
namespace SuperMap.RealEstate.Personnel.Common
{
public class PageHelper
{
public static void CreateHeaderStyle(SuperMap.RealEstate.Web.UI.Page _Page)
{
RegisterResource(_Page, "/PropertyManage/Styles/StyleSheet.css", "PropertyManageStyleSheet", PageHeaderRegType.Css);
RegisterResource(_Page, "/PropertyManage/Styles/ReportStyleSheet.css", "ReportStyleSheet", PageHeaderRegType.Css);
RegisterResource(_Page, "/PropertyManage/Scripts/kissy/kissy-min.js", "KissyMin", PageHeaderRegType.Js);
RegisterResource(_Page, "/PropertyManage/Scripts/kissy-global.js", "KissyGlobalJavaScript", PageHeaderRegType.Js);
}
/// <summary>
/// 注册资源文件
/// </summary>
/// <param name="_Page">面页</param>
/// <param name="path">路径</param>
/// <param name="key">搜索的客户端资源的键</param>
/// <param name="_PageHeaderRegType">资源文件类型</param>
public static void RegisterResource(SuperMap.RealEstate.Web.UI.Page _Page, string path, string key, PageHeaderRegType _PageHeaderRegType)
{
string resStr = string.Empty;
switch (_PageHeaderRegType)
{
//脚本
case PageHeaderRegType.Js:
resStr = string.Format("<script type=\"text/javascript\" language=\"javascript\" src=\"{0}\"></script>", path);
break;
//样式
case PageHeaderRegType.Css:
resStr = string.Format("<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" />", path);
break;
}
//是否已输出
if (!_Page.ClientScript.IsClientScriptBlockRegistered(_Page.GetType(), key))
{
if (_Page.Header != null)
{
LiteralControl link = new LiteralControl();
link.Text = "\r\n" + resStr;
_Page.Header.Controls.Add(link);
}
//注册资源key
_Page.ClientScript.RegisterClientScriptBlock(_Page.GetType(), key, "", false);
}
}
/// <summary>
/// 注册脚本块(或者样式块)
/// </summary>
/// <param name="_Page">页面</param>
/// <param name="script">脚本块</param>
/// <param name="key">键值</param>
public void RegisterScript(SuperMap.RealEstate.Web.UI.Page _Page, string script, string key)
{
//是否已输出
if (!_Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), key))
{
if (_Page.Header != null)
{
LiteralControl link = new LiteralControl();
link.Text = "\r\n" + script;
_Page.Header.Controls.Add(link);
}
_Page.ClientScript.RegisterClientScriptBlock(this.GetType(), key, "", false);//注册资源key
}
}
/// <summary>
/// 样式类型
/// </summary>
public enum PageHeaderRegType
{
/// <summary>
/// 脚本
/// </summary>
Js,
/// <summary>
/// 样式
/// </summary>
Css,
}
#region
/// <summary>
/// 重新加载组件
/// </summary>
/// <param name="ProInst"></param>
/// <param name="e"></param>
/// <param name="WorkFlowPage"></param>
public static void ReLoadExCompacts(Running.Business.PERSONNELPROINST ProInst, ClientSetEventArgs e, IWorkFlowPage WorkFlowPage)
{
if (ProInst == null)
throw new Exception("流程实例不能为空!");
//审批表
string WorkFlow_Table = "83d87e86-ece7-4e97-9fe0-70caba974fd2";
switch (ProInst.ProInst.Operation_Type.Value)
{
case SuperMap.RealEstate.Enums.Operation_Type.CommodityApprove:
//审批表
RefreshCompact(e, WorkFlowPage, WorkFlow_Table);
////商品列表
//RefreshCompact(e, WorkFlowPage, "f8cab300-74b5-4c03-bfa9-d709f8864f6c");
break;
case SuperMap.RealEstate.Enums.Operation_Type.CommodityChange:
//审批表
RefreshCompact(e, WorkFlowPage, WorkFlow_Table);
////预售备案缴款单
//RefreshCompact(e, WorkFlowPage, "1362e8d6-aed2-4ab0-adf1-aea05a36026b");
break;
default:
throw new Exception("尚未配置要刷新的流程!");
}
}
#endregion
/// <summary>
/// 重置前端数据
/// </summary>
/// <param name="e">支持脚本对象</param>
/// <param name="WorkFlowPage">工作流接口</param>
/// <param name="Compact_Guid">组件Guid</param>
/// <returns></returns>
public static void RefreshCompact(ClientSetEventArgs e, IWorkFlowPage WorkFlowPage, string Compact_Guid)
{
if (WorkFlowPage == null)
throw new Exception("WorkFlowPage is Null !");
WorkFlowPage.ReloadWorkFlowCompoment(Compact_Guid, e);
//SuperMap.RealEstate.Web.UI.UserControl _UserControl = WorkFlowPage.GetWorkFlowComponent(Compact_Guid);
//if (_UserControl == null)
// return false;
//return _UserControl.LoadDataEx(e);
}
}
}