/// <summary> /// Gets the task for a given task id /// </summary> /// <param name="taskid">The task id</param> /// <returns>The task object</returns> public ToDoTasks GetTasks(int taskid) { ToDoTasks task = new ToDoTasks(); task = this.iRepsoitory.FindBy(taskid); return(task); }
public void UpdateTaskCollections() { if (LoadedProject.Tasks != null) { ToDoTasks.Clear(); InProgressTasks.Clear(); CompletedTasks.Clear(); foreach (ProjectTask task in LoadedProject.Tasks) { switch (task.Stage) { case Stage.ToDo: ToDoTasks.Add(task); break; case Stage.InProgress: InProgressTasks.Add(task); break; case Stage.Completed: CompletedTasks.Add(task); break; default: break; } } } }
public void CrossOut(ToDoTasks task) { int value = (int)task; listMeshes[value].fontStyle = FontStyles.Strikethrough; sound.Play(); }
public void DeleteTask(long id) { //var result = ent.ToDoTasks.Where(x => x.TaskId == id).FirstOrDefault(); ToDoTasks result = ent.ToDoTasks.Where(x => x.TaskId == id).FirstOrDefault(); ent.DeleteObject(result); ent.SaveChanges(); }
public ToDoTasks GetTasks(int taskId) { ToDoTasks task = new ToDoTasks(); ToDoTaskRepository toDoTask = new ToDoTaskRepository(this.iRepository); task = toDoTask.GetTasks(taskId); return(task); }
public void UpdateTask_Assert_CallsSave() { IRepository <ToDoTasks, int> iRepository = Substitute.For <IRepository <ToDoTasks, int> >(); ToDoTasks toDoTask = new ToDoTasks(); ToDoTaskRepository toDoRepository = new ToDoTaskRepository(iRepository); toDoRepository.UpdateTask(toDoTask); iRepository.Received().Save(toDoTask); }
public void SaveNew_Assert_CallsAdd() { IRepository <ToDoTasks, int> iRepository = Substitute.For <IRepository <ToDoTasks, int> >(); ToDoTasks toDoTask = new ToDoTasks(); ToDoTaskRepository toDoRepository = new ToDoTaskRepository(iRepository); toDoRepository.SaveNew(toDoTask); iRepository.Received().Add(toDoTask); }
private void ToDoList2_ItemClick(object sender, ItemClickEventArgs e) { CurrentItem = (ToDoTasks)e.ClickedItem; ToDo_Picker.Date = null; ToDoRemarkTextBox.Text = ""; if (!CurrentItem.Date.Equals("")) { ToDo_Picker.Date = Convert.ToDateTime(CurrentItem.Date); } ToDoRemarkTextBox.Text = CurrentItem.Remark; TaskCard.IsOpen = true; }
public void GetTasksForUser_InCorrectUserID_ReturnsNullResult() { IRepository <ToDoTasks, int> iRepository = Substitute.For <IRepository <ToDoTasks, int> >(); ToDoTasks taskExpected = null; iRepository.FindBy(Arg.Compat.Any <int>()).Returns <ToDoTasks>(taskExpected); ToDoTaskRepository toDoRepository = new ToDoTaskRepository(iRepository); ToDoTasks taskActual = toDoRepository.GetTasks(8); Assert.Equal(taskExpected, taskActual); }
public void SaveTask(TodoTaskModel model) { ToDoTasks obj = new ToDoTasks(); obj.UserId = model.userId; obj.TaskName = model.taskName; obj.TaskDate = DateTime.Now;//model.taskDate; obj.TaskTime = model.taskTime; obj.CreatedDate = model.createdDate; obj.isComplete = model.isComplete; obj.TaskDescription = "Hello";//model.taskDescription; ent.AddToToDoTasks(obj); ent.SaveChanges(); }
private void ToDoList2_RightTapped(object sender, RightTappedRoutedEventArgs e) { CurrentItem = (e.OriginalSource as FrameworkElement)?.DataContext as ToDoTasks; if (CurrentItem.StarVisibility == Visibility.Visible) { StarButton2.Visibility = Visibility.Collapsed; UnStarButton2.Visibility = Visibility.Visible; } else { StarButton2.Visibility = Visibility.Visible; UnStarButton2.Visibility = Visibility.Collapsed; } }
public void GetTasksForUser_CheckParameters_ReturnsPredictedResult() { IRepository <ToDoTasks, int> iRepository = Substitute.For <IRepository <ToDoTasks, int> >(); ToDoTasks taskExpected = new ToDoTasks { TaskUserId = 1 }; iRepository.FindBy(Arg.Compat.Any <int>()).Returns <ToDoTasks>(taskExpected); ToDoTaskRepository toDoRepository = new ToDoTaskRepository(iRepository); ToDoTasks taskActual = toDoRepository.GetTasks(8); Assert.Equal(taskExpected, taskActual); }
public void MoveTask(Status from, Status to, Task task, int index) { task.Status = to; switch (from) { case Status.ToDo: ToDoTasks.Remove(task); break; case Status.InProgress: InProgressTasks.Remove(task); break; case Status.Review: InReviewTasks.Remove(task); break; case Status.Completed: CompletedTasks.Remove(task); break; } switch (to) { case Status.ToDo: ToDoTasks.Insert(index, task); HandleReorder(ToDoTasks, task, index, false); break; case Status.InProgress: InProgressTasks.Insert(index, task); HandleReorder(InProgressTasks, task, index, false); break; case Status.Review: InReviewTasks.Insert(index, task); HandleReorder(InReviewTasks, task, index, false); break; case Status.Completed: CompletedTasks.Insert(index, task); HandleReorder(CompletedTasks, task, index, false); break; } DataAccess.UpdateTask(task); }
public async System.Threading.Tasks.Task LoadDataAsync() { ToDoTasks.Clear(); InProgressTasks.Clear(); InReviewTasks.Clear(); CompletedTasks.Clear(); var tasks = await DataAccess.GetTasks(true); foreach (var task in tasks) { Tasks.Add(task); if (!task.SprintRelevant) { continue; } switch (task.Status) { case Status.ToDo: ToDoTasks.Add(task); break; case Status.InProgress: InProgressTasks.Add(task); break; case Status.Review: InReviewTasks.Add(task); break; case Status.Completed: CompletedTasks.Add(task); break; } } ToDoTasks.CollectionChanged += CollectionChanged; InProgressTasks.CollectionChanged += CollectionChanged; InReviewTasks.CollectionChanged += CollectionChanged; CompletedTasks.CollectionChanged += CollectionChanged; }
public void GetTasks_InCorrectParameters_ReturnsCorrectObject() { IRepository <ToDoTasks, int> iRepository = Substitute.For <IRepository <ToDoTasks, int> >(); ToDoTasks toDoTaskExpected = new ToDoTasks { CheckedDone = false, LastUpdated = System.DateTime.Now, TaskDescription = "someDescription", TaskUserId = 1, ToDoTaskId = 1 }; iRepository.FindBy(1).Returns(toDoTaskExpected); ToDoTask toDoTasks = new ToDoTask(iRepository); ToDoTasks taskUserActual = toDoTasks.GetTasks(2); Assert.Null(taskUserActual); }
public void Save_CorrectParameters_CallsSaveNew() { IRepository <ToDoTasks, int> iRepository = Substitute.For <IRepository <ToDoTasks, int> >(); ToDoTasks toDoTask = new ToDoTasks { CheckedDone = false, LastUpdated = System.DateTime.Now, TaskDescription = "someDescription", TaskUserId = 1, ToDoTaskId = 1 }; ToDoTask toDoTasks = new ToDoTask(iRepository); ToDoTaskRepository toDoTaskRepo = new ToDoTaskRepository(iRepository); toDoTaskRepo.UpdateTask(toDoTask); iRepository.Received().Save(toDoTask); }
private void SaveSelected() { DataAccess.UpdateTask(Selected); int index; switch (Selected.Status) { case Status.ToDo: index = ToDoTasks.IndexOf(Selected); if (index >= 0) { ToDoTasks[index] = Selected; } break; case Status.InProgress: index = InProgressTasks.IndexOf(Selected); if (index >= 0) { InProgressTasks[index] = Selected; } break; case Status.Review: index = InReviewTasks.IndexOf(Selected); if (index >= 0) { InReviewTasks[index] = Selected; } break; case Status.Completed: index = CompletedTasks.IndexOf(Selected); if (index >= 0) { CompletedTasks[index] = Selected; } break; } }
public string GetTaskDescription(ToDoTasks task) { switch (task) { case ToDoTasks.SUPERMARKET: return("Pick up food at the supermarket."); case ToDoTasks.BLACKSMITH: return("Pick up new bangles from the blacksmith."); case ToDoTasks.CHURCH: return("Receive a blessing from the holy church."); case ToDoTasks.TAXCOLLECTION: return("Shake down a peasant who hasn't paid his taxes."); case ToDoTasks.ATTENDEXECUTION: return("Attend the execution of a heretic."); default: return(null); } }
public void DeleteSelected() { DataAccess.DeleteTask(Selected); switch (Selected.Status) { case Status.ToDo: ToDoTasks.Remove(Selected); break; case Status.InProgress: InProgressTasks.Remove(Selected); break; case Status.Review: InReviewTasks.Remove(Selected); break; case Status.Completed: CompletedTasks.Remove(Selected); break; } Selected = null; }
public UsersController(ToDoTasks taskMngr) { tasks = taskMngr.GetAll(); _taskMngr = taskMngr; }
public void Del(ToDoTasks toDoTask) { ToDoTaskRepository toDoTaskRepo = new ToDoTaskRepository(this.iRepository); toDoTaskRepo.Del(toDoTask); }
public void UpdateTask(ToDoTasks existingTask) { ToDoTaskRepository toDoTask = new ToDoTaskRepository(this.iRepository); toDoTask.UpdateTask(existingTask); }
public void SaveNew(ToDoTasks newTask) { ToDoTaskRepository toDoTask = new ToDoTaskRepository(this.iRepository); toDoTask.SaveNew(newTask); }
public void AddTask(ToDoTask task) { ToDoTasks.Add(task); }
/// <summary> /// Deletes a task object from the database /// </summary> /// <param name="toDoTask">The task object to remove from thwe database</param> public void Del(ToDoTasks toDoTask) { this.iRepsoitory.Remove(toDoTask); }
/// <summary> /// Updates a task object to the database /// </summary> /// <param name="newTask">The task object to update.</param> public void UpdateTask(ToDoTasks newTask) { this.iRepsoitory.Save(newTask); }
/// <summary> /// Save a new task object to the database /// </summary> /// <param name="newTask">The task object to save.</param> public void SaveNew(ToDoTasks newTask) { this.iRepsoitory.Add(newTask); }