public int Put(int id, [FromBody] IterationDTO iteration)
 {
     using (DataAccessLayer modelAccess = new DataAccessLayer())
     {
         try
         {
             LogHelper.InfoLog("Updating iteration with id: " + iteration.IterationID);
             modelAccess.UpdateIteration(id, new Iteration
             {
                 ID              = iteration.IterationID,
                 ProjectID       = iteration.ProjectID,
                 SprintName      = iteration.SprintName,
                 SprintStartDate = DateTime.Parse(iteration.SprintStartDate),
                 SprintEndDate   = DateTime.Parse(iteration.SprintEndDate),
                 Archived        = iteration.Archived
             });
             return(1);
         }
         catch (Exception ex)
         {
             LogHelper.ErrorLog("Error Updating Iteration: " + iteration.IterationID + " with error: " + ex.ToString());
             return(0);
         }
     }
 }
Beispiel #2
0
        public void GetCurrentUserStories()
        {
            if (!this.Project.DataTypeReferences.Contains(this.UserStoryListRef))
            {
                throw new BuildException(String.Format("The refid userstorylistref {0} is not defined.", this.UserStoryListRef));
            }

            StringList RefStringList = (StringList)this.Project.DataTypeReferences[this.UserStoryListRef];

            ServicesCF.ConnectionInformation = this.ConnectionInformation;
            IterationService iterationService = ServicesCF.GetService <IterationService>();

            IterationDTO[] iterations = iterationService.RetrieveAll();

            List <IterationDTO> currentIterationList = iterations.Where(iteration => iteration.ParentProjectID == this.ProjectId && iteration.StartDate <= DateTime.Today && iteration.EndDate >= DateTime.Today).ToList <IterationDTO>();

            if (currentIterationList.Count == 0)
            {
                throw new BuildException("Could not find the current iteration.", this.Location);
            }

            IterationDTO currentIteration = currentIterationList[0];

            UserStoryDTO[] userStories = iterationService.RetrieveUserStoriesForIteration(currentIteration.IterationID.Value);

            foreach (UserStoryDTO userStory in userStories)
            {
                string userStoryId = userStory.UserStoryID.ToString();
                RefStringList.StringItems.Add(userStoryId, new StringItem(userStoryId));
            }
        }
Beispiel #3
0
        public string GetCurrentIterationName(String connectionRef, string projectName)
        {
            if (!this.Project.DataTypeReferences.Contains(connectionRef))
            {
                throw new BuildException(String.Format("The refid {0} is not defined.", connectionRef));
            }

            ConnectionInformation ConnectionInformation = (ConnectionInformation)this.Project.DataTypeReferences[connectionRef];

            ServicesCF.ConnectionInformation = ConnectionInformation;

            IterationDTO currentIteration = GetCurrentIteration(FindProjectId(projectName), ConnectionInformation);

            return(currentIteration.Name);
        }
Beispiel #4
0
        private static IterationDTO GetCurrentIteration(int projectId, ConnectionInformation ConnectionInformation)
        {
            ServicesCF.ConnectionInformation = ConnectionInformation;
            IterationService iterationService = ServicesCF.GetService <IterationService>();

            IterationDTO[] iterations = iterationService.RetrieveAll();

            List <IterationDTO> currentIterationList = iterations.Where(iteration => iteration.ParentProjectID == projectId && iteration.StartDate <= DateTime.Today && iteration.EndDate >= DateTime.Today).ToList <IterationDTO>();

            if (currentIterationList.Count == 0)
            {
                throw new BuildException("Could not find the current iteration.");
            }

            IterationDTO currentIteration = currentIterationList[0];

            return(currentIteration);
        }
 public int Post([FromBody] IterationDTO iteration)
 {
     try
     {
         using (DataAccessLayer modelAccess = new DataAccessLayer())
         {
             LogHelper.InfoLog("Adding Iteration to Project " + iteration.ProjectID);
             return(modelAccess.AddIteration(new Iteration
             {
                 ID = 0,
                 ProjectID = iteration.ProjectID,
                 SprintName = iteration.SprintName,
                 SprintStartDate = DateTime.ParseExact(iteration.SprintStartDate, "dd/MM/yyyy", null, DateTimeStyles.None),
                 SprintEndDate = DateTime.ParseExact(iteration.SprintEndDate, "dd/MM/yyyy", null, DateTimeStyles.None),
                 Archived = false
             }));
         }
     }
     catch (Exception ex)
     {
         LogHelper.ErrorLog("The Following Error occured when adding an iteration: " + ex.ToString());
         return(0);
     }
 }