Пример #1
0
   public void InsertOrUpdate(ProjectStatus ProjectStatus)
 {
     if (ProjectStatus.ProjectStatusID == default(long)) {
         // New entity
         context.ProjectStatuses.Add(ProjectStatus);
     } else {
         // Existing entity
         context.Entry(ProjectStatus).State = System.Data.Entity.EntityState.Modified;
     }
 }
Пример #2
0
        public PartialViewResult EditStatus(ProjectStatus projectcol)
        {
            unitOfWork.ProjectStatusRepository.InsertOrUpdate(projectcol);
            unitOfWork.Save();
            List<Task> taskList = unitOfWork.TaskRepository.ByProjectIncluding(projectcol.ProjectID, task => task.Project).Include(task => task.Priority).Include(task => task.ChildTask).Include(task => task.Users).Include(task => task.Followers).Include(task => task.Labels).ToList();
            ViewBag.CurrentProject = unitOfWork.ProjectRepository.Find(projectcol.ProjectID);
            //string newlyaddedStatus = "";
            //string previousStatus = "";
            //Project projectOld = unitOfWork.ProjectRepository.Find(project.ProjectID);

            //List<string> oldStatus = projectOld.allStatus.Split(',').ToList();
            //List<string> newStatus = project.allStatus.Split(',').ToList();
            //int i = 0;
            //foreach (string item in newStatus)
            //{
            //    if (!oldStatus.Contains(item))
            //    {

            //        newlyaddedStatus = item;
            //        previousStatus = oldStatus[i];
            //        break;
            //    }
            //    i++;
            //}
            //List<Task> taskList = new List<Task>();
            //try
            //{
            //    projectOld.allStatus = project.allStatus;
            //    unitOfWork.ProjectRepository.InsertOrUpdate(projectOld);
            //    unitOfWork.Save();

            //    ViewBag.CurrentProject = projectOld;
            //    List<string> statusList = new List<string>();
            //    if (!string.IsNullOrEmpty(project.allStatus))
            //    {
            //        statusList = project.allStatus.Split(',').ToList();
            //    }
            //    ViewBag.AllStatus = statusList;
            //    taskList = unitOfWork.TaskRepository.ByProjectAndStatusIncluding(project.ProjectID, previousStatus, task => task.Project).Include(task => task.Priority).Include(task => task.ChildTask).Include(task => task.Users).Include(task => task.Followers).Include(task => task.Labels).ToList();
            //    foreach (Task task in taskList)
            //    {
            //        task.Status = newlyaddedStatus;
            //        unitOfWork.Save();
            //    }
            //    taskList = unitOfWork.TaskRepository.ByProjectIncluding(project.ProjectID, task => task.Project).Include(task => task.Priority).Include(task => task.ChildTask).Include(task => task.Users).Include(task => task.Followers).Include(task => task.Labels).ToList();
            //}
            //catch
            //{
            //}
            return PartialView("_Kanban", taskList);
        }
Пример #3
0
 public PartialViewResult CreateStatus(ProjectStatus projectcol)
 {
     unitOfWork.ProjectStatusRepository.InsertOrUpdate(projectcol);
     unitOfWork.Save();
     List<Task> taskList = unitOfWork.TaskRepository.ByProjectIncluding(projectcol.ProjectID, task => task.Project).Include(task => task.Priority).Include(task => task.ChildTask).Include(task => task.Users).Include(task => task.Followers).Include(task => task.Labels).ToList();
     ViewBag.CurrentProject = unitOfWork.ProjectRepository.Find(projectcol.ProjectID);
     //Project projectOld = unitOfWork.ProjectRepository.Find(project.ProjectID);
     //List<Task> taskList = new List<Task>();
     //try
     //{
     //    projectOld.allStatus = project.allStatus;
     //    unitOfWork.ProjectRepository.InsertOrUpdate(projectOld);
     //    unitOfWork.Save();
     //    taskList = unitOfWork.TaskRepository.ByProjectIncluding(project.ProjectID, task => task.Project).Include(task => task.Priority).Include(task => task.ChildTask).Include(task => task.Users).Include(task => task.Followers).Include(task => task.Labels).ToList();
     //    foreach (Task task in taskList)
     //    {
     //        task.Status = string.Empty;
     //        unitOfWork.Save();
     //    }
     //    ViewBag.CurrentProject = projectOld;
     //    List<string> statusList = new List<string>();
     //    if (!string.IsNullOrEmpty(project.allStatus))
     //    {
     //        statusList = project.allStatus.Split(',').ToList();
     //    }
     //    ViewBag.AllStatus = statusList;
     //}
     //catch
     //{
     //}
     return PartialView("_Kanban", taskList);
 }
Пример #4
0
 public PartialViewResult CreateStatus(long id)
 {
     ProjectStatus projectCol = new ProjectStatus();
     projectCol.ProjectID = id;
     return PartialView(projectCol);
 }
Пример #5
0
        private void AddProjectStatus(Project project)
        {
            unitOfWork.ProjectStatusRepository.DeletebyProjectID(project.ProjectID);

            List<string> statuses = new List<string>();
            if (!string.IsNullOrEmpty(project.allStatus))
            {
                statuses = project.allStatus.Split(',').Distinct().ToList();
                foreach (string status in statuses)
                {
                    if (!string.IsNullOrEmpty(status))
                    {
                        ProjectStatus col = new ProjectStatus();
                        col.Name = status;
                        col.ProjectID = project.ProjectID;
                        unitOfWork.ProjectStatusRepository.InsertOrUpdate(col);
                    }
                }
            }
        }