Exemplo n.º 1
0
 public void addUser(User user)
 {
     using (var context = new ThemisContext())
     {
         context.Users.Add(user);
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public UserStory AddUserStory(UserStory story)
 {
     using (var context = new ThemisContext())
     {
         context.UserStories.Add(story);
         context.SaveChanges();
     }
     return(story);
 }
Exemplo n.º 3
0
 public User DeleteInvitation(String projectName, String invitedUser)
 {
     using (var context = new ThemisContext())
     {
         var declinedInvitation = context.Invitation.Where(i => i.username.Equals(invitedUser) && i.Name.Equals(projectName));
         context.Invitation.Remove(declinedInvitation.FirstOrDefault());
         context.SaveChanges();
         return(context.Users.Find(invitedUser));
     }
 }
Exemplo n.º 4
0
 public Sprint CreateSprint(string projectName, int number)
 {
     using (var context = new ThemisContext())
     {
         context.Sprints.Add(new Sprint()
         {
             Name = projectName, Number = number
         });
         context.SaveChanges();
         return(GetSprint(projectName, number));
     }
 }
Exemplo n.º 5
0
 public UserStory[] EditDescription(string projectName, string oldDescription, string newDescription)
 {
     using (var context = new ThemisContext())
     {
         var userStory = context.UserStories.Where(u => u.Name.Equals(projectName) && u.Description.Equals(oldDescription)).FirstOrDefault();
         if (userStory != null)
         {
             userStory.Description = newDescription;
         }
         context.Entry(userStory).State = EntityState.Modified;
         context.SaveChanges();
         return(GetUserStoriesForProject(projectName));
     }
 }
Exemplo n.º 6
0
 public User AddInvitation(string projectName, string invitedUser)
 {
     using (var context = new ThemisContext())
     {
         var invitation = new InvitationModel()
         {
             Name     = projectName,
             username = invitedUser
         };
         context.Invitation.Add(invitation);
         context.SaveChanges();
         return(context.Users.Find(invitedUser));
     }
 }
Exemplo n.º 7
0
 public BackLogItem SetSprintId(int backlogId, int sprintId)
 {
     using (var context = new ThemisContext())
     {
         var backlogItem = context.BackLogItems.Find(backlogId);
         if (backlogItem != null)
         {
             backlogItem.SprintId = sprintId;
         }
         context.Entry(backlogItem).State = EntityState.Modified;
         context.SaveChanges();
         return(backlogItem);
     }
 }
Exemplo n.º 8
0
 public BackLogItem EditDescription(int backlogId, string newDescription)
 {
     using (var context = new ThemisContext())
     {
         var backlog = context.BackLogItems.Find(backlogId);
         if (backlog != null)
         {
             backlog.Description = newDescription;
         }
         context.Entry(backlog).State = EntityState.Modified;
         context.SaveChanges();
         return(backlog);
     }
 }
Exemplo n.º 9
0
 public Sprint SetActualTime(int backlogId, int actualTime)
 {
     using (var context = new ThemisContext())
     {
         var backlog = context.BackLogItems.Find(backlogId);
         if (backlog != null)
         {
             backlog.ActualTime = actualTime;
             backlog.Status     = "Done";
         }
         context.Entry(backlog).State = EntityState.Modified;
         context.SaveChanges();
         var sprint = AssembleSprintById(backlog.SprintId);
         return(sprint);
     }
 }
Exemplo n.º 10
0
        //Set a scrum master and removes the developer from the developers table
        public Project SetScrumMaster(string username, string projectName)
        {
            using (var context = new ThemisContext())
            {
                User      user      = context.Users.Find(username);
                WorkGroup workgroup = assembleWorkGroup(projectName);
                var       wgDevs    = context.WorkGroupDevelopers.Where(w => w.Developer.username.Equals(username) && w.WorkGroupId.Equals(workgroup.WorkGroupId)).FirstOrDefault();

                workgroup.ScrumMaster = user;
                context.WorkGroupDevelopers.Remove(wgDevs);
                context.Entry(workgroup).State = EntityState.Modified;
                context.SaveChanges();

                return(assembleProject(projectName));
            }
        }
Exemplo n.º 11
0
 public Project AcceptInvitation(String projectName, String invitedUser)
 {
     using (var context = new ThemisContext())
     {
         var user = context.Users.Find(invitedUser);
         var AcceptedInvitation = context.Invitation.Where(i => i.username.Equals(invitedUser) && i.Name.Equals(projectName));
         var workGroupId        = context.WorkGroups.Where(w => w.Name.Equals(projectName)).Select(w => w.WorkGroupId).FirstOrDefault();
         context.WorkGroupDevelopers.Add(new WorkGroupDeveloper()
         {
             WorkGroupId = workGroupId,
             Developer   = user
         });
         context.Invitation.Remove(AcceptedInvitation.FirstOrDefault());
         context.SaveChanges();
         return(context.Projects.Find(projectName));
     }
 }
Exemplo n.º 12
0
 public Sprint SetWorkingUser(int backlogId, string username)
 {
     using (var context = new ThemisContext())
     {
         var backlog = context.BackLogItems.Find(backlogId);
         var user    = context.Users.Find(username);
         if (backlog != null)
         {
             backlog.WorksOnIt = user;
             backlog.Status    = "Being done";
         }
         context.Entry(backlog).State = EntityState.Modified;
         context.SaveChanges();
         var sprint = AssembleSprintById(backlog.SprintId);
         return(sprint);
     }
 }
Exemplo n.º 13
0
 public void CreateBacklogItem(BackLogItem backlog)
 {
     using (var context = new ThemisContext())
     {
         var backlogItem = new BackLogItem()
         {
             Name          = backlog.Name,
             SprintId      = null,
             Status        = "Not done",
             Description   = backlog.Description,
             Priority      = backlog.Priority,
             EstimatedTime = backlog.EstimatedTime
         };
         context.BackLogItems.Add(backlogItem);
         context.SaveChanges();
     }
 }
Exemplo n.º 14
0
        public void addProject(string projectName, string username)
        {
            using (var context = new ThemisContext())
            {
                var query = from p in context.Projects where p.Name.Equals(projectName) select p.Name;
                if (!query.Equals(projectName))
                {
                    context.Projects.Add(new Project(projectName)
                    {
                        Name = projectName
                    });
                    var temp = context.Users.Find(username);

                    context.WorkGroups.Add(new WorkGroup()
                    {
                        Name    = projectName,
                        Creator = temp
                    });
                    context.SaveChanges();
                }
            }
        }
Exemplo n.º 15
0
        //Updates exsisting product owner and returns the old one to the developers table
        public Project UpdateExistingProductOwner(string username, string projectName)
        {
            using (var context = new ThemisContext())
            {
                User      user            = context.Users.Find(username);
                WorkGroup workgroup       = assembleWorkGroup(projectName);
                var       oldProductOwner = context.Users.Find(workgroup.ProductOwner.username);
                var       wgDevs          = context.WorkGroupDevelopers.Where(w => w.Developer.username.Equals(username) && w.WorkGroupId.Equals(workgroup.WorkGroupId)).FirstOrDefault();

                workgroup.ProductOwner = user;

                context.WorkGroupDevelopers.Remove(wgDevs);
                context.WorkGroupDevelopers.Add(new WorkGroupDeveloper()
                {
                    WorkGroupId = workgroup.WorkGroupId,
                    Developer   = oldProductOwner
                });

                context.Entry(workgroup).State = EntityState.Modified;
                context.SaveChanges();
                return(assembleProject(projectName));
            }
        }