예제 #1
0
        private void load_customers()
        {
            string sql_stmt = "SELECT CustomerID, CustomerName, Occupation, PhysicalAddress, Telephone FROM customers;";
                DataTable dtCustomers = clsPublicMethods.DBUtilies.get_data_table(sql_stmt);

                dgvList.DataSource = dtCustomers;

                lblDataGridCaption.Text = "Customers Listing";
                btnPrintPreview.ToolTipText = "Customers Listing Report Print Preview";
                current_list = ListOptions.Customers;
        }
예제 #2
0
 private void Run(ListOptions o)
 {
     _exit = false;
     Log.Debug("Mode: list");
     ShowUpdateDialog();
 }
예제 #3
0
 /// <summary>
 /// Get a list of recent outbound faxes (which does not include batch faxes).
 /// </summary>
 /// <param name="listOptions"></param>
 public async Task <IEnumerable <OutboundFaxSummary> > GetList(ListOptions listOptions = null)
 {
     return(await _interfax.HttpClient.GetResourceAsync <IEnumerable <OutboundFaxSummary> >(ResourceUri, listOptions));
 }
예제 #4
0
        public async Task <PagedList <SubjectModel> > GetSubjectsAsync(Guid groupId, Guid semesterId, ListOptions listOptions)
        {
            var query = Context.SelectSubjectByGroupAndSemester(groupId, semesterId);

            //var query = from subject in Context.Subjects
            //    join gss in Context.GroupSemesterSubjects on subject.Id equals gss.SubjectId
            //    join gs in Context.GroupSemesters on gss.GroupSemesterId equals gs.Id
            //    where gs.GroupId == groupId && gs.SemesterId == semesterId
            //    orderby subject.Name
            //    select new Subject {Id = gss.Id, Name = subject.Name};

            var result = new PagedList <SubjectModel>();

            //if (listOptions != null)
            //{
            //    query = query.Skip(listOptions.Offset).Take(listOptions.PageSize);
            //    result.Page = listOptions.Page;
            //    result.PageSize = listOptions.PageSize;
            //}

            var subjects = await query.ToListAsync();

            result.AddRange(Mapper.Map <IEnumerable <Subject>, IEnumerable <SubjectModel> >(subjects));
            return(result);
        }
 public async Task <ActionResult <ListResponse <TypeFoodResponse> > > GetTypeFoodsListAsync([FromQuery] TypeFoodFilter typeFood, [FromQuery] ListOptions options, [FromServices] ListQuery <TypeFoodResponse, TypeFoodFilter> query) =>
 await query.RunAsync(typeFood, options);
예제 #6
0
        /// <summary>
        /// Lists all objects with the given tag.
        /// </summary>
        /// <param name="tag">Tag the tag to search for</param>
        /// <param name="options">Options for listing the objects. After calling ListObjects, be sure to check the value of the token property to see if there are additional results.</param>
        /// <returns>The list of objects with the given tag.  If no objects are found the array will be empty.</returns>
        /// <exception cref="T:EsuApiLib.EsuException">if no objects are found (code 1003)</exception>
        public List<ObjectResult> ListObjects(string tag, ListOptions options)
        {
            HttpWebResponse resp = null;
            try
            {
                string resource = context + "/objects";
                Uri u = buildUrl(resource);
                HttpWebRequest con = createWebRequest(u);

                // Build headers
                Dictionary<string, string> headers = new Dictionary<string, string>();

                headers.Add("x-emc-uid", uid);
                if (utf8Enabled) headers.Add("x-emc-utf8", "true");

                // Add tag
                if (tag != null)
                {
                    headers.Add("x-emc-tags", utf8Enabled ? utf8Encode(tag) : tag);
                }
                else
                {
                    throw new EsuException("tag may not be null");
                }

                if (options != null)
                {
                    if (options.IncludeMetadata)
                    {
                        headers.Add("x-emc-include-meta", "1");
                        if (options.SystemMetadata != null)
                        {
                            headers.Add("x-emc-system-tags",
                                    join(options.SystemMetadata, ","));
                        }
                        if (options.UserMetadata != null)
                        {
                            headers.Add("x-emc-user-tags",
                                    join(options.UserMetadata, ","));
                        }
                    }
                    if (options.Limit > 0)
                    {
                        headers.Add("x-emc-limit", "" + options.Limit);
                    }
                    if (options.Token != null)
                    {
                        headers.Add("x-emc-token", options.Token);
                    }

                }

                // Add date
                addDateHeader(headers);

                // Sign request
                signRequest(con, "GET", resource, headers);

                // Check response
                resp = (HttpWebResponse)con.GetResponse();
                int statInt = (int)resp.StatusCode;
                if (statInt > 299)
                {
                    handleError(resp);
                }

                // Check for token
                if (options != null)
                {
                    if (resp.Headers["x-emc-token"] != null)
                    {
                        options.Token = resp.Headers["x-emc-token"];
                    }
                    else
                    {
                        // No more results
                        options.Token = null;
                    }
                }
                else
                {
                    if (resp.Headers["x-emc-token"] != null)
                    {
                        // There are more results available, but no ListOptions
                        // object to receive the token. Issue a warning.
                        log.TraceEvent(TraceEventType.Warning, 1, "Results truncated.  Use ListOptions paramter to retrieve the token value for more results");
                    }
                }

                // Get object id list from response
                byte[] response = readResponse(resp, null, null);

                string responseStr = Encoding.UTF8.GetString(response);
                log.TraceEvent(TraceEventType.Verbose, 0, "Response: " + responseStr);

                return parseObjectListWithMetadata(responseStr);

            }
            catch (UriFormatException e)
            {
                throw new EsuException("Invalid URL", e);
            }
            catch (IOException e)
            {
                throw new EsuException("Error connecting to server", e);
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                    handleError((HttpWebResponse)e.Response);
                }
                else
                {
                    throw new EsuException("Error executing request: " + e.Message, e);
                }
            }
            finally
            {
                if (resp != null)
                {
                    resp.Close();
                }
            }
            return null;
        }
예제 #7
0
 public virtual Task <StripeList <TestEntity> > ListAsync(ListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(this.ListEntitiesAsync(options, requestOptions, cancellationToken));
 }
예제 #8
0
        protected override async Task <IReadOnlyCollection <Blob> > ListAtAsync(string path, ListOptions options, CancellationToken cancellationToken)
        {
            IEnumerable <ObjectInfo> objects = await _api.List(StoragePath.Normalize(path)).ConfigureAwait(false);

            return(objects.Select(ToBlob).Where(b => b != null).ToList());
        }
 public async Task <IActionResult> GetTasksListAsync(TaskFilter filter, ListOptions options)
 {
     throw new NotImplementedException();
 }
예제 #10
0
        private static IReadOnlyCollection <Blob> ToBlobs(string path, ListObjectsV2Response response, ListOptions options)
        {
            var result = new List <Blob>();

            //the files are listed as the S3Objects member, but they don't specifically contain folders,
            //but even if they do, they need to be filtered out

            result.AddRange(
                response.S3Objects
                .Where(b => !b.Key.EndsWith("/")) //check if this is "virtual folder" as S3 console creates them (rubbish)
                .Select(ToBlob)
                .Where(options.IsMatch)
                .Where(b => options.BrowseFilter == null || options.BrowseFilter(b)));

            //subfolders are listed in another field (what a funny name!)

            //prefix is absolute too
            result.AddRange(
                response.CommonPrefixes
                .Select(p => new Blob(p, BlobItemKind.Folder)));

            return(result);
        }
예제 #11
0
 public async Task <ActionResult <ListResponse <UserResponse> > > GetUsersListAsync([FromQuery] UserFilter filter, [FromQuery] ListOptions options, [FromServices] ListQuery <UserResponse, UserFilter> query) =>
 await query.RunAsync(filter, options);
예제 #12
0
    public static async Task RenderMemberList(this Context ctx, LookupContext lookupCtx,
                                              SystemId system, string embedTitle, string color, ListOptions opts)
    {
        // We take an IDatabase instead of a IPKConnection so we don't keep the handle open for the entire runtime
        // We wanna release it as soon as the member list is actually *fetched*, instead of potentially minutes later (paginate timeout)
        var members = (await ctx.Database.Execute(conn => conn.QueryMemberList(system, opts.ToQueryOptions())))
                      .SortByMemberListOptions(opts, lookupCtx)
                      .ToList();

        var itemsPerPage = opts.Type == ListType.Short ? 25 : 5;
        await ctx.Paginate(members.ToAsyncEnumerable(), members.Count, itemsPerPage, embedTitle, color, Renderer);

        // Base renderer, dispatches based on type
        Task Renderer(EmbedBuilder eb, IEnumerable <ListedMember> page)
        {
            // Add a global footer with the filter/sort string + result count
            eb.Footer(new Embed.EmbedFooter($"{opts.CreateFilterString()}. {"result".ToQuantity(members.Count)}."));

            // Then call the specific renderers
            if (opts.Type == ListType.Short)
            {
                ShortRenderer(eb, page);
            }
            else
            {
                LongRenderer(eb, page);
            }

            return(Task.CompletedTask);
        }

        void ShortRenderer(EmbedBuilder eb, IEnumerable <ListedMember> page)
        {
            // We may end up over the description character limit
            // so run it through a helper that "makes it work" :)
            eb.WithSimpleLineContent(page.Select(m =>
            {
                var ret = $"[`{m.Hid}`] **{m.NameFor(ctx)}** ";

                switch (opts.SortProperty)
                {
                case SortProperty.Birthdate:
                    {
                        var birthday = m.BirthdayFor(lookupCtx);
                        if (birthday != null)
                        {
                            ret += $"(birthday: {m.BirthdayString})";
                        }
                        break;
                    }

                case SortProperty.DisplayName:
                    {
                        if (m.DisplayName != null && m.NamePrivacy.CanAccess(lookupCtx))
                        {
                            ret += $"({m.DisplayName})";
                        }
                        break;
                    }

                case SortProperty.MessageCount:
                    {
                        if (m.MessageCountFor(lookupCtx) is { } count)
                        {
                            ret += $"({count} messages)";
                        }
                        break;
                    }

                case SortProperty.LastSwitch:
                    {
                        if (m.MetadataPrivacy.TryGet(lookupCtx, m.LastSwitchTime, out var lastSw))
                        {
                            ret += $"(last switched in: <t:{lastSw.Value.ToUnixTimeSeconds()}>)";
                        }
                        break;
                    }

                // case SortProperty.LastMessage:
                //     {
                //         if (m.MetadataPrivacy.TryGet(lookupCtx, m.LastMessage, out var lastMsg))
                //             ret += $"(last message: <t:{DiscordUtils.SnowflakeToInstant(lastMsg.Value).ToUnixTimeSeconds()}>)";
                //         break;
                //     }
                case SortProperty.CreationDate:
                    {
                        if (m.MetadataPrivacy.TryGet(lookupCtx, m.Created, out var created))
                        {
                            ret += $"(created at <t:{created.ToUnixTimeSeconds()}>)";
                        }
                        break;
                    }

                default:
                    {
                        if (opts.IncludeMessageCount && m.MessageCountFor(lookupCtx) is { } count)
                        {
                            ret += $"({count} messages)";
                        }
예제 #13
0
    public static ListOptions ParseListOptions(this Context ctx, LookupContext lookupCtx)
    {
        var p = new ListOptions();

        // Short or long list? (parse this first, as it can potentially take a positional argument)
        var isFull = ctx.Match("f", "full", "big", "details", "long") || ctx.MatchFlag("f", "full");

        p.Type = isFull ? ListType.Long : ListType.Short;

        // Search query
        if (ctx.HasNext())
        {
            p.Search = ctx.RemainderOrNull();
        }

        // Include description in search?
        if (ctx.MatchFlag(
                "search-description",
                "filter-description",
                "in-description",
                "sd",
                "description",
                "desc"
                ))
        {
            p.SearchDescription = true;
        }

        // Sort property (default is by name, but adding a flag anyway, 'cause why not)
        if (ctx.MatchFlag("by-name", "bn"))
        {
            p.SortProperty = SortProperty.Name;
        }
        if (ctx.MatchFlag("by-display-name", "bdn"))
        {
            p.SortProperty = SortProperty.DisplayName;
        }
        if (ctx.MatchFlag("by-id", "bid"))
        {
            p.SortProperty = SortProperty.Hid;
        }
        if (ctx.MatchFlag("by-message-count", "bmc"))
        {
            p.SortProperty = SortProperty.MessageCount;
        }
        if (ctx.MatchFlag("by-created", "bc", "bcd"))
        {
            p.SortProperty = SortProperty.CreationDate;
        }
        if (ctx.MatchFlag("by-last-fronted", "by-last-front", "by-last-switch", "blf", "bls"))
        {
            p.SortProperty = SortProperty.LastSwitch;
        }
        if (ctx.MatchFlag("by-last-message", "blm", "blp"))
        {
            p.SortProperty = SortProperty.LastMessage;
        }
        if (ctx.MatchFlag("by-birthday", "by-birthdate", "bbd"))
        {
            p.SortProperty = SortProperty.Birthdate;
        }
        if (ctx.MatchFlag("random"))
        {
            p.SortProperty = SortProperty.Random;
        }

        // Sort reverse?
        if (ctx.MatchFlag("r", "rev", "reverse"))
        {
            p.Reverse = true;
        }

        // Privacy filter (default is public only)
        if (ctx.MatchFlag("a", "all"))
        {
            p.PrivacyFilter = null;
        }
        if (ctx.MatchFlag("private-only", "po"))
        {
            p.PrivacyFilter = PrivacyLevel.Private;
        }

        // PERM CHECK: If we're trying to access non-public members of another system, error
        if (p.PrivacyFilter != PrivacyLevel.Public && lookupCtx != LookupContext.ByOwner)
        {
            // TODO: should this just return null instead of throwing or something? >.>
            throw Errors.NotOwnInfo;
        }

        // Additional fields to include in the search results
        if (ctx.MatchFlag("with-last-switch", "with-last-fronted", "with-last-front", "wls", "wlf"))
        {
            p.IncludeLastSwitch = true;
        }
        if (ctx.MatchFlag("with-last-message", "with-last-proxy", "wlm", "wlp"))
        {
            throw new PKError("Sorting by last message is temporarily disabled due to database issues, sorry.");
        }
        // p.IncludeLastMessage = true;
        if (ctx.MatchFlag("with-message-count", "wmc"))
        {
            p.IncludeMessageCount = true;
        }
        if (ctx.MatchFlag("with-created", "wc"))
        {
            p.IncludeCreated = true;
        }
        if (ctx.MatchFlag("with-avatar", "with-image", "with-icon", "wa", "wi", "ia", "ii", "img"))
        {
            p.IncludeAvatar = true;
        }
        if (ctx.MatchFlag("with-pronouns", "wp", "wprns"))
        {
            p.IncludePronouns = true;
        }
        if (ctx.MatchFlag("with-displayname", "wdn"))
        {
            p.IncludeDisplayName = true;
        }

        // Always show the sort property, too
        if (p.SortProperty == SortProperty.LastSwitch)
        {
            p.IncludeLastSwitch = true;
        }
        if (p.SortProperty == SortProperty.LastMessage)
        {
            p.IncludeLastMessage = true;
        }
        if (p.SortProperty == SortProperty.MessageCount)
        {
            p.IncludeMessageCount = true;
        }
        if (p.SortProperty == SortProperty.CreationDate)
        {
            p.IncludeCreated = true;
        }

        // Done!
        return(p);
    }
예제 #14
0
 public Task <TelnyxList <WDRReportsRecord> > ListAsync(ListOptions listOptions = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
 {
     return(this.ListEntitiesAsync(listOptions, requestOptions, cancellationToken));
 }
예제 #15
0
        private void load_returned_movies()
        {
            string sql_stmt = "SELECT RefNo, CustomerName, MovieTitle, DateIssued, ReturnDate, NumberOfDays, RentalPrice, TotalCharges FROM query_returned_movies;";
                DataTable dtIssuedMovies = clsPublicMethods.DBUtilies.get_data_table(sql_stmt);

                dgvList.DataSource = dtIssuedMovies;

                lblDataGridCaption.Text = "Returned Movies Listing";
                btnPrintPreview.ToolTipText = "Returned Movies Listing Report Print Preview";
                current_list = ListOptions.ReturnedMovies;
        }
예제 #16
0
        static void List(ListOptions options)
        {
            OnMov200 onMov200 = new OnMov200(options.RootDir, options.OutputDir);

            onMov200.PrintSummary();
        }
예제 #17
0
        /// <summary>
        /// Lists the contents of a directory.
        /// </summary>
        /// <param name="path">the path to list.  Must be a directory.</param>
        /// <param name="options">Options for listing the objects. After calling 
        /// ListObjects, be sure to check the value of the token property to see 
        /// if there are additional results.</param>
        /// <returns>the directory entries in the directory.</returns>
        public List<DirectoryEntry> ListDirectory( ObjectPath path, ListOptions options )
        {
            HttpWebResponse resp = null;
            if (!path.IsDirectory())
            {
                throw new EsuException("listDirectory must be called with a directory path");
            }

            try {

                string resource = getResourcePath(context, path);
                Uri u = buildUrl(resource);
                HttpWebRequest con = createWebRequest(u);

                // Build headers
                Dictionary<string, string> headers = new Dictionary<string, string>();

                headers.Add("x-emc-uid", uid);
                if (utf8Enabled) headers.Add("x-emc-utf8", "true");

                if (options != null)
                {
                    if (options.IncludeMetadata)
                    {
                        headers.Add("x-emc-include-meta", "true");
                        if (options.SystemMetadata != null)
                        {
                            headers.Add("x-emc-system-tags",
                                    join(options.SystemMetadata, ","));
                        }
                        if (options.UserMetadata != null)
                        {
                            headers.Add("x-emc-user-tags",
                                    join(options.UserMetadata, ","));
                        }
                    }
                    if (options.Limit > 0)
                    {
                        headers.Add("x-emc-limit", "" + options.Limit);
                    }
                    if (options.Token != null)
                    {
                        headers.Add("x-emc-token", options.Token);
                    }
                }

                // Add date
                addDateHeader(headers);

                // Sign request
                signRequest(con, "GET", resource, headers);

                // Check response
                resp = (HttpWebResponse)con.GetResponse();
                int statInt = (int)resp.StatusCode;
                if (statInt > 299)
                {
                    handleError(resp);
                }

                byte[] responseBuffer = readResponse(resp, null, null);

                // Check for token
                if (options != null)
                {
                    if (resp.Headers["x-emc-token"] != null)
                    {
                        options.Token = resp.Headers["x-emc-token"];
                    }
                    else
                    {
                        // No more results
                        options.Token = null;
                    }
                }
                else
                {
                    if (resp.Headers["x-emc-token"] != null)
                    {
                        // There are more results available, but no ListOptions
                        // object to receive the token. Issue a warning.
                        log.TraceEvent(TraceEventType.Warning, 1, "Results truncated.  Use ListOptions paramter to retrieve the token value for more results");
                    }
                }

                return parseDirectoryList(responseBuffer, path);
            }
            catch (IOException e)
            {
                throw new EsuException("Error connecting to server", e);
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                    handleError((HttpWebResponse)e.Response);
                }
                else
                {
                    throw new EsuException("Error executing request: " + e.Message, e);
                }
            }
            finally
            {
                if (resp != null)
                {
                    resp.Close();
                }
            }
            return null;
        }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XElementListMaterializer{TCommand, TParameter}"/> class.
 /// </summary>
 /// <param name="commandBuilder">The command builder.</param>
 /// <param name="columnName">Name of the desired column.</param>
 /// <param name="listOptions">The list options.</param>
 public XElementListMaterializer(DbCommandBuilder <TCommand, TParameter> commandBuilder, string?columnName = null, ListOptions listOptions = ListOptions.None)
     : base(commandBuilder, columnName, listOptions, false)
 {
 }
예제 #19
0
 public TelnyxList <WDRReportsRecord> List(ListOptions listOptions = null, RequestOptions requestOptions = null)
 {
     return(this.ListEntities(listOptions, requestOptions));
 }
예제 #20
0
        public async Task <PagedList <GroupModel> > GetGroupsAsync(string searchString, ListOptions listOptions = null)
        {
            Expression <Func <Group, bool> > predicate = g => true;

            if (string.IsNullOrEmpty(searchString))
            {
                predicate.AndAlso(g => g.Name.ToLower().StartsWith(searchString.ToLower()));
            }

            var query = Context.Groups.OrderBy(g => g.Name).Where(predicate).AsQueryable();
            int count = await Context.Groups.CountAsync(predicate);

            var list = listOptions.CreatePagedList <GroupModel>(count);

            query = listOptions.TakeFrom(query);
            var groups = await query.Select(g => new GroupModel {
                Id = g.Id, Name = g.Name
            }).ToListAsync();

            list.AddRange(groups);

            return(list);
        }
예제 #21
0
 public virtual IEnumerable <TestEntity> ListAutoPaging(ListOptions options = null, RequestOptions requestOptions = null)
 {
     return(this.ListEntitiesAutoPaging(options, requestOptions));
 }
예제 #22
0
        public async Task <IActionResult> GetProjectsListAsync(ProjectFilter filter, ListOptions options, [FromServices] IProjectsListQuery query)
        {
            var response = await query.RunAsync(filter, options);

            return(Ok(response));
        }
예제 #23
0
 public override Task <IReadOnlyCollection <Blob> > ListAsync(
     ListOptions options, CancellationToken cancellationToken)
 {
     return(_extended.ListAsync(options, cancellationToken));
 }
예제 #24
0
 public virtual IAsyncEnumerable <TestEntity> ListAutoPagingAsync(ListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
 {
     return(this.ListEntitiesAutoPagingAsync(options, requestOptions, cancellationToken));
 }
예제 #25
0
 public static IQueryable <T> TakeFrom <T>(this ListOptions listOptions, IQueryable <T> query)
 {
     return(listOptions != null?query.Skip(listOptions.Offset).Take(listOptions.PageSize) : query);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DateTimeOffsetListMaterializer{TCommand, TParameter}"/> class.
 /// </summary>
 /// <param name="commandBuilder">The command builder.</param>
 /// <param name="listOptions">The list options.</param>
 /// <param name="columnName">Name of the desired column.</param>
 public DateTimeOffsetSetMaterializer(DbCommandBuilder <TCommand, TParameter> commandBuilder, string?columnName = null, ListOptions listOptions = ListOptions.None)
     : base(commandBuilder, columnName, listOptions)
 {
 }
예제 #27
0
 /// <summary>
 /// </summary>
 /// <param name="commandBuilder">The command builder.</param>
 /// <param name="listOptions">The list options.</param>
 /// <param name="columnName">Name of the desired column.</param>
 public GuidListMaterializer(DbCommandBuilder <TCommand, TParameter> commandBuilder, string?columnName = null, ListOptions listOptions = ListOptions.None)
     : base(commandBuilder, columnName)
 {
     m_ListOptions = listOptions;
 }
예제 #28
0
        private async Task <IReadOnlyCollection <Blob> > ListPathAsync(string path, int?maxResults, ListOptions options, CancellationToken cancellationToken)
        {
            //get filesystem name and folder path
            string[] parts = StoragePath.Split(path);

            string fs           = parts[0];
            string relativePath = StoragePath.Combine(parts.Skip(1));

            PathList list;

            try
            {
                list = await _api.ListPathAsync(fs, relativePath, recursive : options.Recurse).ConfigureAwait(false);
            }
            catch (ApiException ex) when(ex.StatusCode == HttpStatusCode.NotFound)
            {
                // specified path is not found, nothing serious
                return(new List <Blob>());
            }

            IEnumerable <Blob> result = list.Paths.Select(p => LConvert.ToBlob(fs, p));

            if (options.FilePrefix != null)
            {
                result = result.Where(b => b.IsFolder || b.Name.StartsWith(options.FilePrefix));
            }

            if (options.BrowseFilter != null)
            {
                result = result.Where(b => options.BrowseFilter(b));
            }

            if (maxResults != null)
            {
                result = result.Take(maxResults.Value);
            }

            return(result.ToList());
        }
예제 #29
0
파일: GConvert.cs 프로젝트: zihotki/storage
        public static async Task <IReadOnlyCollection <Blob> > ToBlobsAsync(PagedAsyncEnumerable <Objects, Object> pae, ListOptions options)
        {
            var result = new List <Blob>();

#pragma warning disable IDE0008 // Use explicit type (async enumerator conflict)
            using (var enumerator = pae.GetEnumerator())
#pragma warning restore IDE0008 // Use explicit type
            {
                while (await enumerator.MoveNext().ConfigureAwait(false))
                {
                    Object go = enumerator.Current;

                    Blob blob = ToBlob(go);

                    if (options.FilePrefix != null && !blob.Name.StartsWith(options.FilePrefix))
                    {
                        continue;
                    }

                    if (options.BrowseFilter != null && !options.BrowseFilter(blob))
                    {
                        continue;
                    }

                    result.Add(blob);

                    if (options.MaxResults != null && result.Count >= options.MaxResults.Value)
                    {
                        break;
                    }
                }
            }

            return(result);
        }
예제 #30
0
 public void OneTime()
 {
     Options  = new ListOptions();
     template = SingleAssetLoader.Load <VisualTreeAsset>(Options.TemplateName);
 }
예제 #31
0
        private void load_movies()
        {
            string sql_stmt = "SELECT * FROM movies;";
                DataTable dtMovies = clsPublicMethods.DBUtilies.get_data_table(sql_stmt);

                dgvList.DataSource = dtMovies;

                lblDataGridCaption.Text = "Movies Listing";
                btnPrintPreview.ToolTipText = "Movies Listing Report Print Preview";
                current_list = ListOptions.Movies;
        }
예제 #32
0
 public IEnumerable <Subscription> List(string customerId, ListOptions listOptions = null)
 {
     return(_stripeSubscriptionService.List(new SubscriptionListOptions {
         Customer = customerId
     }));
 }
예제 #33
0
        /// <summary>
        /// Lists all access tokens owned by the user using the options provided.
        /// </summary>
        /// <param name="options">Options for listing the objects. After calling 
        /// ListAccessTokens, be sure to check the value of the token property to see 
        /// if there are additional results.</param>
        /// <returns>The list of access tokens that the user has created</returns>
        public List<AccessTokenType> ListAccessTokens(ListOptions options)
        {
            HttpWebResponse resp = null;
            try
            {
                string resource = context + "/accesstokens";
                Uri u = buildUrl(resource);
                HttpWebRequest con = createWebRequest(u);

                // Build headers
                Dictionary<string, string> headers = new Dictionary<string, string>();

                headers.Add("x-emc-uid", uid);

                if (options != null)
                {
                    if (options.Limit > 0)
                    {
                        headers.Add("x-emc-limit", "" + options.Limit);
                    }
                    if (options.Token != null)
                    {
                        headers.Add("x-emc-token", options.Token);
                    }

                }

                // Add date
                addDateHeader(headers);

                // Sign request
                signRequest(con, "GET", resource, headers);

                // Check response
                resp = (HttpWebResponse)con.GetResponse();
                int statInt = (int)resp.StatusCode;
                if (statInt > 299)
                {
                    handleError(resp);
                }

                // Check for token
                if (options != null)
                {
                    if (resp.Headers["x-emc-token"] != null)
                    {
                        options.Token = resp.Headers["x-emc-token"];
                    }
                    else
                    {
                        // No more results
                        options.Token = null;
                    }
                }
                else
                {
                    if (resp.Headers["x-emc-token"] != null)
                    {
                        // There are more results available, but no ListOptions
                        // object to receive the token. Issue a warning.
                        log.TraceEvent(TraceEventType.Warning, 1, "Results truncated.  Use ListOptions paramter to retrieve the token value for more results");
                    }
                }

                XmlSerializer serializer = new XmlSerializer(typeof(ListAccessTokenResultType));
                ListAccessTokenResultType result = (ListAccessTokenResultType)serializer.Deserialize(resp.GetResponseStream());
                resp.Close();

                return new List<AccessTokenType>(result.AccessTokensList);
            }
            catch (UriFormatException e)
            {
                throw new EsuException("Invalid URL", e);
            }
            catch (IOException e)
            {
                throw new EsuException("Error connecting to server", e);
            }
            catch (WebException e)
            {
                if (e.Response != null)
                {
                    handleError((HttpWebResponse)e.Response);
                }
                else
                {
                    throw new EsuException("Error executing request: " + e.Message, e);
                }
            }
            finally
            {
                if (resp != null)
                {
                    resp.Close();
                }
            }
            return null;
        }
예제 #34
0
 public Task <IReadOnlyCollection <Blob> > ListAsync(ListOptions options = null, CancellationToken cancellationToken = default)
 {
     return(_parent.ListAsync(options, cancellationToken));
 }
예제 #35
0
 /// <summary>
 /// Lists all objects with the given tag.
 /// </summary>
 /// <param name="tag">Tag the tag to search for</param>
 /// <param name="options">Options for listing the objects. After calling ListObjects, be sure to check the value of the token property to see if there are additional results.</param>
 /// <returns>The list of objects with the given tag.  If no objects are found the array will be empty.</returns>
 /// <exception cref="T:EsuApiLib.EsuException">if no objects are found (code 1003)</exception>
 public List<ObjectResult> ListObjects(MetadataTag tag, ListOptions options)
 {
     return ListObjects( tag.Name, options );
 }
예제 #36
0
 public virtual StripeList <TestEntity> List(ListOptions options = null, RequestOptions requestOptions = null)
 {
     return(this.ListEntities(options, requestOptions));
 }
예제 #37
0
 /// <summary>
 /// Lists all objects with the given tag.  This method returns both the objects' IDs as well
 /// as their metadata.
 /// </summary>
 /// <param name="tag">Tag the tag to search for</param>
 /// <returns>The list of objects with the given tag.  If no objects are found the array will be empty.</returns>
 /// <exception cref="T:EsuApiLib.EsuException">if no objects are found (code 1003)</exception>
 public List<ObjectResult> ListObjectsWithMetadata(string tag)
 {
     ListOptions options = new ListOptions();
     options.IncludeMetadata = true;
     return ListObjects(tag, options);
 }
예제 #38
0
        public override LoadResult <TR> FindAs <TR>(Expression <Func <Role, TR> > exp, ListOptions <TR> opts, Expression <Func <Role, bool> > cond = null)
        {
            var q = Loader.Where(d => !d.IsUserRole);

            if (cond != null)
            {
                q = q.Where(cond);
            }

            return(q.Select(exp).LoadWith(opts));
        }