예제 #1
0
        public async Task <List <Board> > LoadSchemeBoards()
        {
            _projects = await _rm.GetObjectsAsync <Project>(new NameValueCollection());

            var boards = _projects
                         .Select(project => new Board
            {
                Id      = project.Id,
                Name    = project.Name,
                Created = project.CreatedOn.GetValueOrDefault()
            })
                         .ToList();

            _scheme.Boards = boards;
            _scheme.Rows   = null;

            return(boards);
        }
예제 #2
0
        private async Task LoadRedmineData()
        {
            if (_redmineDataLoaded)
            {
                return;
            }

            _redmineDataLoaded = true;

            var issuesTask   = _rm.GetObjectsAsync <Issue>(new NameValueCollection());
            var statusesTask = _rm.GetObjectsAsync <IssueStatus>(new NameValueCollection());
            var projectsTask = _rm.GetObjectsAsync <Project>(new NameValueCollection());

            _issues = await issuesTask;
            _users  = _issues.Select(x => x.AssignedTo).Where(x => x != null).Distinct().ToList();
            _users.Add(NoneUser);
            _statuses = await statusesTask;
            _projects = await projectsTask;
        }
예제 #3
0
        public async Task <IEnumerable <CommonRemineEntities.User> > GetUsersAsync(int projectId)
        {
            var filter = new NameValueCollection
            {
                { RedmineKeys.PROJECT_ID, projectId.ToString() }
            };

            return((await RedmineManager.GetObjectsAsync <ProjectMembership>(filter))
                   .Select(pm => pm.User)
                   .Select(u => EntityMapper.Map <CommonRemineEntities.User>(u))
                   .ToArray());
        }
예제 #4
0
        public async Task Should_Get_All_Users_With_Groups_And_Memberships()
        {
            List <User> users = await redmineManager.GetObjectsAsync <User>(new NameValueCollection { { RedmineKeys.INCLUDE, "groups, memberships" } });

            CollectionAssert.AllItemsAreNotNull(users, "contains null user!");
            CollectionAssert.AllItemsAreUnique(users, "users not unique!");
            CollectionAssert.AllItemsAreInstancesOfType(users, typeof(User));
        }
예제 #5
0
        public async Task <List <Issue> > GetIssues()
        {
            //parameter - get all issues
            var parameters = new NameValueCollection {
                { RedmineKeys.STATUS_ID, RedmineKeys.ALL }
            };

            //parameter - fetch my issues
            parameters.Add(RedmineKeys.ASSIGNED_TO_ID, "me");

            try
            {
                return(await m_redmineManager.GetObjectsAsync <Issue>(parameters));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Redmine access error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
        }
예제 #6
0
        public async Task <IEnumerable <CommonRemineEntities.Issue> > GetIssuesAsync(
            NameValueCollection filters)
        {
            var parameters = new NameValueCollection();

            foreach (var key in filters.AllKeys)
            {
                if (ParametersMapping.TryGetValue(key, out string convertedKey))
                {
                    foreach (var value in filters.GetValues(key))
                    {
                        parameters.Add(convertedKey, value);
                    }
                }
            }

            // TODO support multiple values
            var redmineIssues = await RedmineManager.GetObjectsAsync <Issue>(parameters);

            var issues = EntityMapper.Map <List <CommonRemineEntities.Issue> >(redmineIssues);

            return(issues);
        }
예제 #7
0
 public async Task <IEnumerable <CommonRemineEntities.Status> > GetStatusesAsync()
 {
     return((await RedmineManager.GetObjectsAsync <IssueStatus>(new NameValueCollection()))
            .Select(s => EntityMapper.Map <CommonRemineEntities.Status>(s))
            .ToArray());
 }
예제 #8
0
 public async Task <IEnumerable <CommonRemineEntities.Priority> > GetPrioritiesAsync()
 {
     return((await RedmineManager.GetObjectsAsync <IssuePriority>(new NameValueCollection()))
            .Select(p => EntityMapper.Map <CommonRemineEntities.Priority>(p))
            .ToArray());
 }