Exemplo n.º 1
0
        public static async Task <bool> ExistWithNameAsync(this IDataQuery <ProjectData> query, string projectName, Guid clientId)
        {
            List <ProjectData> existingProjects;

            if (clientId != Guid.Empty)
            {
                existingProjects = await query.QueryAsync(r => r.Name == projectName && r.ClientId == clientId).ConfigureAwait(false);
            }
            else
            {
                existingProjects = await query.QueryAsync(r => r.Name == projectName && r.ClientId == null).ConfigureAwait(false);
            }
            return(existingProjects.Count != 0);
        }
Exemplo n.º 2
0
        private static async Task <GroupContainer> FromQuery(IDataQuery <TimeEntryData> query)
        {
            var groups = new GroupContainer();

            try {
                var entries = await query.QueryAsync().ConfigureAwait(false);

                // Find unique time entries and add them to the list
                foreach (var entry in entries)
                {
                    if (groups.Contains(entry))
                    {
                        continue;
                    }
                    groups.Add(entry);
                }

                groups.Sort();
            } catch (Exception exc) {
                var log = ServiceContainer.Resolve <ILogger> ();
                log.Error(Tag, exc, "Failed to compose recent time entries");
            }
            return(groups);
        }
Exemplo n.º 3
0
        public static async Task <bool> ExistWithNameAsync(this IDataQuery <ClientData> query, string name)
        {
            var rows = await query.QueryAsync(r => r.Name == name).ConfigureAwait(false);

            return(rows.Count != 0);
        }