Ejemplo n.º 1
0
        /// <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();
    }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        public ToDoTasks GetTasks(int taskId)
        {
            ToDoTasks task = new ToDoTasks();

            ToDoTaskRepository toDoTask = new ToDoTaskRepository(this.iRepository);

            task = toDoTask.GetTasks(taskId);
            return(task);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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();
        }
Ejemplo n.º 11
0
 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;
     }
 }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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;
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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);
        }
    }
Ejemplo n.º 19
0
        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;
        }
Ejemplo n.º 20
0
 public UsersController(ToDoTasks taskMngr)
 {
     tasks     = taskMngr.GetAll();
     _taskMngr = taskMngr;
 }
Ejemplo n.º 21
0
        public void Del(ToDoTasks toDoTask)
        {
            ToDoTaskRepository toDoTaskRepo = new ToDoTaskRepository(this.iRepository);

            toDoTaskRepo.Del(toDoTask);
        }
Ejemplo n.º 22
0
        public void UpdateTask(ToDoTasks existingTask)
        {
            ToDoTaskRepository toDoTask = new ToDoTaskRepository(this.iRepository);

            toDoTask.UpdateTask(existingTask);
        }
Ejemplo n.º 23
0
        public void SaveNew(ToDoTasks newTask)
        {
            ToDoTaskRepository toDoTask = new ToDoTaskRepository(this.iRepository);

            toDoTask.SaveNew(newTask);
        }
Ejemplo n.º 24
0
 public void AddTask(ToDoTask task)
 {
     ToDoTasks.Add(task);
 }
Ejemplo n.º 25
0
 /// <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);
 }
Ejemplo n.º 26
0
 /// <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);
 }
Ejemplo n.º 27
0
 /// <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);
 }