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 List <InterfaceLayerColumn> SortByCreationDate() { List <InterfaceLayerColumn> board = new List <InterfaceLayerColumn>(); foreach (InterfaceLayerColumn col in GetBoard()) { List <InterfaceLayerTask> newCol = new List <InterfaceLayerTask>(); InterfaceLayerTask[] tasks = col.tasks.ToArray(); if (tasks.Length > 0) { for (int i = 0; i < tasks.Length; i++) { for (int j = i; j < tasks.Length; j++) { if (tasks[i].creationDate.CompareTo(tasks[j].creationDate) > 0) { InterfaceLayerTask temp = tasks[i]; tasks[i] = tasks[j]; tasks[j] = temp; } } } } for (int i = 0; i < tasks.Length; i++) { newCol.Add(tasks[i]); } board.Add(new InterfaceLayerColumn(newCol, col.colName, col.userId, col.colPlace, col.maxLength)); } return(board); }
public BoardWindowTask(InterfaceLayerTask task) { this.Title = task.Title; this.Column = task.CurrCol; this.DueDate = task.DueDate; this.CreationTime = task.CreationTime; this.Description = task.Description; }
/// <summary> /// This function is responsible for removing a task, connects between the GUI(presentation layer) and business/logic layer /// </summary> /// <param name="task"> Task object to be removed </param> /// <param name="u"> Current user </param> public void RemoveTask(InterfaceLayerTask task, string boardName) { string column = task.State; // Figure out column Board board = this.user.GetBoard(boardName); Task taskToRemove = new Task(Convert.ToDateTime(task.DueDate), task.Title, task.Description, Convert.ToDateTime(task.CreationTime), task.State); this.user.GetBoard(boardName).GetColumnByName(column).RemoveTask(taskToRemove, board.GetIndexOfColumn(board.GetColumnByName(column)), boardName, this.user.GetEmail()); }
public BoardWindowRow(InterfaceLayerTask t) { this.Title = t.Title; this.Description = t.Description; this.State = t.State; this.CreationTime = t.CreationTime; this.Duedate = t.DueDate; }
public void EditTask(InterfaceLayerTask task, string boardName) { int colNum = this.user.GetBoard(boardName).GetColumnKey(task.State); this.user.GetBoard(boardName).GetColumnByName(task.State).RemoveByCreationTime(task.CreationTime, colNum, boardName, this.user.GetEmail()); Task newTask = new Task(Convert.ToDateTime(task.DueDate), task.Title, task.Description, Convert.ToDateTime(task.CreationTime), task.State); this.user.GetBoard(boardName).GetColumnByName(task.State).AddTaskToColumn(newTask, colNum, boardName, this.user.GetEmail()); }
public BoardWindowRow(string username, InterfaceLayerTask task) { this.username = username; this.task = task; title = task.title; columnId = task.columnId; description = task.description; this.taskId = task.taskId; this.duedate = task.dueDate.ToString("dd/MM/yyy"); this.creationTime = task.creationTime.ToString("dd/MM/yyy"); }
public TaskContext(InterfaceLayerTask task, string user) { this.Title = task.Title; this.Column = task.CurrCol; this.DueDate = task.DueDate; this.CreationTime = task.CreationTime; this.Description = task.Description; UserService service = new UserService(); this.user = service.GetUser(user); this.username = user; }
private void Data_MouseDoubleClick(object sender, RoutedEventArgs e) { BoardWindowTask bwk = Tasks.SelectedItem as BoardWindowTask; if (bwk != null) { InterfaceLayerTask task = new InterfaceLayerTask(bwk.Title, bwk.Description, bwk.DueDate, bwk.CreationTime, bwk.Column); TaskWindow edit = new TaskWindow(task, email); edit.Show(); Close(); } }
public TaskWindow(InterfaceLayerTask task, string user) { InitializeComponent(); this.task = task; UserService service = new UserService(); this.user = service.GetUser(user); this.VM = new TaskContext(task, user); //format the VM this.email = user; this.DataContext = this.VM; }
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 RemoveTaskButton_Click(object sender, RoutedEventArgs e) // remove task { if (this.bwdc.Selected != null) { InterfaceLayerTask taskToRemove = new InterfaceLayerTask(this.bwdc.Selected.CreationTime, this.bwdc.Selected.Duedate, this.bwdc.Selected.Description, this.bwdc.Selected.Title, this.bwdc.Selected.State); this.service.RemoveTask(taskToRemove, this.boardName); this.bwdc.SetIB(this.service.GetIBoard(this.boardName)); } else { MessageBox.Show("No task selected"); } }
public bool PromoteTask(InterfaceLayerTask task) { UserService service = new UserService(); if (service.PromoteTaskToNextPhase(username, task)) { return(true); } else { return(false); } }
private void EditButton_Click(object sender, RoutedEventArgs e) { if (CheckDueDate()) // Due date is valid { if (!twdc.Title.Equals("") && !twdc.Description.Equals("")) { InterfaceLayerTask taskToEdit = new InterfaceLayerTask(creationTime, twdc.DueDate.ToString(), twdc.Description, twdc.Title, state); this.service.EditTask(taskToEdit, boardName); BoardWindow win = new BoardWindow(this.service, boardName); win.Show(); this.Close(); } else { MessageBox.Show("Task title and/or description can not be empty!"); } } else { MessageBox.Show("invalid date!"); } }
/// <summary> /// This function is responsible for changing state of a task, connects between the GUI(presentation layer) and business/logic layer /// </summary> /// <param name="task"> Task object to be moved to other column </param> /// <param name="u"> Current user </param> public string ChangeState(InterfaceLayerTask task, string boardName) { Board board = this.user.GetBoard(boardName); Task taskToMove = new Task(Convert.ToDateTime(task.DueDate), task.Title, task.Description, Convert.ToDateTime(task.CreationTime), task.State); if (this.user.GetBoard(boardName).GetIndexOfColumn(this.user.GetBoard(boardName).GetRightest()) > this.user.GetBoard(boardName).GetColumnKey(task.State)) { if (board.ChangeState(taskToMove, boardName, this.user.GetEmail())) { return(""); } else { Logger.GetLogger().Error("Limitation Error. Movement not allowed!!"); return("limit"); } } else // Last column { Logger.GetLogger().Error("Given task is found in last column. Movement not allowed!!"); return("last"); } }
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); } }
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)); }
private void MoveTaskButton_Click(object sender, RoutedEventArgs e) // move task to next column { if (this.bwdc.Selected != null) { InterfaceLayerTask taskToMove = new InterfaceLayerTask(this.bwdc.Selected.CreationTime, this.bwdc.Selected.Duedate, this.bwdc.Selected.Description, this.bwdc.Selected.Title, this.bwdc.Selected.State); string output = this.service.ChangeState(taskToMove, this.boardName); if (output.Equals("limit")) // movement not allowed { MessageBox.Show("Movement not allowed! [ limitation ]"); } else if (output.Equals("last")) { MessageBox.Show("Movement not allowed! [ last column ]"); } else { this.bwdc.SetIB(this.service.GetIBoard(this.boardName)); } } else { System.Windows.MessageBox.Show("No task selected"); } }