private void DoSend(RequestParam request, ResponseParam response, AbstractActionHandler handlerChain) { this.request = request; this.response = response = new ResponseParam(); this.DoSendAction(request, response); }
/// <summary> /// 创建诊毕逻辑链,返回链中起始节点 /// </summary> private AbstractActionHandler CreateActionHandlerChain(string xmlCfgPath) { // 责任链第一个节点 AbstractActionHandler startHandler = null; AbstractActionHandler preActionHandler = null; AbstractActionHandler nextActionHandler = null; XUserControl xUserControl = new XUserControl(); xUserControl.Init(xmlCfgPath); List <XBaseControl> xbaseCtrlList = xUserControl.GetConfig().GetViews(); if (xbaseCtrlList != null) { foreach (XBaseControl xBaseCtrl in xbaseCtrlList) { nextActionHandler = xBaseCtrl as AbstractActionHandler; preActionHandler = this.AddNextActionHandler(preActionHandler, nextActionHandler); if (startHandler == null) { startHandler = nextActionHandler; } } } return(startHandler); }
/// <summary> /// 对外发送事件,需要接收返回事件 /// </summary> /// <param name="sender">事件发送对象</param> /// <param name="uiEvent">发送事件的UIEvent</param> /// <param name="receiveUiEvent">事件接收的UIEvent</param> /// <param name="dataDic">发的数据</param> public void FireBizEventSent(AbstractActionHandler sender, string uiEvent, string receiveUiEvent, Dictionary <string, object> dataDic) { // 接收返回处理事件的对象只加一次 if (!string.IsNullOrEmpty(receiveUiEvent) && !handlerReceiveDic.ContainsKey(receiveUiEvent)) { handlerReceiveDic.Add(receiveUiEvent, sender); } DictionaryEventArgs args = new DictionaryEventArgs(); args.Data.Add(UIConst.UI_EVENT, uiEvent); //uiEvent = clearBanner args.Data.Add(UIConst.DATA, dataDic); //dataDic :key = clearBanner value = "OpComplete" 诊毕清空, value= "OpCompleteAndNextAction" 完成下一个清空 this.FireEventSent(sender, args); }
/// <summary> /// 执行事件链中各个节点 /// </summary> /// <param name="request"></param> /// <param name="responseParam"></param> /// <param name="handler"></param> public void DoSendAction(RequestParam request, ResponseParam response, AbstractActionHandler handler) { if (handler == null) { return; } this.request = request; if (!this.validate(this.request)) { return; } response = new ResponseParam(); handler.DoSendAction(this.request, this.response); }
private AbstractActionHandler AddNextActionHandler(AbstractActionHandler preHandler, AbstractActionHandler nextHandler) { if (nextHandler == null) { return(preHandler); } if (preHandler != null) { preHandler = preHandler.AddActionHandler(nextHandler); } else { preHandler = nextHandler; } return(preHandler); }
/// <summary> /// 诊毕流程 /// </summary> /// <param name="actionName">触发事件的(菜单、按钮)名称,如果后续逻辑需要判断就加,不需要可以不加</param> private void CreateCompleteHandlerChain(string actionName) { if (request.context == null || request.ent4BannerDTO == null) { return; } AbstractActionHandler startCompleteHandler = null; string idDep = this.Context.Dept.Id_dep; // 诊毕状态 0 无诊毕 可以去掉诊毕按钮,任何业务部受限制 // 1 仅诊毕 通过点击诊毕按钮,进行批量业务处理(是否处理按业务场景确定,比如是否修改诊毕状态,是否调用打印) // 2 诊毕撤回,严格控制诊毕后不允许做其他业务,只有进行撤回后才能继续 //string finishMode = this.Context.GetParam<string>(idDep, ICiOrdNSysParamConst.SYS_PARAM_OpThisPatVisitFinishMode); // 设置按钮事件名称 request.actionName = actionName; startCompleteHandler = this.GetStartCompleteHandler(actionName); if (startCompleteHandler != null) { startCompleteHandler.DoSendAction(request, null, startCompleteHandler); } }
/// <summary> /// 对外发送事件,需要接收返回事件 /// </summary> /// <param name="sender">事件发送对象</param> /// <param name="uiEvent">事件发送时对外传递的UIEvent</param> /// <param name="receiveUiEvent">接收发送事件反馈结果的UIEvent</param> /// <param name="dataDic">发的数据</param> protected void FireBizEventSent(AbstractActionHandler sender, string uiEvent, string receiveUiEvent, Dictionary <string, object> dataDic) { request.opActionChainHandler.FireBizEventSent(sender, uiEvent, receiveUiEvent, dataDic); }
/// <summary> /// 追加到事件处理链 /// </summary> /// <param name="handlerChain"></param> /// <returns></returns> public AbstractActionHandler AddActionHandler(AbstractActionHandler handlerChain) { this.handlerChain = handlerChain; return(this.handlerChain); }