示例#1
0
        public static async Task <bool> Update(Dictionary <int, Query> queries)
        {
            queries.Clear();
            Queries result = new Queries();

            Progress.Report(0);

            do
            {
                result = await RedmineApi.GetPaginatedList <Queries>(result);

                if (result == null)
                {
                    return(false);
                }

                foreach (Query q in result.Items)
                {
                    queries.Add(q.Id, q);
                }

                Progress.Report(queries.Count * 100 / result.TotalCount);
                result.Offset += result.Limit;
            }while (queries.Count < result.TotalCount);
            Progress.Report(100);

            return(true);
        }
示例#2
0
        public static async Task <bool> Update(Dictionary <int, Project> projects)
        {
            projects.Clear();
            Projects result = new Projects();

            Progress.Report(0);

            do
            {
                result = await RedmineApi.GetPaginatedList <Projects>(result);

                if (result == null)
                {
                    return(false);
                }

                foreach (Project p in result.Items)
                {
                    projects.Add(p.Id, p);
                }

                Progress.Report(projects.Count * 100 / result.TotalCount);
                result.Offset += result.Limit;
            }while (projects.Count < result.TotalCount);
            Progress.Report(100);

            return(true);
        }
示例#3
0
        public static async Task <bool> Update(Dictionary <int, TimeEntry> timeEntries)
        {
            timeEntries.Clear();
            TimeEntries result = new TimeEntries();

            Progress.Report(0);

            do
            {
                result = await RedmineApi.GetPaginatedList <TimeEntries>(result);

                if (result == null)
                {
                    return(false);
                }

                foreach (TimeEntry e in result.Items)
                {
                    timeEntries.Add(e.Id, e);
                }

                Progress.Report(timeEntries.Count * 100 / result.TotalCount);
                result.Offset += result.Limit;
            }while (timeEntries.Count < result.TotalCount);
            Progress.Report(100);

            return(true);
        }
示例#4
0
文件: Users.cs 项目: dkhalife/redmine
        public static async Task <bool> Update(Dictionary <int, User> users)
        {
            users.Clear();
            Users result = new Users();

            Progress.Report(0);

            do
            {
                result = await RedmineApi.GetPaginatedList <Users>(result);

                if (result == null)
                {
                    return(false);
                }

                foreach (User u in result.Items)
                {
                    users.Add(u.Id, u);
                }

                Progress.Report(users.Count * 100 / result.TotalCount);
                result.Offset += result.Limit;
            }while (users.Count < result.TotalCount);
            Progress.Report(100);

            return(true);
        }
示例#5
0
        public static async Task <bool> Update(Dictionary <int, Issue> issues, DateTime lastUpdated)
        {
            Issues result = new Issues();

            Progress.Report(0);

            string since = lastUpdated.ToString("yyyy-MM-dd\\THH:mm:ss\\Z");

            do
            {
                result = await RedmineApi.GetPaginatedList <Issues>(result, $"updated_on=%3E%3D{since}");

                if (result == null)
                {
                    return(false);
                }

                foreach (Issue i in result.Items)
                {
                    if (issues.ContainsKey(i.Id))
                    {
                        issues[i.Id] = i;
                    }
                    else
                    {
                        issues.Add(i.Id, i);
                    }
                }

                Progress.Report(issues.Count * 100 / result.TotalCount);
                result.Offset += result.Limit;
            }while (issues.Count < result.TotalCount);
            Progress.Report(100);

            return(true);
        }