以编程方式注册参与计划中的联系人

 AutomationMetadataProvider automationMetadataProvider = Assert.ResultNotNull(Factory.CreateObject("automation/metadataProvider", true) as AutomationMetadataProvider);            
 var context = AutomationManager.Provider.GetAutomationContext(ID.Parse(contact.ContactId));            
 context.Enroll(fromStateItem.ParentID, ID.Parse(fromState), automationMetadataProvider.CalculateWakeUpDateTime(ID.Parse(fromState), DateTime.UtcNow), null);
 AutomationManager.Provider.SaveAutomationContext(context);