Exemplo n.º 1
0
        public void EndTask(SPAProjectManager.Entities.Tasks task)
        {
            SPAProjectManagerEntities mockContext = MockDataSetList();
            var taskBL = new TaskBL(mockContext);

            taskBL.EndTask(task);
        }
Exemplo n.º 2
0
        public void AddTask(SPAProjectManager.Entities.Tasks task)
        {
            SPAProjectManager_DL.Task tk = new SPAProjectManager_DL.Task
            {
                Task_ID    = task.TaskID,
                Task1      = task.Task,
                Project_ID = task.ProjectID,
                Priority   = task.Priority,
                Start_Date = task.StartDate,
                End_Date   = task.EndDate,
                Status     = false
            };
            if (task.ParentTaskID == 0)
            {
                tk.Parent_ID = null;
            }
            else
            {
                tk.Parent_ID = task.ParentTaskID;
            }


            _spaprojectManager.Tasks.Add(tk);
            _spaprojectManager.SaveChanges();
            var taskId = tk.Task_ID;
            var ur     = _spaprojectManager.Users.Where(x => x.User_ID == task.UserID).FirstOrDefault();

            if (ur != null)
            {
                ur.Task_ID = taskId;
                _spaprojectManager.SaveChanges();
            }
        }
Exemplo n.º 3
0
        public void UpdateTask(SPAProjectManager.Entities.Tasks task)
        {
            var tk = _spaprojectManager.Tasks.Where(x => x.Task_ID == task.TaskID).FirstOrDefault();

            if (tk != null)
            {
                tk.Task1      = task.Task;
                tk.Project_ID = task.ProjectID;
                tk.Priority   = task.Priority;
                tk.Start_Date = task.StartDate;
                tk.End_Date   = task.EndDate;
                if (task.ParentTaskID == 0)
                {
                    tk.Parent_ID = null;
                }
                else
                {
                    tk.Parent_ID = task.ParentTaskID;
                }

                _spaprojectManager.SaveChanges();
                var ur = _spaprojectManager.Users.Where(x => x.User_ID == task.UserID).FirstOrDefault();
                if (ur != null)
                {
                    ur.Task_ID = tk.Task_ID;
                    _spaprojectManager.SaveChanges();
                }
            }
        }
Exemplo n.º 4
0
        public void EndTask(SPAProjectManager.Entities.Tasks task)
        {
            var tk = _spaprojectManager.Tasks.Where(x => x.Task_ID == task.TaskID).FirstOrDefault();

            if (tk != null)
            {
                tk.Status = true;
                _spaprojectManager.SaveChanges();
            }
        }
Exemplo n.º 5
0
 public IHttpActionResult EndTask([FromBody] SPAProjectManager.Models.Tasks task)
 {
     try
     {
         SPAProjectManager.Entities.Tasks tk = new SPAProjectManager.Entities.Tasks
         {
             TaskID = task.TaskID
         };
         _taskBL.EndTask(tk);
         return(Ok());
     }
     catch (Exception)
     {
         return(InternalServerError());
     }
 }
Exemplo n.º 6
0
        public IHttpActionResult UpdateTask([FromBody] SPAProjectManager.Models.Tasks task)
        {
            try
            {
                SPAProjectManager.Entities.Tasks tk = new SPAProjectManager.Entities.Tasks
                {
                    TaskID       = task.TaskID,
                    Task         = task.Task,
                    ProjectID    = task.ProjectID,
                    Priority     = task.Priority,
                    ParentTaskID = task.ParentTaskID,
                    StartDate    = task.StartDate,
                    EndDate      = task.EndDate,
                    UserID       = task.UserID
                };

                _taskBL.UpdateTask(tk);
                return(Ok());
            }
            catch (Exception)
            {
                return(InternalServerError());
            }
        }