コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("SubTaskId,SubTaskName,SubDescription,SubStartDate,SubFinishDate,SubState,TaskId")] SubTaskItem subTaskItem)
        {
            if (id != subTaskItem.SubTaskId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(subTaskItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubTaskItemExists(subTaskItem.SubTaskId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                updateTaskItemState(subTaskItem.TaskId);
                return(RedirectToAction("Index", new { id = subTaskItem.TaskId }));
            }
            return(View(subTaskItem));
        }
コード例 #2
0
    private void _addSubTask(SubTask subTask)
    {
        // get prefab from objectpool
        GameObject subTaskGameObject = _pool.GetObject();

        // attach to subTaskGroup LayoutGroup
        subTaskGameObject.transform.SetParent(_subTaskGroup.transform);

        // Set parameters
        SubTaskItem subTaskItem = subTaskGameObject.GetComponent <SubTaskItem>();

        subTaskItem.SetId(subTask.Id);
        subTaskItem.SetText(subTask.Title + "[" + subTask.Id + "]");
        subTaskItem.SetBonus(subTask.IsBonus);
        subTaskItem.SetStatus(subTask.Status);
        subTaskItem.SetPrechecked(subTask.Status);

        // Set buttons and data (Help should always be avalible)
        subTaskItem.SetAvalibeButtons((subTask.Warning != null), (subTask.Tools != null), (subTask.Information != null), true);
        if (subTask.Tools != null)
        {
            subTaskItem.Tools = subTask.Tools;
        }
        if (subTask.Warning != null)
        {
            subTaskItem.Warning = subTask.Warning;
        }
        if (subTask.Information != null)
        {
            subTaskItem.Info = subTask.Information;
        }

        // Add to private list for removal later
        _subTaskList.Add(subTaskGameObject);
    }
コード例 #3
0
ファイル: ReportService.cs プロジェクト: PiSim/LDb2
        public IEnumerable <TaskItem> GenerateTaskItemList(IEnumerable <Requirement> reqList)
        {
            List <TaskItem> output = new List <TaskItem>();

            foreach (Requirement req in reqList)
            {
                TaskItem tempItem = new TaskItem();

                tempItem.Description            = req.Description;
                tempItem.MethodID               = req.MethodVariant.Method.ID;
                tempItem.Name                   = req.Name;
                tempItem.Position               = 0;
                tempItem.RequirementID          = req.ID;
                tempItem.SpecificationVersionID = req.SpecificationVersionID;

                foreach (SubRequirement sreq in req.SubRequirements)
                {
                    SubTaskItem tempSubItem = new SubTaskItem();

                    tempSubItem.Name             = sreq.SubMethod.Name;
                    tempSubItem.RequiredValue    = sreq.RequiredValue;
                    tempSubItem.SubMethodID      = sreq.SubMethodID;
                    tempSubItem.SubRequirementID = sreq.ID;
                    tempSubItem.UM = sreq.SubMethod.UM;

                    tempItem.SubTaskItems.Add(tempSubItem);
                }

                output.Add(tempItem);
            }

            return(output);
        }
コード例 #4
0
ファイル: SubTasksView.cs プロジェクト: tzmtnh/FeedMyFly
    protected override void OnItemDoubleClicked(BaseItem <SubTask> item)
    {
        SubTaskItem subtaskItem = (SubTaskItem)item;

        if (subtaskItem.subtask.deadlineState == ViewManager.DeadlineState.Future)
        {
            return;
        }

        subtaskItem.subtask.done = !subtaskItem.subtask.done;
        subtaskItem.Refresh();
    }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("SubTaskId,SubTaskName,SubDescription,SubStartDate,SubFinishDate,SubState,TaskId")] SubTaskItem subTaskItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subTaskItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", new { id = subTaskItem.TaskId }));
            }

            updateTaskItemState(subTaskItem.TaskId);
            return(View(subTaskItem));
        }
コード例 #6
0
    // refreshes sliders
    public void RefreshProgress()
    {
        // counting variables
        float regularTotal, regularCompleted, bonusTotal, bonusCompleted;

        regularTotal = regularCompleted = bonusTotal = bonusCompleted = 0f;

        // get data [0-100] % TODO: Might need to change to check acutal model when data is persistent on server
        foreach (GameObject g in _subTaskList)
        {
            SubTaskItem subTask = g.GetComponent <SubTaskItem> ();
            if (!subTask.IsBonus)
            {
                if (subTask.Status == Status.Completed)
                {
                    regularCompleted++;
                }
                regularTotal++;
            }
            else
            {
                if (subTask.Status == Status.Completed)
                {
                    bonusCompleted++;
                }
                bonusTotal++;
            }
        }

        // fill sliders TODO: Better handlning if no subtasks of type?
        if (regularTotal == 0)
        {
            _regularSlider.gameObject.SetActive(false);
        }
        else
        {
            _regularSlider.gameObject.SetActive(true);
            _regularSlider.value = (regularCompleted / regularTotal);
        }
        if (bonusTotal == 0)
        {
            _bonusSlider.gameObject.SetActive(false);
        }
        else
        {
            _bonusSlider.gameObject.SetActive(true);
            _bonusSlider.value = (bonusCompleted / bonusTotal);
        }
    }