コード例 #1
0
 public static bool CompleteBacklog(int backlogId, int?memberId)
 {
     using (var db = new ScrumApplicationDbContext())
     {
         var existTask = new ProductBacklog();
         existTask = db.ProductBacklogs.FirstOrDefault(x => x.ProductBacklogId == backlogId);
         if (!memberId.HasValue)
         {
             memberId = TeamRepository.GetUserMemberIdFromProjectId(existTask.ProjectId);
         }
         var existMember = db.Members.FirstOrDefault(x => x.MemberId == memberId);
         if (existMember != null)
         {
             if (ProjectRepository.IsUserAssigned(backlogId, existMember.MemberId) == 1)
             {
                 if (existTask.BacklogStatus < Status.Completed)
                 {
                     existTask.BacklogStatus = Status.Completed;
                 }
                 existTask.Done          = true;
                 existMember.TotalPoint += existTask.StoryPoint;
                 db.SaveChanges();
                 ActivityRepository.ActivityCreator
                     ("completed " + existTask.Name, existTask.ProjectId, existTask.ProductBacklogId);
                 return(true);
             }
         }
         return(false);
     }
 }
コード例 #2
0
        public static void AddProject(string name)
        {
            var _newProject = new Project();

            _newProject.Name = name;

            using (var db = new ScrumApplicationDbContext())
            {
                db.Projects.Add(_newProject);
                db.SaveChanges();
                ActivityRepository.ActivityCreator
                    ("created" + _newProject.Name, _newProject.ProjectId, null);
            }
        }
コード例 #3
0
        public static void AddProductBacklog(int projectId, string name)
        {
            var newTask = new ProductBacklog();

            newTask.Name      = name;
            newTask.ProjectId = projectId;
            using (var db = new ScrumApplicationDbContext())
            {
                db.ProductBacklogs.Add(newTask);
                db.SaveChanges();
            }
            ActivityRepository.ActivityCreator
                ("added " + newTask.Name + " to the project.", newTask.ProjectId, newTask.ProductBacklogId);
        }
コード例 #4
0
 public static bool UnAssignUser(int backlogId, int memberId)
 {
     using (var db = new ScrumApplicationDbContext())
     {
         if (IsUserAssigned(backlogId, memberId) == 1)
         {
             var existBTM = db.BacklogToMembers.FirstOrDefault(x => x.MemberId == memberId && x.ProductBacklogId == backlogId);
             if (existBTM != null)
             {
                 db.BacklogToMembers.Remove(existBTM);
                 db.SaveChanges();
                 var existBacklog = db.ProductBacklogs.FirstOrDefault(x => x.ProductBacklogId == backlogId);
                 ActivityRepository.ActivityCreator
                     ("unassigned " + existBTM.MemberName + " from " + existBacklog.Name,
                     existBacklog.ProjectId, existBacklog.ProductBacklogId);
                 return(true);
             }
         }
         return(false);
     }
 }