Ejemplo n.º 1
0
        public void loadData()
        {
            listSubTaskGridView.DataSource = null;
            listSubTaskGridView.Rows.Clear();
            listSubTaskGridView.Refresh();
            try
            {
                List <Subtask> listSubTask = SubtaskController.GetSubtasksForTask(user, task.taskID);

                //begin for grid data
                listSubTaskGridView.AutoGenerateColumns = true;
                listSubTaskGridView.AutoResizeColumns();// = true;
                listSubTaskGridView.DataSource = listSubTask;
                //hide some columns
                listSubTaskGridView.Columns[0].Visible = false;
                listSubTaskGridView.Columns[1].Visible = false;
                listSubTaskGridView.Columns[8].Visible = false;
                listSubTaskGridView.Columns[6].Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
                this.BeginInvoke(new MethodInvoker(Close));
            }
        }
Ejemplo n.º 2
0
 /*
  * Updates tasks and subtasks to complete or incomplete in the database
  * based on the current checked status
  */
 private void taskTreeView_BeforeCheck(object sender, TreeViewCancelEventArgs e)
 {
     // Check whether the node is a task or a subtask
     // in order to decide which update statements to call
     if (e.Node.Parent == null)
     {
         Models.Task tag = (Models.Task)e.Node.Tag;
         if (e.Node.Checked == false)
         {
             TaskController.updateTaskCompleted(tag.taskID);
             List <Subtask> subtasks = SubtaskController.GetSubtasksForTask(user, tag.taskID);
             foreach (Subtask st in subtasks)
             {
                 if (st.st_CompleteDate == DateTime.MaxValue)
                 {
                     SubtaskController.UpdateSubtaskToCompleted(st.subtaskID);
                 }
             }
             foreach (TreeNode node in e.Node.Nodes)
             {
                 node.Checked = true;
             }
         }
         else if (e.Node.Checked == true)
         {
             TaskController.updateTaskIncomplete(tag.taskID);
         }
     }
     else
     {
         Subtask subTag = (Subtask)e.Node.Tag;
         if (e.Node.Checked == false)
         {
             SubtaskController.UpdateSubtaskToCompleted(subTag.subtaskID);
         }
         else if (e.Node.Checked == true)
         {
             SubtaskController.UpdateSubtaskToIncomplete(subTag.subtaskID);
         }
     }
 }
Ejemplo n.º 3
0
        /* Currently unused */
        //private void tasksBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        //{
        //    this.Validate();
        //    this.tasksBindingSource.EndEdit();
        //    this.tableAdapterManager.UpdateAll(this.project6920DataSet);
        //}


        /*
         * Populate the task tree view with tasks and subtasks
         */
        private void populateTaskTreeView()
        {
            //this.tasks = TaskController.getUserTasks(user, parentCalendar.getSelectedDate());
            taskTreeView.ShowLines = false;
            //taskTreeView.AfterCheck -= taskTreeView_AfterCheck;

            // Add tasks to the list
            foreach (Models.Task task in this.tasks)
            {
                taskTreeView.Nodes.Add(task.title);
                TreeNode currentNode = taskTreeView.Nodes[this.tasks.FindIndex(a => a.taskID == task.taskID)];
                currentNode.Tag = task;

                // Mark complete tasks with a checked box
                if (task.completed == true)
                {
                    currentNode.Checked = true;
                }

                // Set font color to indicate priority
                if (task.task_priority == 1)
                {
                    currentNode.ForeColor = Color.Red;
                }
                else if (task.task_priority == 2)
                {
                    currentNode.ForeColor = Color.Orange;
                }
                if (task.isMeeting == 1)
                {
                    currentNode.ForeColor = Color.Blue;
                }

                // Add details tooltip
                String priority = "";
                if (task.task_priority == -1)
                {
                    priority = "None";
                }
                else if (task.task_priority == 1)
                {
                    priority = "High";
                }
                else if (task.task_priority == 2)
                {
                    priority = "Medium";
                }
                else
                {
                    priority = "Low";
                }

                string deadline = "";
                if (task.deadline == DateTime.MaxValue)
                {
                    deadline = "None";
                }
                else
                {
                    deadline = task.deadline.ToString();
                }
                currentNode.ToolTipText = "Deadline: " + deadline + "\n" +
                                          "Priority: " + priority + "\n" +
                                          "Notes: " + this.getNoteString(task.taskID, -1);
                taskTreeView.ShowNodeToolTips = true;

                // Get all subtasks for the current task
                List <Subtask> subtasks = SubtaskController.GetSubtasksForTask(user, task.taskID);

                // Add each subtask as a nested node
                foreach (Subtask st in subtasks)
                {
                    currentNode.Nodes.Add(st.st_Description);
                    currentNode.Nodes[subtasks.FindIndex(b => b.subtaskID == st.subtaskID)].Tag = st;
                    // Add details tooltip
                    String st_priority = "";
                    if (st.st_Priority == -1)
                    {
                        st_priority = "None";
                    }
                    else if (st.st_Priority == 1)
                    {
                        st_priority = "High";
                    }
                    else if (st.st_Priority == 2)
                    {
                        st_priority = "Medium";
                    }
                    else
                    {
                        st_priority = "Low";
                    }

                    string subtaskdeadline = "";
                    if (st.st_Deadline == DateTime.MaxValue)
                    {
                        subtaskdeadline = "None";
                    }
                    else
                    {
                        subtaskdeadline = st.st_Deadline.ToString();
                    }
                    currentNode.Nodes[subtasks.FindIndex(b => b.subtaskID == st.subtaskID)].ToolTipText = "Deadline: " + subtaskdeadline + "\n" +
                                                                                                          "Priority: " + st_priority + "\n" +
                                                                                                          "Notes: " + this.getNoteString(task.taskID, st.subtaskID);

                    // Mark completed subtasks with a checked box
                    if (st.st_CompleteDate != DateTime.MaxValue)
                    {
                        currentNode.Nodes[subtasks.FindIndex(b => b.subtaskID == st.subtaskID)].Checked = true;
                    }
                }
            }

            taskTreeView.BeforeCheck += taskTreeView_BeforeCheck;
        }