/// <summary> /// 初始化用户输入框 /// </summary> /// <param name="container"></param> private void InitActivitiesListBox(HtmlSelect activitiesList) { RejectActivityList activities = RejectActivityList.CreateFromProcess(WfClientContext.Current.CurrentActivity.Process); ListItemCollection list = new ListItemCollection(); for (int i = activities.Count - 1; i >= 0; i--) { IWfActivity activity = activities[i]; if (activity.Descriptor.Properties.GetValue("AllowToBeReturned", true)) { WfControlNextStep nextSetp = new WfControlNextStep(activity); string displayName = string.Empty; if (activity.Operator != null) { displayName = activity.Operator.DisplayName; } else { if (activity.Assignees.Count > 0) { displayName = activity.Assignees[0].User.DisplayName; } else { displayName = Translator.Translate(Define.DefaultCulture, "自动流转点"); } } WfMoveToControl.DoActionAfterRegisterContextConverter(() => { ListItem item = new ListItem(string.Format("{0} - {1}({2})", displayName, activity.Descriptor.Name, activity.Descriptor.Key), JSONSerializerExecute.Serialize(nextSetp)); list.Add(item); } ); } } if (list.Count > 0) { foreach (ListItem item in list) { this._ActivitiesList.Items.Add(item); } } else { this._ActivitiesList.Items.Add(Translator.Translate(Define.DefaultCulture, "没有能够退回的环节")); this._ActivitiesList.Disabled = true; } this._ActivitiesList.Multiple = true; }
private void RenderNextStepsInfo(WfControlNextStepCollection nextSteps) { if (Enabled) { WfMoveToControl.DoActionAfterRegisterContextConverter(() => Page.ClientScript.RegisterHiddenField( this.ClientID + "_data", JSONSerializerExecute.Serialize(nextSteps)) ); } }
private void ChangeProcessButton_Click(object sender, EventArgs e) { try { WfActivityDescriptorCreateParams createParams = null; WfMoveToControl.DoActionAfterRegisterContextConverter(() => createParams = JSONSerializerExecute.Deserialize <WfActivityDescriptorCreateParams>(_HiddenData.Value)); WfExecutorBase executor = null; IWfActivity targetActivity = FindCurrentActivity(createParams); IWfActivity changedActivity = targetActivity; switch (createParams.Operation.ToLower()) { case "add": executor = new WfAddActivityExecutor(CurrentActivity, targetActivity, createParams); break; case "update": executor = new WfEditActivityExecutor(CurrentActivity, targetActivity, createParams); break; case "delete": executor = new WfDeleteActivityExecutor(CurrentActivity, targetActivity); break; default: throw new SystemSupportException(string.Format("Invalid operation name: {0}", createParams.Operation)); } WfMoveToControl.Current.OnAfterCreateModifyProcessExecutor(executor); WfClientContext.Current.Execute(executor); WfMoveToControl.Current.OnProcessChanged(targetActivity.Process); RecreateProcesses(WfMoveToControl.Current.NextSteps, false, false); if (executor != null) { WfMoveToControl.Current.OnAfterProcessChanged(targetActivity.Process); } } catch (System.Exception ex) { RegisterPostBackException(ex); } }
private void RecreateProcesses(WfControlNextStepCollection nextSteps, bool saveAndReload, bool isCurrent) { _Table.Rows.Clear(); if (saveAndReload) { WfSaveDataExecutor executor; if (isCurrent) { executor = new WfSaveDataExecutor(WfClientContext.Current.OriginalCurrentActivity, WfClientContext.Current.OriginalCurrentActivity); } else { executor = new WfSaveDataExecutor(OriginalActivity, OriginalActivity); } executor.AutoCommit = false; executor.SaveUserTasks = false; executor.Execute(); ReloadProcessContext(); } CreateProcessSteps(GetAllMainStreamActivities()); if (WfMoveToControl.Current != null) { if (nextSteps == null) { nextSteps = WfMoveToControl.Current.NextSteps; } WfMoveToControl.DoActionAfterRegisterContextConverter(() => AddControlToTemplate(_RootPanel, new LiteralControl( string.Format("<input type='hidden' id='adjustNextStepsHidden' name='adjustNextStepsHidden' value='{0}'/>", HttpUtility.HtmlAttributeEncode(JSONSerializerExecute.Serialize(nextSteps))) )) ); } }