private LogItemViewModel header( GroupId groupId, IImmutableList <IThreadSafeTimeEntry> group, LogItemVisualizationIntent visualizationIntent, int indexInLog, int dayInLog, int daysInThePast) { var sample = group.First(); return(new LogItemViewModel( groupId: groupId, representedTimeEntriesIds: group.Select(timeEntry => timeEntry.Id).ToArray(), visualizationIntent: visualizationIntent, isBillable: sample.Billable, isActive: sample.Project?.Active ?? true, description: sample.Description, duration: DurationAndFormatToString.Convert( TimeSpan.FromSeconds(group.Sum(timeEntry => timeEntry.Duration ?? 0)), durationFormat), projectName: sample.Project?.DisplayName(), projectColor: sample.Project?.Color, clientName: sample.Project?.Client?.Name, taskName: sample.Task?.Name, hasTags: sample.Tags.Any(), needsSync: group.Any(timeEntry => timeEntry.SyncStatus == SyncStatus.SyncNeeded), canSync: group.All(timeEntry => timeEntry.SyncStatus != SyncStatus.SyncFailed), isInaccessible: sample.IsInaccessible, indexInLog: indexInLog, dayInLog: dayInLog, daysInThePast: daysInThePast, projectIsPlaceholder: sample.Project?.IsPlaceholder() ?? false, taskIsPlaceholder: sample.Task?.IsPlaceholder() ?? false)); }
public override Expression Index(Expression target, IImmutableList <Expression> args, SourceInfo sourceInfo) { if (IsConstantType(target) && args.All(IsConstantType)) { var indexExpression = _indexResolver.ReadableIndexer(new DynamicMetaObject(target, BindingRestrictions.Empty), args.Select(x => new DynamicMetaObject(x, BindingRestrictions.Empty)).ToArray()); return(indexExpression ?? Constants.NullExpression); } return(base.Index(target, args, sourceInfo)); }
public override Expression Method(Expression target, string name, IImmutableList <Expression> args, SourceInfo sourceInfo) { if (IsConstantType(target) && args.All(IsConstantType)) { var methodInfo = _methodResolver.ResolveMethod(target.Type.GetTypeInfo(), name, args.Select(x => x.Type).ToImmutableArray()); //TODO: Include debug info if (methodInfo == null) { return(Constants.NullExpression); } return(_methodResolver.ConvertMethodParameters(methodInfo, target, args.Select(x => new DynamicMetaObject(x, BindingRestrictions.Empty)).ToArray()) ?? Constants.NullExpression); } return(base.Method(target, name, args, sourceInfo)); }
public static bool TryCreate(IDirectoryInfo assetDirectory, IFileSystemItem parent, out IFileSystemItem directory) { directory = null; if (!DirectoryEx.Exists(assetDirectory.FullName)) { return(false); } var name = assetDirectory.Name; if (_allowedNames.All(item => item != name)) { return(false); } directory = new ClubDirectory(assetDirectory, parent); return(true); }
private static bool HasMembersAndAllAreStatic(IImmutableList <ISymbol> members) { return(members.Any() && members.All(member => member.IsStatic)); }
private static bool HasMembersAndAllAreStatic(IImmutableList<ISymbol> members) { return members.Any() && members.All(member => member.IsStatic); }
public static async Task EnsureTableExistsWithDefinition( this IAmazonDynamoDB client, string tableName, IImmutableList <AttributeDefinition> attributeDefinitions, IImmutableList <KeySchemaElement> keySchema, IImmutableList <GlobalSecondaryIndex> globalIndices) { var exists = await client.TableExists(tableName); if (exists) { var currentTable = await client.DescribeTableAsync(tableName); var newGlobalIndices = globalIndices .Where(x => currentTable.Table.GlobalSecondaryIndexes.All(y => y.IndexName != x.IndexName)) .ToList(); var removedGlobalIndices = currentTable.Table.GlobalSecondaryIndexes .Where(x => globalIndices.All(y => x.IndexName != y.IndexName)) .ToList(); var indexUpdates = new List <GlobalSecondaryIndexUpdate>(); indexUpdates.AddRange(newGlobalIndices.Select(x => new GlobalSecondaryIndexUpdate { Create = new CreateGlobalSecondaryIndexAction { Projection = x.Projection, IndexName = x.IndexName, KeySchema = x.KeySchema, ProvisionedThroughput = x.ProvisionedThroughput } })); indexUpdates.AddRange(removedGlobalIndices.Select(x => new GlobalSecondaryIndexUpdate { Delete = new DeleteGlobalSecondaryIndexAction { IndexName = x.IndexName } })); await client.UpdateTableAsync(new UpdateTableRequest { TableName = tableName, AttributeDefinitions = attributeDefinitions.ToList(), BillingMode = BillingMode.PAY_PER_REQUEST }); foreach (var indexUpdate in indexUpdates) { await client.UpdateTableAsync(new UpdateTableRequest { TableName = tableName, AttributeDefinitions = attributeDefinitions.ToList(), BillingMode = BillingMode.PAY_PER_REQUEST, GlobalSecondaryIndexUpdates = new List <GlobalSecondaryIndexUpdate> { indexUpdate } }); } } else { await client.CreateTableAsync(new CreateTableRequest { AttributeDefinitions = attributeDefinitions.ToList(), BillingMode = BillingMode.PAY_PER_REQUEST, KeySchema = keySchema.ToList(), TableName = tableName, GlobalSecondaryIndexes = globalIndices.ToList() }); } }