예제 #1
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));
            }
        }
예제 #2
0
        public override XmlDocument GenerateReport()
        {
            XmlDocument report      = base.GenerateReport();
            XmlElement  rootElement = report.DocumentElement;

            UserStoryDTO story = StoryService.GetByID(this.UserStoryId);

            this.ProjectId            = story.ProjectID.Value;
            this.TargetProcessProject = story.ProjectName;

            CustomFieldWebService.CustomFieldService fieldService = ServicesCF.GetService <CustomFieldWebService.CustomFieldService>();

            CustomFieldWebService.CustomFieldDTO[]      allCustomFields = fieldService.RetrieveAll();
            List <CustomFieldWebService.CustomFieldDTO> customFields    = allCustomFields.Where(field => field.EntityTypeName == this.EntityTypeName && field.ProcessID == this.ProcessId).ToList <CustomFieldWebService.CustomFieldDTO>();

            foreach (CustomFieldWebService.CustomFieldDTO customField in customFields)
            {
                XmlNode customFieldNode = report.CreateNode(XmlNodeType.Element, null, "CustomField", null);

                XmlNode customFieldNameNode = report.CreateNode(XmlNodeType.Element, null, "Name", null);
                customFieldNameNode.InnerText = customField.Name;
                customFieldNode.AppendChild(customFieldNameNode);

                XmlNode      customFieldValueNode = report.CreateNode(XmlNodeType.Element, null, "Value", null);
                PropertyInfo propertyInfo         = story.GetType().GetProperty(customField.EntityFieldName);
                customFieldValueNode.InnerText = (String)propertyInfo.GetValue(story, null);
                customFieldNode.AppendChild(customFieldValueNode);

                rootElement.AppendChild(customFieldNode);
            }

            return(report);
        }
예제 #3
0
        private int FindUserStoryIdByName(string userStory)
        {
            UserStoryWebService.UserStoryService storyService = ServicesCF.GetService <UserStoryWebService.UserStoryService>();

            string hqlQuery = "from UserStory as story where story.Name = ?";

            UserStoryWebService.UserStoryDTO[] storyies = storyService.Retrieve(hqlQuery, new object[] { userStory });

            if (storyies.Length == 0)
            {
                throw new BuildException(string.Format("Could not find a story named: '{0}'.", userStory));
            }

            return(storyies[0].UserStoryID.Value);
        }
예제 #4
0
        public int GetId()
        {
            UserService userService = ServicesCF.GetService <UserService>();

            string hqlQuery = "from User as user where user.Login = ?";

            UserDTO[] users = userService.Retrieve(hqlQuery, new object[] { this.LoginName });

            if (users.Length == 0)
            {
                throw new BuildException(string.Format("Could not find a story named: '{0}'.", this.LoginName));
            }

            return(users[0].UserID.Value);
        }
예제 #5
0
        private static int FindProjectId(string projectName)
        {
            ProjectService projectService = ServicesCF.GetService <ProjectService>();

            string hqlQuery = "from Project as project where project.Name = ?";

            ProjectDTO[] projects = projectService.Retrieve(hqlQuery, new object[] { projectName });

            if (projects.Length == 0)
            {
                throw new BuildException(string.Format("Could not find a project named: '{0}'.", projectName));
            }

            return(projects[0].ProjectID.Value);
        }
예제 #6
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);
        }
예제 #7
0
        private int FindStateId()
        {
            ProcessService processService = ServicesCF.GetService <ProcessService>();

            EntityStateDTO[] states = processService.RetrieveEntityStatesForProcess(this.ProcessId.Value);

            IEnumerable <int?> stateIdsEnum = from state in states where state.EntityTypeName == this.EntityTypeName && state.Name == this.State select state.ID;

            List <int?> stateIds = stateIdsEnum.ToList <int?>();

            if (stateIds.Count == 0)
            {
                string flatOptions = String.Empty;
                states
                .Where(state => state.EntityTypeName == this.EntityTypeName)
                .Select(state => state.Name)
                .ToList <string>()
                .ForEach(option => flatOptions += " '" + option + "'");
                string message = string.Format("Could not find a state named '{0}' in the options: {1}.", this.State, flatOptions);
                throw new BuildException(message);
            }

            return(stateIds[0].Value);
        }