Example #1
0
        public List <ProjectTaskInfo> GetAllTasks()
        {
            List <ProjectTaskInfo> TaskList = new List <ProjectTaskInfo>();

            using (ProductDBEntities tstDb = new ProductDBEntities())
            {
                //ProductDBEntities tstDb = new ProductDBEntities();
                var lstTask = from k in tstDb.TblTasks select k;
                foreach (var item in lstTask)
                {
                    ProjectTaskInfo _task = new ProjectTaskInfo();
                    _task.Task_Id    = item.Task_ID;
                    _task.Project_ID = item.Project_ID;
                    _task.Task       = item.Task;
                    _task.StartDate  = item.StartDate;
                    _task.EndDate    = item.EndDate;
                    _task.Priority   = item.Priority;
                    _task.Parent_ID  = item.Parent_ID;
                    _task.Project_ID = item.Project_ID;
                    _task.Status     = item.Status;
                    TaskList.Add(_task);
                }
            }

            return(TaskList);
        }
Example #2
0
        public int UpdateTask(int TaskId, bool taskStatus)
        {
            int Retval = -1;
            ProductDBEntities tstDb    = new ProductDBEntities();
            ProjectTaskInfo   tempProd = new ProjectTaskInfo();;



            TblTask result = tstDb.TblTasks.SingleOrDefault(b => b.Task_ID == TaskId);

            if (result != null)
            {
                result.Status             = taskStatus;
                tstDb.Entry(result).State = EntityState.Modified;
                Retval = tstDb.SaveChanges();
            }
            return(Retval);
        }
Example #3
0
        public ProjectTaskInfo GetTaskById(int Taskid)
        {
            ProductDBEntities tstDb  = new ProductDBEntities();
            var             lstUsr   = from k in tstDb.TblTasks where k.Task_ID == Taskid select k;
            ProjectTaskInfo TaskInfo = new ProjectTaskInfo();

            foreach (var item in lstUsr)
            {
                TaskInfo.Project_ID = item.Project_ID;
                TaskInfo.StartDate  = item.StartDate;
                TaskInfo.EndDate    = item.EndDate;
                TaskInfo.Priority   = item.Priority;
                TaskInfo.Task       = item.Task;
                TaskInfo.Parent_ID  = item.Parent_ID;
                TaskInfo.Status     = item.Status;
            }

            return(TaskInfo);
        }
Example #4
0
        public int UpdateTaskDetails(int TaskId, int ParentId, int ProjectId, string Task, DateTime StartDate, DateTime EndDate, int Priority, bool status)
        {
            int Retval = -1;
            ProductDBEntities tstDb    = new ProductDBEntities();
            ProjectTaskInfo   tempProd = new ProjectTaskInfo();;



            TblTask result = tstDb.TblTasks.SingleOrDefault(b => b.Task_ID == TaskId);

            if (result != null)
            {
                result.Parent_ID          = ParentId;
                result.Project_ID         = ProjectId;
                result.Task               = Task;
                result.StartDate          = StartDate;
                result.EndDate            = EndDate;
                result.Priority           = Priority;
                result.Status             = status;
                tstDb.Entry(result).State = EntityState.Modified;
                Retval = tstDb.SaveChanges();
            }
            return(Retval);
        }