public static Dictionary <string, int> GetProcActivites(int procID) { Dictionary <string, int> list = new Dictionary <string, int>(); WorkflowManagementServer svr = new WorkflowManagementServer(K2ServerName, uint.Parse(K2ServerPort)); try { svr.Open(); Activities activities = svr.GetProcInstActivities(procID); foreach (Activity activity in activities) { list.Add(activity.Name, activity.ID); } } catch (Exception ex) { } finally { svr.Connection.Close(); } return(list); }
private void displayActivity() { ddlActivities.Items.Clear(); WorkflowManagementServer wms = new WorkflowManagementServer(); wms.CreateConnection(); wms.Connection.Open(ConfigurationManager.AppSettings["K2MgmCnxString"]); ddlActivities.Items.Add("Do nothing"); ddlActivities.Items.Add("---------------------"); foreach (Activity item in wms.GetProcInstActivities(int.Parse(txtProcInstanceId.Text))) { ddlActivities.Items.Add(item.Name); } wms.Connection.Close(); }
/// <summary> /// 绑定流程步骤 /// </summary> /// <param name="procInstID"></param> private void LoadSteps(int procInstID) { List <StepListItem> items = new List <StepListItem>(); WorkflowManagementServer svr = new WorkflowManagementServer(); svr.CreateConnection(); svr.Connection.Open(WorkflowHelper.GetConnString4Management()); Activities activities = svr.GetProcInstActivities(procInstID); foreach (Activity activity in activities) { items.Add(new StepListItem { Name = activity.Name, ID = activity.ID }); } rbtnListSteps.DataSource = items; rbtnListSteps.DataValueField = "ID"; rbtnListSteps.DataTextField = "Name"; rbtnListSteps.DataBind(); svr.Connection.Close(); }