Пример #1
0
        // this function moves the task from one column to another by removing it from it current column and adding it in the other
        // the add is done by Coulmn class.
        public InfoObject moveTask(int taskID, int status)
        {
            if (status < columnsHashTable.Count)
            {
                if (((Column)columnsHashTable[status]).isContainsKey(taskID))
                {
                    Task       t    = ((Column)columnsHashTable[status]).removeTask(taskID);
                    InfoObject info = (((Column)columnsHashTable[status + 1]).addTask(t.getTitle(), t.getDescription(), t.getDueDate(), t.getAuthor(), t.getTaskUID()));
                    if (info.getIsSucceeded())
                    {
                        t.statusUpdate();
                        t.save();
                        Log.Info("Board moving task #" + taskID + " from column #" + status + " to next column.");
                        info.setMessage("Board moving task #" + taskID + " from column #" + status + " to next column.");
                        return(info);
                    }
                    else
                    {
                        info.setIsSucceeded(false);
                        return(info);
                    }
                }
                else
                {
                    Log.Warn("Cant find Task #" + taskID + " to move from column #" + status);
                    InfoObject info3 = new InfoObject(false, "Cant find Task #" + taskID + " to move from column #" + status);
                    return(info3);
                }
            }

            Log.Error("You are not allowed to move task #" + taskID + " because it's in column #" + status);
            InfoObject info2 = new InfoObject(false, "You are not allowed to move task #" + taskID + " because it's in column #" + status);

            return(info2);
        }
 // this function checks if the current user is logged in and if he is then forward it to Board class to add the task to the current column.
 public InfoObject addTask(string title, string description, string dueDate)
 {
     if (isLoggedIn())
     {
         InfoObject info = this.lastBoardClosed.addTask(title, description, this.email, dueDate);
         if (info.getIsSucceeded())
         {
             info.setMessage("Task #" + numOfTaskAdded + " added to the board by the user: "******"You are not allowed to add a task, please log in first.");
         InfoObject info2 = new InfoObject(false, "You are not allowed to add a task, please log in first.");
         return(info2);
     }
 }