Exemplo n.º 1
0
        public void Init()
        {
            tasksResponse = new TasksResponse
            {
                Id = 12345,
                Name = "Das ist ein Testfeld"
            };

            var formGroup = new TaskComponentGroupResponse
            {
                Id = 156,
                Name = "Test 1"

            };

            tasksResponse.FormGroups.Add(formGroup);
            tasksResponse.Usergroups = new System.Collections.Generic.List<int>();
            formGroup.Components.Add(new TextInputResponse
            {
                Id = 5555,
                Name = "Testfeld 1",
                DefaultValue = "DefaultValue",
                Order = 1,
                RegexPattern = "REGEX",
                Comment = "Kommentar zu 5555",
                Required = true,
                Type = ComponentType.TaskComponentText
            });
        }
        /// <summary>
        /// Parsed ein Schnittstellen-Modell in einen Task
        /// </summary>
        /// <param name="taskComponentGroupResponse">Das Modell der Schnittstelle.</param>
        /// <returns>Ein Task-Objekt.</returns>
        public static TaskComponentGroup Parse(TaskComponentGroupResponse taskComponentGroupResponse)
        {
            var taskComponentGroup = new TaskComponentGroup(taskComponentGroupResponse.Id, taskComponentGroupResponse.Name);

            foreach (var item in taskComponentGroupResponse.Components)
            {
                if (item == null) continue;

                var component = GetTaskComponent(item);
                component.FormGroup = taskComponentGroup;
                taskComponentGroup.Components.Add(component);
            }

            return taskComponentGroup;
        }