Exemple #1
0
        /// <summary>
        /// Parsed ein Schnittstellen-Modell in einen Task
        /// </summary>
        /// <param name="taskResponse">Das Modell der Schnittstelle.</param>
        /// <returns>Ein Task-Objekt.</returns>
        public static Task Parse(TasksResponse taskResponse)
        {
            var task = new Task(taskResponse.Id, taskResponse.Name);

            task.Usergroups = new List<int>(taskResponse.Usergroups);

            foreach (var item in taskResponse.FormGroups)
            {
                if (item == null) continue;

                task.FormGroups.Add(TaskComponentGroup.Parse(item));
            }

            return task;
        }
 public void TestIfUpdateJobWithWrongFormularField()
 {
     Task task = new Task(12345, "Task 1");
     client.UpdateJob(task, 66666);
 }
 public void TestIfUpdateJobWithWrongId()
 {
     Task task = new Task(12345, "Task 1");
     client.UpdateJob(task, 1111);
 }
 public void TestIfCanUpdateJob()
 {
     Task task = new Task(12345, "Task 1");
     client.UpdateJob(task, 12345);
 }
        public TaskViewModel(Task task) : base(task)
        {
            Image = "task.png";
            Width = 90;
            Height = 90;
            Name = task.Name;

            Usergroups = new ObservableCollection<UserGroup>();
            SelectedUserGroups = new ObservableCollection<UserGroup>();
            TaskGroupComponents = new ObservableCollection<TaskComponentGroupViewModel>();
        }
        /// <summary>
        /// Ruft einen Task vom Server ab und füllt die Models mit Werten von dem aktuellen Job.
        /// </summary>
        /// <param name="taskId">Task ID.</param>
        /// <param name="jobId">Die Job ID.</param>
        public void LoadJobTask(int taskId, int jobId)
        {
            try
            {
                ErrorMessages = String.Empty;

                JobId = jobId;
                WorkflowName = ClientSession.Instance.CurrentWorkflow.Name;

                
                var task = ClientSession.Instance.RelaxoClient.GetTask(taskId);
                var jobs = ClientSession.Instance.RelaxoClient.GetJobDetail(jobId, task.Id);

                // lock job
                ClientSession.Instance.RelaxoClient.LockJob(task.Id, jobId);

                var jobValues = jobs.JobTasks.FirstOrDefault(); // kann nur ein Jobtask sein.
                currenTask = task;
                TaskName = task.Name;

                Components.Clear();
                foreach (var formGroup in task.FormGroups)
                {
                    foreach (var taskComponent in formGroup.Components)
                    {
                        var component = TaskComponentViewModelFactory.CreateAndFill(taskComponent, jobValues);
                        Components.Add(component);
                    }
                }

                IsEnabled = true;
            }
            catch (Exception ex)
            {
                ErrorMessages = string.Format("Fehler beim Laden des Tasks:\r\n{0}", ex.Message);
                Debug.Print(ErrorMessages);
                Debug.Print(ex.StackTrace);
            }
        }