public async Task <Models.FilteredList <AllEntry> > GetList( int size, int page, string sort, bool?descSort, string search, DateTimeOffset?beginDate, DateTimeOffset?endDate, EntryType?entryType) { var filter = new Filter <DB.Context.Entry>() { Page = page, Size = size, SortField = sort, DescSort = descSort, AddFilter = s => (entryType == null || entryType == EntryType.All || s.EntryType == entryType) && (beginDate == null || s.BeginDate >= beginDate) && (endDate == null || s.BeginDate < endDate) && (string.IsNullOrEmpty(search) || s.Title.Contains(search) || s.Description.Contains(search)) }; var entries = await repositoryAllEntry.GetByFilter(filter); var result = mapper.Map <Models.FilteredList <AllEntry> >(entries); result.BeginNumber = page * size + 1; result.EndNumber = page * size + entries.Entries.Count(); result.IsFirstPage = page == 0; result.IsLastPage = page * size + size >= entries.AllCount; return(result); }
/// <summary> /// Not yet documented. /// </summary> public override EntryType PeekEntry(out string name) { if (this.peekedEntryType != null) { name = this.peekedEntryName; return(this.peekedEntryType.Value); } this.currentIndex++; if (this.IndexIsValid) { var node = this.nodes[this.currentIndex]; this.peekedEntryName = node.Name; this.peekedEntryType = node.Entry; this.peekedEntryData = node.Data; } else { this.peekedEntryName = null; this.peekedEntryType = EntryType.EndOfStream; this.peekedEntryData = null; } name = this.peekedEntryName; return(this.peekedEntryType.Value); }
/// <summary> /// Exits the closest array. This method will keep skipping entries using <see cref="IDataReader.SkipEntry(DeserializationContext)" /> until an <see cref="EntryType.EndOfArray" /> is reached, or the end of the stream is reached. /// <para /> /// This call MUST have been preceded by a corresponding call to <see cref="IDataReader.EnterArray(out long)(out Type)" />. /// <para /> /// This call will change the values of the <see cref="IDataReader.IsInArrayNode" />, <see cref="IDataReader.CurrentNodeName" />, <see cref="IDataReader.CurrentNodeId" /> and <see cref="IDataReader.CurrentNodeDepth" /> to the correct values for the node that was prior to the exited array node. /// </summary> /// <returns> /// <c>true</c> if the method exited an array, <c>false</c> if it reached the end of the stream. /// </returns> public override bool ExitArray() { this.PeekEntry(); // Read to next end of array while (this.peekedEntryType != EntryType.EndOfArray && this.peekedEntryType != EntryType.EndOfStream) { if (this.peekedEntryType == EntryType.EndOfNode) { this.Context.Config.DebugContext.LogError("Data layout mismatch; skipping past node boundary when exiting array."); this.MarkEntryConsumed(); } this.SkipEntry(); } if (this.peekedEntryType == EntryType.EndOfArray) { this.peekedEntryType = null; this.PopArray(); return(true); } return(false); }
/// <summary> /// Reads a primitive array value. This call will succeed if the next entry is an <see cref="EntryType.PrimitiveArray" />. /// <para /> /// If the call fails (and returns <c>false</c>), it will skip the current entry value, unless that entry is an <see cref="EntryType.EndOfNode" /> or an <see cref="EntryType.EndOfArray" />. /// </summary> /// <typeparam name="T">The element type of the primitive array. Valid element types can be determined using <see cref="FormatterUtilities.IsPrimitiveArrayType(Type)" />.</typeparam> /// <param name="array">The resulting primitive array.</param> /// <returns> /// <c>true</c> if reading a primitive array succeeded, otherwise <c>false</c> /// </returns> /// <exception cref="System.ArgumentException">Type + typeof(T).Name + is not a valid primitive array type.</exception> public override bool ReadPrimitiveArray <T>(out T[] array) { if (FormatterUtilities.IsPrimitiveArrayType(typeof(T)) == false) { throw new ArgumentException("Type " + typeof(T).Name + " is not a valid primitive array type."); } this.PeekEntry(); if (this.peekedEntryType == EntryType.PrimitiveArray) { this.PushArray(); if (this.peekedEntryName != JsonConfig.PRIMITIVE_ARRAY_LENGTH_SIG) { this.Context.Config.DebugContext.LogError("Array entry wasn't preceded by an array length entry!"); array = null; // No array content for you! return(false); } else { int intLength; if (int.TryParse(this.peekedEntryContent, NumberStyles.Any, CultureInfo.InvariantCulture, out intLength) == false) { this.Context.Config.DebugContext.LogError("Failed to parse array length: " + this.peekedEntryContent); array = null; // No array content for you! return(false); } this.ReadToNextEntry(); if (this.peekedEntryName != JsonConfig.PRIMITIVE_ARRAY_CONTENT_SIG) { this.Context.Config.DebugContext.LogError("Failed to find primitive array content entry after array length entry!"); array = null; // No array content for you! return(false); } this.peekedEntryType = null; Func <T> reader = (Func <T>) this.primitiveArrayReaders[typeof(T)]; array = new T[intLength]; for (int i = 0; i < intLength; i++) { array[i] = reader(); } this.ExitArray(); return(true); } } else { this.SkipEntry(); array = null; return(false); } }
public MessageMaps(string actionTextResourceName, ActionType?actionType = null, ProductType?productType = null, ModuleType?moduleType = null, EntryType?entryType1 = null, EntryType?entryType2 = null) { ActionTextResourceName = actionTextResourceName; if (actionType.HasValue) { ActionType = actionType.Value; } if (productType.HasValue) { ProductType = productType.Value; } if (moduleType.HasValue) { ModuleType = moduleType.Value; } if (entryType1.HasValue) { EntryType1 = entryType1.Value; } if (entryType2.HasValue) { EntryType2 = entryType2.Value; } }
internal AclInfo GetAclInfoCopy(int entityId, EntryType?entryType = null) { var entity = GetEntitySafe(entityId, false); var acl = entity?.Acl; return(acl == null ? null : entity.Acl.Copy(entryType)); }
public async Task <IActionResult> List( [FromQuery] int size = 10, [FromQuery] int page = 0, [FromQuery] string sort = null, [FromQuery] bool?descSort = null, [FromQuery] string search = null, [FromQuery] DateTimeOffset?beginDate = null, [FromQuery] DateTimeOffset?endDate = null, [FromQuery] EntryType?entryType = null) { try { if (string.IsNullOrEmpty(sort)) { sort = "BeginDate"; descSort = true; } var entries = await dataService.GetList(size, page, sort, descSort, search, beginDate, endDate, entryType); SetHeaders(entries.AllCount, entries.BeginNumber, entries.EndNumber, entries.IsFirstPage, entries.IsLastPage); return(PartialView(entries.Entries)); } catch (Exception ex) { _logger.LogError($"Error in GET List method: {ex.Message}, StackTrace: {ex.StackTrace}"); return(BadRequest(ex.Message)); } }
/// <summary> /// Consumes the current entry, and reads to the next one. /// </summary> /// <returns>The next entry.</returns> protected override EntryType ReadToNextEntry() { this.peekedEntryType = null; string name; return(this.PeekEntry(out name)); }
private void ConsumeCurrentEntry() { if (this.peekedEntryType != null && this.peekedEntryType != EntryType.EndOfStream) { this.peekedEntryType = null; } }
/// <summary> /// Tells the reader that a new serialization session is about to begin, and that it should clear all cached values left over from any prior serialization sessions. /// This method is only relevant when the same reader is used to deserialize several different, unrelated values. /// </summary> public override void PrepareNewSerializationSession() { this.peekedEntryType = null; this.peekedEntryContent = null; this.peekedEntryName = null; this.seenTypes.Clear(); this.reader.Reset(); }
public GlobalSearchBoxModel(EntryType?objectType, string searchTerm) { AllObjectTypes = new TranslateableEnum <EntryType>(() => global::Resources.EntryTypeNames.ResourceManager, new[] { EntryType.Undefined, EntryType.Artist, EntryType.Album, EntryType.Song, EntryType.Tag, EntryType.User }); ObjectType = objectType ?? EntryType.Artist; GlobalSearchTerm = searchTerm ?? string.Empty; }
private void MarkEntryConsumed() { // After a common read, we cannot skip EndOfArray and EndOfNode entries (meaning the read has failed), // as only the ExitArray and ExitNode methods are allowed to exit nodes and arrays if (this.peekedEntryType != EntryType.EndOfArray && this.peekedEntryType != EntryType.EndOfNode) { this.peekedEntryType = null; } }
internal static AclInfo GetAclInfoCopy(SecurityContext ctx, int entityId, EntryType?entryType = null) { var entity = GetEntitySafe(ctx, entityId, false); var acl = entity?.Acl; if (acl == null) { return(null); } return(entity.Acl.Copy(entryType)); }
internal AclInfo Copy(EntryType?entryType = null) { var entries = entryType == null ? this.Entries.Select(x => x.Copy()).ToList() : this.Entries.Where(x => x.EntryType == entryType.Value).Select(x => x.Copy()).ToList(); return(new AclInfo(this.EntityId) { Entries = entries }); }
public MessageMapsDictionary Add(MessageAction action, ActionType?actionType = null, EntryType?entryType1 = null, EntryType?entryType2 = null, ProductType?productType = null, ModuleType?moduleType = null) { var map = new MessageMaps(action.ToString(), actionType, productType ?? _productType, moduleType ?? _moduleType, entryType1, entryType2); Actions.Add(new KeyValuePair <MessageAction, MessageMaps>(action, map)); return(this); }
public TagBaseContract[] GetTopTags(string categoryName = null, EntryType?entryType = null, int maxResults = 15, ContentLanguagePreference lang = ContentLanguagePreference.Default) { return(queries.HandleQuery(ctx => ctx.Query <Tag>() .WhereHasCategoryName(categoryName) .OrderByUsageCount(entryType) .Paged(new PagingProperties(0, maxResults, false)) .Select(t => new TagBaseContract(t, lang, false, false)) .ToArray()) .OrderBy(t => t.Name).ToArray()); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); try { IDictionary<String, Object> dic = e.Parameter as IDictionary<String, Object>; m_entryType = dic["Type"] as EntryType?; m_myID = dic["MyID"] as String; } catch (System.Exception ex) { } InitialLoad(); }
/// <summary> /// Peeks ahead and returns the type of the next entry in the stream. /// </summary> /// <param name="name">The name of the next entry, if it has one.</param> /// <returns> /// The type of the next entry. /// </returns> public override EntryType PeekEntry(out string name) { if (this.peekedEntryType != null) { name = this.peekedEntryName; return(this.peekedEntryType.Value); } EntryType entry; this.reader.ReadToNextEntry(out name, out this.peekedEntryContent, out entry); this.peekedEntryName = name; this.peekedEntryType = entry; return(entry); }
/// <summary> /// Tries to enters an array node. This will succeed if the next entry is an <see cref="EntryType.StartOfArray" />. /// <para /> /// This call MUST (eventually) be followed by a corresponding call to <see cref="IDataReader.ExitArray(DeserializationContext)" /><para /> /// This call will change the values of the <see cref="IDataReader.IsInArrayNode" />, <see cref="IDataReader.CurrentNodeName" />, <see cref="IDataReader.CurrentNodeId" /> and <see cref="IDataReader.CurrentNodeDepth" /> properties to the correct values for the current array node. /// </summary> /// <param name="length">The length of the array that was entered.</param> /// <returns> /// <c>true</c> if an array was entered, otherwise <c>false</c> /// </returns> public override bool EnterArray(out long length) { this.PeekEntry(); if (this.peekedEntryType == EntryType.StartOfArray) { this.PushArray(); if (this.peekedEntryName != JsonConfig.REGULAR_ARRAY_LENGTH_SIG) { this.Context.Config.DebugContext.LogError("Array entry wasn't preceded by an array length entry!"); length = 0; // No array content for you! return(true); } else { int intLength; if (int.TryParse(this.peekedEntryContent, NumberStyles.Any, CultureInfo.InvariantCulture, out intLength) == false) { this.Context.Config.DebugContext.LogError("Failed to parse array length: " + this.peekedEntryContent); length = 0; // No array content for you! return(true); } length = intLength; this.ReadToNextEntry(); if (this.peekedEntryName != JsonConfig.REGULAR_ARRAY_CONTENT_SIG) { this.Context.Config.DebugContext.LogError("Failed to find regular array content entry after array length entry!"); length = 0; // No array content for you! return(true); } this.peekedEntryType = null; return(true); } } else { this.SkipEntry(); length = 0; return(false); } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); try { Dictionary<String, Object> parameters = e.Parameter as Dictionary<String, Object>; if(parameters.ContainsKey("Type")) m_type = parameters["Type"] as EntryType?; if (parameters.ContainsKey("Content")) m_content = parameters["Content"] as String; } catch (System.Exception ex) { } ChangeUIByInputType(); }
public async Task <IActionResult> GetInfoEx([FromRoute] string orgSlug, [FromRoute] string dsSlug, [FromForm] string path, [FromForm] EntryType?type = null) { try { _logger.LogDebug("Objects controller GetInfoEx('{OrgSlug}', '{DsSlug}', '{Path}', {Type})", orgSlug, dsSlug, path, type); var res = await _objectsManager.List(orgSlug, dsSlug, path, false, type); return(Ok(res)); } catch (Exception ex) { _logger.LogError(ex, "Exception in Objects controller GetInfoEx('{OrgSlug}', '{DsSlug}', '{Path}, {Type})", orgSlug, dsSlug, path, type); return(ExceptionResult(ex)); } }
public async Task <IActionResult> Search([FromRoute] string orgSlug, [FromRoute] string dsSlug, [FromForm] string query, [FromForm] string path, [FromForm] bool recursive = true, [FromForm] EntryType?type = null) { try { _logger.LogDebug("Objects controller Search('{OrgSlug}', '{DsSlug}', '{Path}', '{Type}')", orgSlug, dsSlug, path, type); var res = await _objectsManager.Search(orgSlug, dsSlug, query, path, recursive, type); return(Ok(res)); } catch (Exception ex) { _logger.LogError(ex, "Exception in Objects controller Search('{OrgSlug}', '{DsSlug}', '{Path}', '{Type}')", orgSlug, dsSlug, path, type); return(ExceptionResult(ex)); } }
protected override void Output(string output) { if (HttpContext.Current == null) { return; } EntryType?worstCase = this.WorstEntryType; if (worstCase == null) { return; } if (worstCase.Value == EntryType.Info) { HttpContext.Current.Trace.Write(output); } else { HttpContext.Current.Trace.Warn(output); } }
public async Task <IEnumerable <EntryDto> > List(string orgSlug, string dsSlug, string path = null, bool recursive = false, EntryType?type = null) { var ds = await _utils.GetDataset(orgSlug, dsSlug); _logger.LogInformation("In List('{OrgSlug}/{DsSlug}')", orgSlug, dsSlug); var ddb = _ddbManager.Get(orgSlug, ds.InternalRef); _logger.LogInformation("Searching in '{Path}'", path); var entities = await ddb.SearchAsync(path, recursive); if (type != null) { entities = entities.Where(item => item.Type == type); } var files = entities.Select(item => item.ToDto()).ToArray(); _logger.LogInformation("Found {FilesCount} objects", files.Length); return(files); }
public TagBaseContract[] GetTopTags(string categoryName = null, EntryType?entryType = null, int maxResults = 15, ContentLanguagePreference lang = ContentLanguagePreference.Default) => _queries.GetTopTags(categoryName, entryType, maxResults, lang);
private void ParseEntryFromBuffer(out string name, out string valueContent, out EntryType entry, int valueSeparatorIndex, EntryType?hintEntry) { if (this.bufferIndex >= 0) { if (valueSeparatorIndex == -1) { // There is no value separator on this line at all if (hintEntry != null) { // We have a hint, so we'll try to handle it and assume that the entry's content is the whole thing name = null; valueContent = new string(this.buffer, 0, this.bufferIndex + 1); entry = hintEntry.Value; return; } else { // We've got no hint and no separator; we must assume that this is a primitive, and that the entry's content is the whole thing // This will happen while reading primitive arrays name = null; valueContent = new string(this.buffer, 0, this.bufferIndex + 1); var guessedPrimitiveType = this.GuessPrimitiveType(valueContent); if (guessedPrimitiveType != null) { entry = guessedPrimitiveType.Value; } else { entry = EntryType.Invalid; } return; } } else { // We allow a node's name to *not* be inside quotation marks if (this.buffer[0] == '"') { name = new string(this.buffer, 1, valueSeparatorIndex - 2); } else { name = new string(this.buffer, 0, valueSeparatorIndex); } if (string.Equals(name, JsonConfig.REGULAR_ARRAY_CONTENT_SIG, StringComparison.InvariantCulture) && hintEntry == EntryType.StartOfArray) { valueContent = null; entry = EntryType.StartOfArray; return; } if (string.Equals(name, JsonConfig.PRIMITIVE_ARRAY_CONTENT_SIG, StringComparison.InvariantCulture) && hintEntry == EntryType.StartOfArray) { valueContent = null; entry = EntryType.PrimitiveArray; return; } if (string.Equals(name, JsonConfig.INTERNAL_REF_SIG, StringComparison.InvariantCulture)) { // It's an object reference without a name // The content is the whole buffer name = null; valueContent = new string(this.buffer, 0, this.bufferIndex + 1); entry = EntryType.InternalReference; return; } if (string.Equals(name, JsonConfig.EXTERNAL_INDEX_REF_SIG, StringComparison.InvariantCulture)) { // It's an external index reference without a name // The content is the whole buffer name = null; valueContent = new string(this.buffer, 0, this.bufferIndex + 1); entry = EntryType.ExternalReferenceByIndex; return; } if (string.Equals(name, JsonConfig.EXTERNAL_GUID_REF_SIG, StringComparison.InvariantCulture)) { // It's an external guid reference without a name // The content is the whole buffer name = null; valueContent = new string(this.buffer, 0, this.bufferIndex + 1); entry = EntryType.ExternalReferenceByGuid; return; } if (string.Equals(name, JsonConfig.EXTERNAL_STRING_REF_SIG, StringComparison.InvariantCulture)) { // It's an external guid reference without a name // The content is the whole buffer name = null; valueContent = new string(this.buffer, 0, this.bufferIndex + 1); entry = EntryType.ExternalReferenceByString; return; } if (this.bufferIndex >= valueSeparatorIndex) { valueContent = new string(this.buffer, valueSeparatorIndex + 1, this.bufferIndex - valueSeparatorIndex); } else { valueContent = null; } if (valueContent != null) { // We can now try to see what the value content actually is, and as such determine the type of the entry if (string.Equals(name, JsonConfig.REGULAR_ARRAY_LENGTH_SIG, StringComparison.InvariantCulture)) // This is a special case for the length entry that must always come before an array { entry = EntryType.StartOfArray; return; } if (string.Equals(name, JsonConfig.PRIMITIVE_ARRAY_LENGTH_SIG, StringComparison.InvariantCulture)) // This is a special case for the length entry that must always come before an array { entry = EntryType.PrimitiveArray; return; } if (valueContent.Length == 0 && hintEntry.HasValue) { entry = hintEntry.Value; return; } if (string.Equals(valueContent, "null", StringComparison.InvariantCultureIgnoreCase)) { entry = EntryType.Null; return; } else if (string.Equals(valueContent, "{", StringComparison.InvariantCulture)) { entry = EntryType.StartOfNode; return; } else if (string.Equals(valueContent, "}", StringComparison.InvariantCulture)) { entry = EntryType.EndOfNode; return; } else if (string.Equals(valueContent, "[", StringComparison.InvariantCulture)) { entry = EntryType.StartOfArray; return; } else if (string.Equals(valueContent, "]", StringComparison.InvariantCulture)) { entry = EntryType.EndOfArray; return; } else if (valueContent.StartsWith(JsonConfig.INTERNAL_REF_SIG, StringComparison.InvariantCulture)) { entry = EntryType.InternalReference; return; } else if (valueContent.StartsWith(JsonConfig.EXTERNAL_INDEX_REF_SIG, StringComparison.InvariantCulture)) { entry = EntryType.ExternalReferenceByIndex; return; } else if (valueContent.StartsWith(JsonConfig.EXTERNAL_GUID_REF_SIG, StringComparison.InvariantCulture)) { entry = EntryType.ExternalReferenceByGuid; return; } else if (valueContent.StartsWith(JsonConfig.EXTERNAL_STRING_REF_SIG, StringComparison.InvariantCulture)) { entry = EntryType.ExternalReferenceByString; return; } else { var guessedPrimitiveType = this.GuessPrimitiveType(valueContent); if (guessedPrimitiveType != null) { entry = guessedPrimitiveType.Value; return; } } } } } if (hintEntry != null) { name = null; valueContent = null; entry = hintEntry.Value; return; } // Parsing the entry somehow failed entirely // This means the JSON was actually invalid if (this.bufferIndex == -1) { this.Context.Config.DebugContext.LogError("Failed to parse empty entry in the stream."); } else { this.Context.Config.DebugContext.LogError("Tried and failed to parse entry with content '" + new string(this.buffer, 0, this.bufferIndex + 1) + "'."); } if (hintEntry == EntryType.EndOfStream) { name = null; valueContent = null; entry = EntryType.EndOfStream; } else { name = null; valueContent = null; entry = EntryType.Invalid; } }
/// <summary> /// Returns the explicit entries of the requested entity. /// Inheritance information is not included. /// The entity must exist. Entity resolution can compensate the entity integrity error. /// </summary> /// <param name="entityId">Id of the entity.</param> /// <param name="relatedIdentities">Optional, can be null. /// If it is provided, the output will be filtered for the related identities. /// Empty collection means nobody, so in case of passing empty, /// the method will return an empty list.</param> /// <param name="entryType">Optional filter parameter.</param> protected List <AceInfo> GetExplicitEntries(int entityId, IEnumerable <int> relatedIdentities = null, EntryType?entryType = null) { return(Evaluator.GetExplicitEntries(entityId, relatedIdentities, entryType)); }
/// <summary> /// Returns an aggregated effective entries of the requested content. /// Inheritance information is not included. /// The content must exist. /// </summary> /// <param name="contentId">Id of the content.</param> /// <param name="relatedIdentities">Optional, can be null. /// If it is provided, the output will be filtered for the related identities. /// Empty collection means: nobody so in case of passing empty, /// the method will return with empty list.</param> /// <param name="entryType">Optional filter parameter. /// If it is provided, the output contains only the matched entries.</param> public new List <AceInfo> GetExplicitEntries(int contentId, IEnumerable <int> relatedIdentities = null, EntryType?entryType = null) { return(base.GetExplicitEntries(contentId, relatedIdentities, entryType)); }
public SearchRouteParams(EntryType?searchType = null) { this.searchType = searchType; }
/// <summary> /// Retrieve a list of entries matching the specified conditions. /// </summary> /// <param name="accountGuid">GUID of the account.</param> /// <param name="startTimeUtc">Start time UTC.</param> /// <param name="endTimeUtc">End time UTC.</param> /// <param name="searchTerm">Search term that must appear in the entry description.</param> /// <param name="entryType">The type of entry.</param> /// <param name="amountMin">Minimum amount.</param> /// <param name="amountMax">Maximum amount.</param> /// <returns>List of matching entries.</returns> public List <Entry> GetEntries( string accountGuid, DateTime?startTimeUtc = null, DateTime?endTimeUtc = null, string searchTerm = null, EntryType?entryType = null, decimal?amountMin = null, decimal?amountMax = null) { if (startTimeUtc != null && endTimeUtc != null) { if (DateTime.Compare(Convert.ToDateTime(endTimeUtc), Convert.ToDateTime(startTimeUtc)) < 0) { throw new ArgumentException("Specified end time must be later than the specified start time."); } } if (amountMin != null && amountMin.Value < 0) { throw new ArgumentException("Minimum amount must be zero or greater."); } if (amountMax != null && amountMax.Value < 0) { throw new ArgumentException("Maximum amount must be zero or greater."); } if (String.IsNullOrEmpty(accountGuid)) { throw new ArgumentNullException(nameof(accountGuid)); } Account a = GetAccountByGuidInternal(accountGuid); if (a == null) { throw new KeyNotFoundException("Unable to find account with GUID " + accountGuid + "."); } try { LockAccount(accountGuid); DbExpression e2 = new DbExpression(_ORM.GetColumnName <Entry>(nameof(Entry.AccountGUID)), DbOperators.Equals, accountGuid); if (startTimeUtc != null) { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.CreatedUtc)), DbOperators.GreaterThanOrEqualTo, startTimeUtc.Value); } if (endTimeUtc != null) { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.CreatedUtc)), DbOperators.LessThanOrEqualTo, endTimeUtc.Value); } if (!String.IsNullOrEmpty(searchTerm)) { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.Description)), DbOperators.Contains, searchTerm); } if (amountMin != null) { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.Amount)), DbOperators.GreaterThanOrEqualTo, amountMin.Value); } if (amountMax != null) { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.Amount)), DbOperators.LessThanOrEqualTo, amountMax.Value); } if (entryType != null) { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.Type)), DbOperators.Equals, entryType); } else { e2.PrependAnd(_ORM.GetColumnName <Entry>(nameof(Entry.Type)), DbOperators.NotEquals, EntryType.Balance); } DbResultOrder[] ro = new DbResultOrder[1]; ro[0] = new DbResultOrder(_ORM.GetColumnName <Entry>(nameof(Entry.CreatedUtc)), DbOrderDirection.Descending); return(_ORM.SelectMany <Entry>(null, null, e2, ro)); } finally { UnlockAccount(accountGuid); } }
/// <summary> /// Returns the current content's effective entries. Current user must have SeePermissions permission. /// </summary> /// <param name="entryType">Security entry type. Default: all entries.</param> public List <AceInfo> GetEffectiveEntries(EntryType?entryType = null) { return(_securityHandler.GetEffectiveEntries(_node.Id, null, entryType)); }
/// <summary> /// Tries to enter a node. This will succeed if the next entry is an <see cref="EntryType.StartOfNode" />. /// <para /> /// This call MUST (eventually) be followed by a corresponding call to <see cref="IDataReader.ExitNode(DeserializationContext)" /><para /> /// This call will change the values of the <see cref="IDataReader.IsInArrayNode" />, <see cref="IDataReader.CurrentNodeName" />, <see cref="IDataReader.CurrentNodeId" /> and <see cref="IDataReader.CurrentNodeDepth" /> properties to the correct values for the current node. /// </summary> /// <param name="type">The type of the node. This value will be null if there was no metadata, or if the reader's serialization binder failed to resolve the type name.</param> /// <returns> /// <c>true</c> if entering a node succeeded, otherwise <c>false</c> /// </returns> public override bool EnterNode(out Type type) { this.PeekEntry(); if (this.peekedEntryType == EntryType.StartOfNode) { string nodeName = this.peekedEntryName; int id = -1; this.ReadToNextEntry(); if (this.peekedEntryName == JsonConfig.ID_SIG) { if (int.TryParse(this.peekedEntryContent, NumberStyles.Any, CultureInfo.InvariantCulture, out id) == false) { this.Context.Config.DebugContext.LogError("Failed to parse id: " + this.peekedEntryContent); id = -1; } this.ReadToNextEntry(); } if (this.peekedEntryName == JsonConfig.TYPE_SIG && this.peekedEntryContent != null && this.peekedEntryContent.Length > 0) { if (this.peekedEntryType == EntryType.Integer) { int typeID; if (this.ReadInt32(out typeID)) { if (this.seenTypes.TryGetValue(typeID, out type) == false) { this.Context.Config.DebugContext.LogError("Missing type id for node with reference id " + id + ": " + typeID); } } else { this.Context.Config.DebugContext.LogError("Failed to read type id for node with reference id " + id); type = null; } } else { int typeNameStartIndex = 1; int typeID = -1; int idSplitIndex = this.peekedEntryContent.IndexOf('|'); if (idSplitIndex >= 0) { typeNameStartIndex = idSplitIndex + 1; string idStr = this.peekedEntryContent.Substring(1, idSplitIndex - 1); if (int.TryParse(idStr, NumberStyles.Any, CultureInfo.InvariantCulture, out typeID) == false) { typeID = -1; } } type = this.Binder.BindToType(this.peekedEntryContent.Substring(typeNameStartIndex, this.peekedEntryContent.Length - (1 + typeNameStartIndex)), this.Context.Config.DebugContext); if (typeID >= 0) { this.seenTypes[typeID] = type; } this.peekedEntryType = null; } } else { type = null; } this.PushNode(nodeName, id, type); return(true); } else { this.SkipEntry(); type = null; return(false); } }