示例#1
0
        public bool CreateUser(string name, IUsersAssigned usersAssigned)
        {
            //create and check
            User user   = DB.CreateUser(name);
            bool result = user != null;

            //Add user to parent to be viewed in userMenu directly
            string typeName = usersAssigned.GetType().Name;

            switch (typeName)
            {
            case "UserStory":
                AddUserToProject(user, (usersAssigned as UserStory).Project);
                break;

            case "ChecklistItem":
                AddUserToUserStory(user, (usersAssigned as ChecklistItem).Checklist.UserStory);
                break;

            case "Project":
            default:
                break;
            }

            //assign values and return
            users.Add(user);
            return(result);
        }
示例#2
0
        public UserMenu(IUsersAssigned anObjectWithAssignedUsers, List <User> possibilities, Controller aController)
        {
            controller = aController;
            objectWithAssignedUsers = anObjectWithAssignedUsers;
            possibleUsers           = possibilities;

            InitializeComponent();

            Refresh();
        }
示例#3
0
        public bool AddUserToIUsersAssigned(User user, IUsersAssigned usersAssigned)
        {
            //Verify which IUsersAssigned it is
            string typeName = usersAssigned.GetType().Name;

            switch (typeName)
            {
            case "Project":
                AddUserToProject(user, usersAssigned as Project);
                break;

            case "UserStory":
                AddUserToUserStory(user, usersAssigned as UserStory);
                break;

            case "ChecklistItem":
                AddUserToChecklistItem(user, usersAssigned as ChecklistItem);
                break;

            default:
                return(false);
            }
            return(true);
        }
示例#4
0
        public bool RemoveUserFromIUsersAssigned(User user, IUsersAssigned usersAssigned)
        {
            string typeName = usersAssigned.GetType().Name;

            switch (typeName)
            {
            case "Project":
                RemoveUserFromProject(user, usersAssigned as Project);
                break;

            case "UserStory":
                RemoveUserFromUserStory(user, usersAssigned as UserStory);
                CreateActivity(string.Format("{0} a été désassigné", user), usersAssigned as UserStory);
                break;

            case "ChecklistItem":
                RemoveUserFromChecklistItem(user, usersAssigned as ChecklistItem);
                break;

            default:
                return(false);
            }
            return(true);
        }