Rock.Web.UI.Controls.WorkflowTypePicker.SetValues C# (CSharp) Method

SetValues() public method

Sets the values.
public SetValues ( IEnumerable workflowTypes ) : void
workflowTypes IEnumerable The schedules.
return void
        public void SetValues( IEnumerable<WorkflowType> workflowTypes )
        {
            var workflowTypeList = workflowTypes.ToList();

            if ( workflowTypeList.Any() )
            {
                var ids = new List<string>();
                var names = new List<string>();
                var parentCategoryIds = string.Empty;

                foreach ( var workflowType in workflowTypeList )
                {
                    if ( workflowType != null )
                    {
                        ids.Add( workflowType.Id.ToString() );
                        names.Add( workflowType.Name );
                        var parentCategory = workflowType.Category;

                        while ( parentCategory != null )
                        {
                            parentCategoryIds += parentCategory.Id.ToString() + ",";
                            parentCategory = parentCategory.ParentCategory;
                        }
                    }
                }

                InitialItemParentIds = parentCategoryIds.TrimEnd( new[] { ',' } );
                ItemIds = ids;
                ItemNames = names;
            }
            else
            {
                ItemId = Constants.None.IdValue;
                ItemName = Constants.None.TextHtml;
            }
        }