예제 #1
0
 private void OnAddTask(string obj)
 {
     if (!string.IsNullOrEmpty(NewTask))
     {
         if (TaskTypeId == 0)
         {
             NewTask = "Can't add a task. Update Task Type from widget settings";
             return;
         }
         var task = _taskService.AddNewTask(TaskTypeId, NewTask);
         var wm = new TaskViewModel(task, this);
         wm.Persist();
         NewTask = "";
     }
 }
예제 #2
0
 private void OnAddTask(string obj)
 {
     if (!string.IsNullOrWhiteSpace(NewTask) || CustomFields.Any(x => !string.IsNullOrWhiteSpace(x.Value)))
     {
         if (TaskTypeId == 0)
         {
             NewTask = "Can't add a task. Update Task Type from widget settings";
             return;
         }
         var task = _taskService.AddNewTask(TaskTypeId, NewTask, CustomFields.ToDictionary(x => x.Name, x => x.Value), !Settings.DontCreateTaskHistory);
         foreach (var customField in CustomFields)
         {
             customField.Value = "";
         }
         if (!Settings.DontCreateTaskHistory)
         {
             var wm = new TaskViewModel(task, TaskType, this, _messagingService);
             wm.Persist();
         }
         ExecuteTaskCreateCommands(task);
         NewTask = "";
         OnTaskAdded();
     }
 }