Esempio n. 1
0
        internal static UserStory ToEntity(UserStoryDTO objet, bool creation)
        {
            UserStory retour = new UserStory();

            if (objet != null)
            {
                retour.ProjectId   = objet.ProjectId;
                retour.Label       = objet.Label;
                retour.Version     = objet.Version;
                retour.Role        = objet.Role;
                retour.Function1   = objet.Function1;
                retour.Function2   = objet.Function2;
                retour.Notes       = objet.Notes;
                retour.Priority    = objet.Priority;
                retour.StoryPoints = objet.StoryPoints;
                retour.EpicStory   = objet.EpicStory;
                if (creation)
                {
                    retour.IsDeleted        = false;
                    retour.DateCreation     = DateTime.UtcNow;
                    retour.DateModification = objet.DateCreation;
                }
                else
                {
                    retour.Id               = objet.Id;
                    retour.IsDeleted        = objet.IsDeleted;
                    retour.DateCreation     = objet.DateCreation;
                    retour.DateModification = DateTime.UtcNow;
                }
            }
            return(retour);
        }
Esempio n. 2
0
        public UserStoryDTO GetById(int id)
        {
            UserStoryDTO retour = new UserStoryDTO();

            retour = _logic.GetById(id);
            return(retour);
        }
Esempio n. 3
0
        public override void Create()
        {
            UserStoryDTO story = new UserStoryDTO
            {
                Name      = this.EntityName,
                ProjectID = this.ProjectId
            };

            if (IsDescriptionSet)
            {
                story.Description = this.Description;
            }

            if (!String.IsNullOrEmpty(this.State))
            {
                story.EntityStateID = this.StateId;
            }

            int storyId = StoryService.Create(story);

            foreach (TargetProcessUser user in this.UsersToAssign)
            {
                StoryService.AssignUser(storyId, user.GetId());
            }
        }
Esempio n. 4
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);
        }
        public UserStoryDTO GetById(int Id)
        {
            UserStoryDTO retour = new UserStoryDTO();
            UserStory    objet  = _repo.Get(Id);

            retour = MapUserStoryContentDTO.ToDto(objet);
            return(retour);
        }
        public UserStoryDTO Update(UserStoryDTO objet)
        {
            UserStory    entity   = MapUserStory.ToEntity(objet, false);
            UserStory    resultat = _repo.Update(entity);
            UserStoryDTO retour   = MapUserStoryContentDTO.ToDto(resultat);

            return(retour);
        }
        public UserStoryDTO Create(UserStoryDTO objet)
        {
            UserStory entite   = MapUserStory.ToEntity(objet, true);
            UserStory resultat = _repo.Create(entite);

            objet = MapUserStoryContentDTO.ToDto(resultat);
            return(objet);
        }
Esempio n. 8
0
        public void ChangeTpEntity(string entityName, string field, string newEntityName)
        {
            UserStoryDTO tpEntity     = Context.TpUserStories.First(x => x.Name == entityName);
            var          nameProperty = typeof(UserStoryDTO).GetProperty(field);

            nameProperty.SetValue(tpEntity, newEntityName, null);

            tpEntity.Name.Should(Be.EqualTo(newEntityName));
        }
 private void CreateTask(string taskName, UserStoryDTO userStoryDto)
 {
     _bus.Send(new CreateTaskCommand(new TaskDTO
     {
         UserStoryID = userStoryDto.UserStoryID,
         Name        = taskName,
         OwnerID     = userStoryDto.OwnerID
     }));
 }
 private void UpdateUserStoryName(UserStoryDTO userStoryDto)
 {
     _bus.Send(
         new UpdateUserStoryCommand(new UserStoryDTO
     {
         ID   = userStoryDto.ID,
         Name = userStoryDto.Name.TrimStart().Substring(_profile.CommandName.Length)
     }, new Enum[] { UserStoryField.Name }
                                    ));
 }
        private void CreateTasks(UserStoryDTO userStoryDto)
        {
            if (string.IsNullOrEmpty(_profile.TasksList))
            {
                return;
            }
            var reader = new StringReader(_profile.TasksList);

            string line;

            while (null != (line = reader.ReadLine()))
            {
                CreateTask(line, userStoryDto);
            }
        }
        private void ProcessUserStory(UserStoryDTO userStoryDto)
        {
            if (string.IsNullOrEmpty(_profile.CommandName))
            {
                return;
            }
            if (!NeedToProcessUserStory(userStoryDto))
            {
                return;
            }

            CreateTasks(userStoryDto);

            UpdateUserStoryName(userStoryDto);
        }
        public void SerializeCustomFieldsMetaCorrectly()
        {
            var dto = new UserStoryDTO
            {
                CustomFieldsMetaInfo = new[] { new Field {
                                                   FieldType = FieldTypeEnum.Text, Value = "Value"
                                               } }
            };

            var message = new UserStoryCreatedMessage {
                Dto = dto
            };
            var serialized   = _serializer.Serialize(message);
            var deserialized = _deserializer.Deserialize(serialized);
            var meta         = ((UserStoryCreatedMessage)deserialized).Dto.CustomFieldsMetaInfo;

            meta.Single().FieldType.Should(Be.EqualTo(FieldTypeEnum.Text));
        }
Esempio n. 14
0
 //modification d'entité avec fourniture de l'Id obligatoire
 public ActionResult <UserStoryDTO> Put([FromBody] UserStoryDTO objet)
 {
     if (ModelState.IsValid && objet.Id.HasValue)
     {
         try
         {
             UserStoryDTO resultat = _logic.Update(objet);
             return(resultat);
         }
         catch (Exception ex)
         {
             return(null);
         }
     }
     else
     {
         return(BadRequest("UserStoryDTO invalide"));
     }
 }
Esempio n. 15
0
 public ActionResult <UserStoryDTO> Post([FromBody] UserStoryDTO objet)
 {
     if (ModelState.IsValid)
     {
         try
         {
             UserStoryDTO resultat = _logic.Create(objet);
             return(resultat);
         }
         catch
         {
             return(null);
         }
     }
     else
     {
         return(BadRequest("UserStoryDTO invalide"));
     }
 }
Esempio n. 16
0
        internal static UserStoryDTO ToDto(UserStory objet)
        {
            UserStoryDTO retour = new UserStoryDTO();

            if (objet != null)
            {
                retour.Id               = objet.Id;
                retour.ProjectId        = objet.ProjectId;
                retour.Label            = objet.Label;
                retour.Version          = objet.Version;
                retour.Role             = objet.Role;
                retour.Function1        = objet.Function1;
                retour.Function2        = objet.Function2;
                retour.Notes            = objet.Notes;
                retour.Priority         = objet.Priority;
                retour.StoryPoints      = objet.StoryPoints;
                retour.EpicStory        = objet.EpicStory;
                retour.IsDeleted        = objet.IsDeleted;
                retour.DateCreation     = (System.DateTime)objet.DateCreation;
                retour.DateModification = DateTime.UtcNow;
            }

            return(retour);
        }
Esempio n. 17
0
        public override void Update()
        {
            UserStoryDTO story = StoryService.GetByID(this.UserStoryId);

            story.Name      = this.EntityName;
            story.ProjectID = this.ProjectId;

            if (IsDescriptionSet)
            {
                story.Description = this.Description;
            }

            if (!String.IsNullOrEmpty(this.State))
            {
                story.EntityStateID = this.StateId;
            }

            StoryService.Update(story);

            foreach (TargetProcessUser user in this.UsersToAssign)
            {
                StoryService.AssignUser(story.UserStoryID.Value, user.GetId());
            }
        }
 private bool NeedToProcessUserStory(UserStoryDTO userStoryDto)
 {
     return(_profile.Project == userStoryDto.ProjectID &&
            (userStoryDto.Name.TrimStart().StartsWith(_profile.CommandName,
                                                      StringComparison.InvariantCultureIgnoreCase)));
 }