public bool RemoveTask(int taskId)
        {
            BusinessLayer.Task t = user.GetBoard().FindTask(taskId, user.GetEmail());
            bool output          = user.GetBoard().RemoveTask(taskId, user.GetEmail());

            if (output)
            {
                taskHandler.RemoveTask(t.GetBoardId(), taskId, t.GetTitle(), t.GetBody(), t.GetCreationDate(), t.GetDueDate(), t.GetColumn());
            }
            return(output);
        }
        public bool EditTask(int taskId, string title, string body, DateTime dueDate)
        {
            BusinessLayer.Task t = user.GetBoard().FindTask(taskId, user.GetEmail());
            bool output          = user.GetBoard().EditTask(taskId, user.GetEmail(), title, body, dueDate);

            if (output)
            {
                taskHandler.UpdateTask(t.GetBoardId(), taskId, t.GetTitle(), t.GetBody(), t.GetCreationDate(), t.GetDueDate(), t.GetColumn());
            }
            return(output);
        }
        public bool MoveTask(int taskId)
        {
            BusinessLayer.Task t = user.GetBoard().FindTask(taskId, user.GetEmail());
            bool output          = user.GetBoard().MoveTask(taskId, user.GetEmail());

            if (output)
            {
                allTasks.Remove(t);
                t.SetColumn(t.GetColumn() + 1);
                allTasks.Add(t);
                taskHandler.UpdateTask(t.GetBoardId(), taskId, t.GetTitle(), t.GetBody(), t.GetCreationDate(), t.GetDueDate(), t.GetColumn());
            }
            return(output);
        }
 //Task related functions
 public bool AddTask(string title, string body, DateTime dueDate)
 {
     BusinessLayer.Task t = user.GetBoard().AddTask(title, body, dueDate);
     if (t != null)
     {
         taskHandler.AddTaskToFile(t.GetBoardId(), t.GetTaskId(), title, body, t.GetCreationDate(), t.GetDueDate(), t.GetColumn());
         allTasks.Add(t);
         return(true);
     }
     return(false);
 }
Example #5
0
        /// <summary>
        /// This function is responsible for removing a task from this column
        /// </summary>
        /// <param name="task"> Task to be removed from this column </param>
        public void RemoveTask(Task task, int columnNumber, string boardName, string email)
        {
            this.tasksList.Remove(tasksList.Find(x => x.GetTitle().Equals(task.GetTitle())));

            // Update data
            this.dataBase.RemoveTask(email, boardName, Convert.ToString(task.GetCreationTime()), Convert.ToString(task.GetDueDate()), this.colName, task.GetTitle(), task.GetDescription());
        }
Example #6
0
        /// <summary>
        ///  This function is reponsible for adding Task instance to a column
        /// </summary>
        /// <param name="task"> Task to be added to this column </param>
        public void AddTaskToColumn(Task task, int columnNumber, string boardName, string email)
        {
            if (this.rightestColumn)
            {
                task.SetInRightest(true);
            }
            this.tasksList.Add(task);

            // Update data
            this.dataBase.AddTask(email, boardName, Convert.ToString(task.GetCreationTime()), Convert.ToString(task.GetDueDate()), task.GetState(), task.GetTitle(), task.GetDescription());
        }
Example #7
0
        /// <summary>
        /// This function is responsible for changing a state of a given Task
        /// </summary>
        /// <param name="task"> Task instance to be moved </param>
        public bool ChangeState(Task task, string boardName, string email)
        {
            string currCol = task.GetState(); // string that represents current state or column, for example : "backlog"
            // Get index of current column
            int    currentIndex = this.columns.FirstOrDefault(x => ((Column)x.Value).GetColumnName().Equals(currCol)).Key;
            Column currentCol   = this.columns[currentIndex];

            if (!(currentIndex == this.columns.Keys.Last()))  // Checking whether the state changing occurs in the next column
            {
                int    movingIndex = currentIndex + 1;
                Column movingCol   = this.columns[movingIndex];

                if ((movingCol.GetIsLimited() && movingCol.GetTasks().Count < movingCol.GetLim()) || (!movingCol.GetIsLimited()))
                {
                    task.SetState(movingCol.GetColumnName());
                    movingCol.AddTaskToColumn(task, movingIndex, boardName, email);
                    currentCol.RemoveTask(task, currentIndex, boardName, email);
                    this.dataBase.MoveTask(email, boardName, Convert.ToString(task.GetCreationTime()), Convert.ToString(task.GetDueDate()), currCol, task.GetTitle(), task.GetDescription(), movingCol.GetColumnName());
                    return(true);
                }
                else
                {
                    Logger.GetLogger().Error("changing state couldn't been preformed.Limitation error!!");
                    return(false);
                }
            }
            else
            {
                Logger.GetLogger().Error("Can't move task from last column");
                return(false);
            }
        }