/// <summary> /// Gets the allowed activities. /// </summary> /// <param name="parentActivity">The parent activity.</param> /// <returns></returns> public ActivityMaster[] GetAllowedActivities(string parentActivityName) { foreach (ActivityRestriction item in this.Description.ActivityRestrictions) { if (item.Name == parentActivityName) { List <ActivityMaster> retVal = new List <ActivityMaster>(); foreach (string activityName in item.ChildActivities) { ActivityMaster activity = GetActivityMaster(activityName); if (activity != null) { retVal.Add(activity); } } return(retVal.ToArray()); } } // Return All Activites return(this.Description.Activities.ToArray()); }
static void Test() { SchemaMaster master = new SchemaMaster(); master.TypeName = AssemblyUtil.GetTypeString(typeof(SequentialWorkflowInstanceFactory)); master.InstanceFactory = new SequentialWorkflowInstanceFactory(); master.Description.Id = Guid.NewGuid(); master.Description.Name = "Agreement"; master.Description.Creator = "Mediachase"; master.Description.Icon = string.Empty; master.Description.Comment = string.Empty; master.Description.UI.CreateControl = string.Empty; master.Description.UI.EditControl = string.Empty; master.Description.UI.ViewControl = string.Empty; ActivityMaster create = new ActivityMaster(); create.TypeName = AssemblyUtil.GetTypeString(typeof(CreateAssignmentAndWaitResultActivityInstanceFactory)); CreateAssignmentAndWaitResultActivityInstanceFactory ifact = new CreateAssignmentAndWaitResultActivityInstanceFactory(); ifact.AssignmentProperties = new PropertyValueCollection(); ifact.AssignmentProperties.Add(new PropertyValue("Subject", "Test Subject")); ifact.AssignmentProperties.Add(new PropertyValue("UserId", 12)); create.InstanceFactory = ifact; create.Description.Name = "AgreeWith"; create.Description.Icon = string.Empty; create.Description.Comment = string.Empty; create.Description.UI.CreateControl = string.Empty; create.Description.UI.EditControl = string.Empty; create.Description.UI.ViewControl = string.Empty; ActivityMaster block = new ActivityMaster(); block.TypeName = AssemblyUtil.GetTypeString(typeof(BlockActivityInstanceFactory)); block.InstanceFactory = new BlockActivityInstanceFactory(); block.Description.Name = "AgreementBlock"; block.Description.Icon = string.Empty; block.Description.Comment = string.Empty; block.Description.UI.CreateControl = string.Empty; block.Description.UI.EditControl = string.Empty; block.Description.UI.ViewControl = string.Empty; master.Description.Activities.Add(create); master.Description.Activities.Add(block); master.Description.SupportedIbnObjectTypes.Add(16); string xml = McXmlSerializer.GetString <SchemaMaster>(master, typeof(SequentialWorkflowInstanceFactory), typeof(CreateAssignmentAndWaitResultActivityInstanceFactory), typeof(BlockActivityInstanceFactory)); }
static void Test() { SchemaMaster master = new SchemaMaster(); master.TypeName = AssemblyUtil.GetTypeString(typeof(SequentialWorkflowInstanceFactory)); master.InstanceFactory = new SequentialWorkflowInstanceFactory(); master.Description.Id = Guid.NewGuid(); master.Description.Name = "Agreement"; master.Description.Creator = "Mediachase"; master.Description.Icon = string.Empty; master.Description.Comment = string.Empty; master.Description.UI.CreateControl = string.Empty; master.Description.UI.EditControl = string.Empty; master.Description.UI.ViewControl = string.Empty; ActivityMaster create = new ActivityMaster(); create.TypeName = AssemblyUtil.GetTypeString(typeof(CreateAssignmentAndWaitResultActivityInstanceFactory)); CreateAssignmentAndWaitResultActivityInstanceFactory ifact = new CreateAssignmentAndWaitResultActivityInstanceFactory(); ifact.AssignmentProperties = new PropertyValueCollection(); ifact.AssignmentProperties.Add(new PropertyValue("Subject", "Test Subject")); ifact.AssignmentProperties.Add(new PropertyValue("UserId", 12)); create.InstanceFactory = ifact; create.Description.Name = "AgreeWith"; create.Description.Icon = string.Empty; create.Description.Comment = string.Empty; create.Description.UI.CreateControl = string.Empty; create.Description.UI.EditControl = string.Empty; create.Description.UI.ViewControl = string.Empty; ActivityMaster block = new ActivityMaster(); block.TypeName = AssemblyUtil.GetTypeString(typeof(BlockActivityInstanceFactory)); block.InstanceFactory = new BlockActivityInstanceFactory(); block.Description.Name = "AgreementBlock"; block.Description.Icon = string.Empty; block.Description.Comment = string.Empty; block.Description.UI.CreateControl = string.Empty; block.Description.UI.EditControl = string.Empty; block.Description.UI.ViewControl = string.Empty; master.Description.Activities.Add(create); master.Description.Activities.Add(block); master.Description.SupportedIbnObjectTypes.Add(16); string xml = McXmlSerializer.GetString<SchemaMaster>(master, typeof(SequentialWorkflowInstanceFactory), typeof(CreateAssignmentAndWaitResultActivityInstanceFactory), typeof(BlockActivityInstanceFactory)); }