private void SetRouteConnection(RouteStepConfig config, WorkflowContent content) { string nextStep = null; try { foreach (ConnectionConfig connection in config.Connections) { bool isMatch = false; var plugIn = AtawIocContext.Current.FetchInstance <IConnection>(connection.PlugName); isMatch = plugIn.Match(WorkflowRow, content, Source); if (isMatch) { nextStep = connection.NextStepName; break; } } } catch (Exception ex) { throw new NoRouteException(config, config.Error); } AtawDebug.AssertNotNull(nextStep, string.Format(ObjectUtil.SysCulture, "路由步骤{0} 的下一个步骤不能为空", config.Name), this); //if (string.IsNullOrEmpty(nextStep)) //{ // throw new NoRouteException(config, config.Error); //} //下一个步骤名 WorkflowRow.WI_CUSTOM_DATA = nextStep; }
protected T GetStep <T>(Step step) where T : Step { AtawDebug.AssertArgumentNull(step, "step", this); T result = step as T; AtawDebug.AssertNotNull(result, string.Format(ObjectUtil.SysCulture, "当前的Step类型必须{0},而现在却是{1}", typeof(T), step.GetType()), this); return(result); }
private ActionResult ReDirectAction(string name, object[] parameters) { Type p = this.GetType(); MethodInfo m = p.GetMethod(name); AtawDebug.AssertNotNull(m, string.Format(ObjectUtil.SysCulture, "不能找到名为{0}的Action", name), this); var result = m.Invoke(this, null); if (result is string) { return new ContentResult() { Content = result.ToString() } } ; else { return(result as ActionResult); } }
public string WorkflowProcess(string wid, DataSet PostDataSet) { Workflow.Core.Workflow wf = Workflow.Core.Workflow.CreateWorkflow(context, wid); WorkflowConfig.ConnString = PlugAreaRegistration.CONN; ManualStepConfig config = wf.CurrentStep.Config as ManualStepConfig; AtawDebug.AssertNotNull(config, "调用时机有误,当前的步骤必须是人工步骤,现在不是", this); WorkflowContent content = WorkflowInstUtil.CreateContent(wf.WorkflowRow); if (!string.IsNullOrEmpty(config.Process.UIOperation.RegName)) { UIProcessor processor = AtawIocContext.Current.FetchInstance <UIProcessor>( config.Process.UIOperation.PlugIn); processor.Config = config; processor.Source = context; processor.Content = content; processor.UIData = PostDataSet; processor.Execute(wf.WorkflowRow); WorkflowInstUtil.ManualSendWorkflow(wf.WorkflowRow, GlobalVariable.UserId, processor); } else { wf.WorkflowRow.WI_PROCESS_ID = GlobalVariable.UserId.ToString(); wf.WorkflowRow.WI_PROCESS_DATE = context.Now; wf.WorkflowRow.WI_STATUS = (int)StepState.ProcessNotSend; } //context.Submit(); wf.UpdateState(ManualPNSState.Instance); string url = wf.GetWorkflowUrl(); JsResponseResult <string> res = new JsResponseResult <string>() { ActionType = JsActionType.Url, Content = url }; return(res.ToJSON()); }
private Workflow(string workflowId, IUnitOfData workflowSource) : this(workflowSource) { //Source = workflowSource; WorkflowDbContext dbContext = workflowSource as WorkflowDbContext; WF_WORKFLOW_INST row = dbContext.WF_WORKFLOW_INST.FirstOrDefault(a => a.WI_ID == workflowId); AtawDebug.AssertNotNull(row, "该流程已处理或异常,请进历史页面查看", this); WorkflowId = row.WI_ID; WorkflowRow = row; Config = WorkflowConfig.GetByName(row.WI_WD_NAME, workflowSource); //WorkflowConfig.ConnString = StepConfig stepConfig = Config.Steps[row.WI_CURRENT_STEP]; if (stepConfig != null) { CurrentStep = stepConfig.CreateStep(this); CurrentState = CurrentStep.GetState(row.WI_STATUS.Value <StepState>()); } else { throw new AtawException("不存在的步骤" + row.WI_CURRENT_STEP, this); } }
public string LoadPage(string regName, string pageStyle, string xml, string ds) { SetPostDataSet(ds); string moduleXml = xml; if (xml.IsEmpty()) { var singleCodeTable = AtawIocContext.Current.FetchInstance <CodeTable <CodeDataModel> >(regName) as SingleCodeTable <CodeDataModel>; if (singleCodeTable != null) { moduleXml = singleCodeTable.ModuleXml; } AtawDebug.AssertNotNull(moduleXml, string.Format("插件名为{0}的CodeTable需要配置ModuleXml", regName), this); } moduleXml = Xml(moduleXml); ModuleConfig mc = moduleXml.SingletonByPage <ModuleConfig>(); var tool = GetPageViewTool(mc); // string ds = ""; string keyValue = ""; tool.BeginModuleInterceptor(ref ds, ref moduleXml, ref pageStyle, ref keyValue, ref mc); AtawBasePageViewCreator pageCreator = (pageStyle + "PageView").SingletonByPage <AtawBasePageViewCreator>(); pageCreator.Initialize(mc, JsonConvert.DeserializeObject <DataSet>(ds ?? ""), "", "", false); var apcv = pageCreator.Create(); apcv.RegName = moduleXml; //(apcv as AtawListPageConfigView).PageSelector = new PageSelector() //{ // ValueField = singleCodeTable.ValueField, // TextField = singleCodeTable.TextField //}; // return ReturnJson(apcv); return(tool.EndModuleInterceptor(apcv)); }