ab56a9bcf7
SVN-Revision: r240
175 lines
7.0 KiB
C#
175 lines
7.0 KiB
C#
using Lskj.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
|
|
namespace Lskj.Control.Model
|
|
{
|
|
public class PubEvenImpl
|
|
{
|
|
#region 绑定所有自定义委托事件
|
|
//public event ModuleDataLoadHandler BeforeModuleDataLoad;
|
|
public event ModuleDataChangeHandler BeforeModuleDataChange;
|
|
public event ModuleDataChangeHandler AfterModuleDataChange;
|
|
//【10.10】删除事件推送,作为未添加的 删除存储过程 的作用,更方便
|
|
public event ModuleDataChangeHandler BeforeModuleDataDelete;
|
|
public event ModuleDataChangeHandler AfterModuleDataDelete;
|
|
//基础档案提交的定义委托
|
|
public event ModuleStateChangeHandler BeforeModuleStateChange;
|
|
public event ModuleStateChangeHandler AfterModuleStateChange;
|
|
#endregion
|
|
|
|
public PubEvenImpl()
|
|
{
|
|
LoadEventHandler();
|
|
}
|
|
/// <summary>
|
|
/// 初始化所有接口调用的事件
|
|
/// </summary>
|
|
private void LoadEventHandler()
|
|
{
|
|
//string eventCls = WebConfigUtil.Get("ModuleApiHandler");
|
|
//foreach (var cls in eventCls.Split(';'))
|
|
//{
|
|
// if (string.IsNullOrEmpty(cls) || cls.IndexOf(",", StringComparison.Ordinal) < 0) continue;
|
|
// string[] clsInfo = cls.Split(',');
|
|
// if (!string.IsNullOrEmpty(clsInfo[1]))
|
|
// {
|
|
// try
|
|
// {
|
|
// //Assembly assembly = Assembly.LoadFrom(AppPhysicsPath + "\\bin\\" + clsInfo[1]);
|
|
// //IModuleEvent eventOper = assembly.CreateInstance(clsInfo[0]) as IModuleEvent;
|
|
// if (eventOper != null)
|
|
// {
|
|
// //BeforeModuleDataLoad += eventOper.BeforeModuleDataLoad;
|
|
// BeforeModuleDataChange += eventOper.BeforeModuleDataChange;
|
|
// AfterModuleDataChange += eventOper.AfterModuleDataChange;
|
|
|
|
// BeforeModuleDataDelete += eventOper.BeforeModuleDataDelete;
|
|
// AfterModuleDataDelete += eventOper.AfterModuleDataDelete;
|
|
|
|
// BeforeModuleStateChange += eventOper.BeforeModuleStateChange;
|
|
// AfterModuleStateChange += eventOper.AfterModuleStateChange;
|
|
|
|
// //BeforeModuleAuditStateChange += eventOper.BeforeModuleAuditStateChange;
|
|
// //AfterModuleAuditStateChange += eventOper.AfterModuleAuditStateChange;
|
|
|
|
// //BeforeModuleContextMenu += eventOper.BeforeModuleContextMenu;
|
|
// //AfterModuleContextMenu += eventOper.AfterModuleContextMenu;
|
|
|
|
// AppStart += eventOper.App_Start;
|
|
// AppEnd += eventOper.App_End;
|
|
// }
|
|
// else
|
|
// {
|
|
// MessageUtil.Show("加载事件实例出错,未能实例事件类!请检查配置!" + cls);
|
|
// }
|
|
// }
|
|
// catch (Exception e)
|
|
// {
|
|
// MessageUtil.Show("加载事件程序集出错!请检查配置!" + cls);
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
//if (string.IsNullOrEmpty(eventCls) || eventCls.IndexOf(",", StringComparison.Ordinal) < 0) return;
|
|
|
|
}
|
|
|
|
#region 注册事件回调
|
|
//对应事件列表
|
|
public event EventHandler AppStart;
|
|
//对应事件列表
|
|
public event EventHandler AppEnd;
|
|
//public void CallBeforeModuleDataLoad(string moduleId)
|
|
//{
|
|
// if (BeforeModuleDataLoad != null)
|
|
// {
|
|
// BeforeModuleDataLoad(new ModuleModel() { ModuleId = moduleId });
|
|
// }
|
|
// return;
|
|
//}
|
|
/// <summary>
|
|
/// 基础档案数据改变之前触发回调
|
|
/// </summary>
|
|
/// <param name="module">基础档案类</param>
|
|
/// <param name="aType">触发事件的类型</param>
|
|
/// <param name="response">传输接口类</param>
|
|
public void CallBeforeModuleDataChange(ModuleModel module, ActionType aType, BaseResponse response)
|
|
{
|
|
if (BeforeModuleDataChange != null)
|
|
{
|
|
BeforeModuleDataChange(module, aType, response);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 基础档案数据改变之后触发回调
|
|
/// </summary>
|
|
/// <param name="module">基础档案类</param>
|
|
/// <param name="aType">触发事件的类型</param>
|
|
/// <param name="response">传输接口类</param>
|
|
public void CallAfterModuleDataChange(ModuleModel module, ActionType aType, BaseResponse response)
|
|
{
|
|
if (AfterModuleDataChange != null)
|
|
{
|
|
AfterModuleDataChange(module, aType, response);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 基础档案数据删除之前触发回调
|
|
/// </summary>
|
|
/// <param name="module">基础档案类</param>
|
|
/// <param name="response">传输接口类</param>
|
|
public void CallBeforeModuleDataDelete(ModuleModel module, BaseResponse response)
|
|
{
|
|
if (BeforeModuleDataDelete != null)
|
|
{
|
|
BeforeModuleDataDelete(module, ActionType.Delete, response);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 基础档案数据删除之后触发回调
|
|
/// </summary>
|
|
/// <param name="module">基础档案类</param>
|
|
/// <param name="response">传输接口类</param>
|
|
public void CallAfterModuleDataDelete(ModuleModel module, BaseResponse response)
|
|
{
|
|
if (AfterModuleDataDelete != null)
|
|
{
|
|
AfterModuleDataDelete(module, ActionType.Delete, response);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 基础档案提交之前触发回调
|
|
/// </summary>
|
|
/// <param name="module">基础档案类</param>
|
|
/// <param name="aType">触发事件的类型</param>
|
|
/// <param name="response">传输接口类</param>
|
|
public void CallBeforeModuleStateChange(ModuleModel module, ActionType aType, BaseResponse response)
|
|
{
|
|
if (BeforeModuleStateChange != null)
|
|
{
|
|
BeforeModuleStateChange(module, aType, response);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 基础档案提交之后触发回调
|
|
/// </summary>
|
|
/// <param name="module">基础档案类</param>
|
|
/// <param name="aType">触发事件的类型</param>
|
|
/// <param name="response">传输接口类</param>
|
|
public void CallAfterModuleStateChange(ModuleModel module, ActionType aType, BaseResponse response)
|
|
{
|
|
if (AfterModuleStateChange != null)
|
|
{
|
|
AfterModuleStateChange(module, aType, response);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|