Esempio n. 1
0
        public void AddTask(CommonEntities.Tasks task)
        {
            Tasks tk = new Tasks
            {
                Task      = task.Task,
                ProjectID = task.ProjectID,
                Priority  = task.Priority,
                StartDate = task.StartDate,
                EndDate   = task.EndDate,
                Status    = false
            };

            if (task.ParentTaskID == 0)
            {
                tk.ParentTaskID = null;
            }
            else
            {
                tk.ParentTaskID = task.ParentTaskID;
            }


            _projectManager.Tasks1.Add(tk);
            _projectManager.SaveChanges();
            var taskId = tk.TaskID;
            var ur     = _projectManager.Users1.Where(x => x.UserID == task.UserID).FirstOrDefault();

            if (ur != null)
            {
                ur.TaskID = taskId;
                _projectManager.SaveChanges();
            }
        }
Esempio n. 2
0
        public void UpdateTask(CommonEntities.Tasks task)
        {
            var tk = _projectManager.Tasks1.Where(x => x.TaskID == task.TaskID).FirstOrDefault();

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

                _projectManager.SaveChanges();
                var ur = _projectManager.Users1.Where(x => x.UserID == task.UserID).FirstOrDefault();
                if (ur != null)
                {
                    ur.TaskID = tk.TaskID;
                    _projectManager.SaveChanges();
                }
            }
        }
Esempio n. 3
0
        public void EndTask(CommonEntities.Tasks task)
        {
            var tk = _projectManager.Tasks1.Where(x => x.TaskID == task.TaskID).FirstOrDefault();

            if (tk != null)
            {
                tk.Status = true;
                _projectManager.SaveChanges();
            }
        }