Beispiel #1
0
        public InterfaceLayerColumn GetColumn(int colPlace)
        {
            List <InterfaceLayerTask> tasks = new List <InterfaceLayerTask>();
            string colName   = "";
            int    maxLength = 0;

            foreach (Column c in kanban.GetUser().GetBoard().GetColumns())
            {
                if (c.GetPlace() == colPlace)
                {
                    colName   = c.GetName();
                    maxLength = c.GetMaxLength();
                    foreach (BusinessLayer.Task t in c.GetList())
                    {
                        string             str1 = t.GetCreationDate().ToString();
                        string             str2 = t.GetDueDate().ToString();
                        InterfaceLayerTask temp = new InterfaceLayerTask(t.GetTaskId(), t.GetTitle(), t.GetBody(), str1, str2, t.GetuserId(), t.GetColumn());
                        tasks.Add(temp);
                    }
                }
            }
            InterfaceLayerColumn col = new InterfaceLayerColumn(tasks, colName, GetuserId(), colPlace, maxLength);

            return(col);
        }
 public BoardColumnWindowRow(string username, InterfaceLayerColumn column)
 {
     this.column   = column;
     this.username = username;
     this.columnId = column.columnId;
     this.maxTask  = column.maxTask;
 }
Beispiel #3
0
        public List <InterfaceLayerColumn> GetBoard()
        {
            List <InterfaceLayerColumn> allCols = new List <InterfaceLayerColumn>();

            foreach (Column c in kanban.GetUser().GetBoard().GetColumns())
            {
                InterfaceLayerColumn col = GetColumn(c.GetName());
                allCols.Add(col);
            }
            return(allCols);
        }
        public UpdateTaskDataContext(Service service, InterfaceLayerTask task)
        {
            this.service = service;
            title        = task.taskTitle;
            body         = task.taskBody;
            dueDate      = DateTime.Parse(task.dueDate);
            creationDate = DateTime.Parse(task.creationDate);
            InterfaceLayerColumn currentCol = service.GetColumn(task.colName);
            InterfaceLayerColumn nextCol    = service.GetColumn(currentCol.colPlace + 1);

            canForward = (nextCol.colPlace <= service.GetBoard().Count) & ((nextCol.tasks.Count < nextCol.maxLength) | nextCol.maxLength == -1);
        }
        private void SetMaxLength_Click(object sender, RoutedEventArgs e)
        {
            int max = -1;

            try
            {
                max = int.Parse(boardDataContext.MaxLength);
            }
            catch (FormatException)
            {
                MessageBox.Show("Please insert a valid number");
                boardDataContext.MaxLength = "";
            }
            if (max <= 0)
            {
                MessageBox.Show("Please insert a valid positive number");
                boardDataContext.MaxLength = "";
            }

            else
            {
                if (boardDataContext.SelectedCol != null)
                {
                    InterfaceLayerColumn col = service.GetColumn(boardDataContext.SelectedCol.Name);
                    if (col.tasks.Count > max)
                    {
                        Log.Warn("The user tried to limit a column, but the column already contain more tasks than the wanted limit");
                        MessageBox.Show("There are more tasks in this column than the wanted limit.");
                    }
                    else
                    {
                        service.SetColumnMax(boardDataContext.SelectedCol.Name, max);
                        boardDataContext.ShowThread();
                        MessageBox.Show("Column's max tasks was updated.");
                        boardDataContext.SelectedCol = null;
                    }
                    boardDataContext.MaxLength = "";
                }
                else
                {
                    MessageBox.Show("Please select a column first");
                }
            }
        }
Beispiel #6
0
        public bool EditTask(InterfaceLayerTask task)
        {
            Validation  val     = new Validation();
            UserService service = new UserService();

            if (val.validateTaskInfo(Title, Description, DueDate))
            { //update the task
                InterfaceLayerTask   newTask       = new InterfaceLayerTask(Title, description, DueDate, task.CreationTime, Column);
                InterfaceLayerColumn currentColumn = user.Board.boardColumns[newTask.CurrCol];
                if (service.EditTask(task, newTask, username, task.CurrCol))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
        public InterfaceLayerBoard GetIBoard(string boardName)
        {
            List <InterfaceLayerColumn> columns = new List <InterfaceLayerColumn>();

            Board b = this.user.GetBoard(boardName);

            foreach (KeyValuePair <int, Column> pair in b.GetDictionary())
            {
                Column c = pair.Value;

                List <InterfaceLayerTask> tasks = new List <InterfaceLayerTask>();

                foreach (Task t in c.GetTasks())
                {
                    InterfaceLayerTask It = new InterfaceLayerTask(t.GetCreationTime().ToString(), t.GetDueDate().ToString(), t.GetDescription(), t.GetTitle(), t.GetState());
                    tasks.Add(It);
                }

                InterfaceLayerColumn Ic = new InterfaceLayerColumn(tasks);
                columns.Add(Ic);
            }

            return(new InterfaceLayerBoard(columns));
        }