Ejemplo n.º 1
0
 public TimeseriesDataAndMetadata(int?limit, Transform?transform, int?column_index, List <string> column_names, DateTime?start_date,
                                  DateTime?end_date, string frequency, List <object[]> data, Collapse?collapse, Order?order, int id, string database_code, string dataset_code,
                                  string name, string description, DateTime?refreshed_at, DateTime?newest_available_date, DateTime?oldest_available_date, string type,
                                  bool?premium, int database_id)
 {
     Limit               = limit;
     Transform           = transform;
     ColumnIndex         = column_index;
     ColumnNames         = column_names;
     StartDate           = start_date;
     EndDate             = end_date;
     Frequency           = frequency;
     Data                = data;
     Collapse            = collapse;
     Order               = order;
     Id                  = id;
     DatabaseCode        = database_code;
     DatasetCode         = dataset_code;
     Name                = name;
     Description         = description;
     RefreshedAt         = refreshed_at;
     NewestAvailableDate = newest_available_date;
     OldestAvailableDate = oldest_available_date;
     Type                = type;
     Premium             = premium;
     DatabaseId          = database_id;
 }
Ejemplo n.º 2
0
 public FragenZurWurstRecognizerResult(Order?order, bool confirmOrder, bool declineOrder)
     : this()
 {
     this.order        = order;
     this.confirmOrder = confirmOrder;
     this.declineOrder = declineOrder;
 }
Ejemplo n.º 3
0
        public int Compare(Order?x, Order?y)
        {
            if (x == null)
            {
                throw new ArgumentNullException(nameof(x));
            }

            if (y == null)
            {
                throw new ArgumentNullException(nameof(y));
            }

            if (x.Sequnce < y.Sequnce)
            {
                return(-1);
            }
            else if (x.Sequnce > y.Sequnce)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 4
0
        public static Task <string> GetMylistSearchDataAsync(
            NiconicoContext context
            , string str
            , uint from
            , uint limit
            , Sort?sort
            , Order?order
            )
        {
            var dict = new Dictionary <string, string>();

            dict.Add("__format", "json");

            dict.Add(nameof(str), str);
            dict.Add(nameof(from), from.ToString());
            dict.Add(nameof(limit), limit.ToString());
            if (order.HasValue)
            {
                dict.Add(nameof(order), order.Value.ToChar().ToString());
            }

            if (sort.HasValue)
            {
                dict.Add(nameof(sort), sort.Value.ToShortString());
            }


            return(context.GetStringAsync(NiconicoUrls.NICOVIDEO_CE_NICOAPI_V1_MYLIST_SEARCH, dict));
        }
Ejemplo n.º 5
0
        public async Task <Mntone.Nico2.Searches.Live.NicoliveVideoResponse> LiveSearchAsync(
            string word,
            bool isTagSearch,
            Mntone.Nico2.Live.CommunityType?provider = null,
            uint from   = 0,
            uint length = 30,
            Order?order = null,
            Mntone.Nico2.Searches.Live.NicoliveSearchSort?sort = null,
            Mntone.Nico2.Searches.Live.NicoliveSearchMode?mode = null
            )
        {
            if (_HohoemaApp.NiconicoContext == null)
            {
                return(null);
            }

            using (var releaser = await _NicoPageAccessLock.LockAsync())
            {
                return(await _HohoemaApp.NiconicoContext.Search.LiveSearchAsync(
                           word,
                           isTagSearch,
                           provider,
                           from,
                           length,
                           order,
                           sort,
                           mode
                           ));
            }
        }
 /// <summary>
 ///     Constructor. See
 ///     <a href="https://dev.maxmind.com/minfraud/#Request_Body">
 ///         the minFraud documentation
 ///     </a>
 ///     for a general overview of the request sent to the web
 ///     service.
 /// </summary>
 /// <param name="device">Information about the device used in the transaction. This param is required.</param>
 /// <param name="account">Information about the account used in the transaction.</param>
 /// <param name="billing">Billing information used in the transaction.</param>
 /// <param name="creditCard">Information about the credit card used in the transaction.</param>
 /// <param name="customInputs">Custom inputs as configured on your account portal.</param>
 /// <param name="email">Information about the email used in the transaction.</param>
 /// <param name="userEvent">Details about the event such as the time.</param>
 /// <param name="order">Details about the order.</param>
 /// <param name="payment">Information about the payment processing.</param>
 /// <param name="shipping">Shipping information used in the transaction.</param>
 /// <param name="shoppingCart">List of shopping items in the transaction.</param>
 public Transaction(
     Device device,
     Account?account           = null,
     Billing?billing           = null,
     CreditCard?creditCard     = null,
     CustomInputs?customInputs = null,
     Email?email       = null,
     Event?userEvent   = null,
     Order?order       = null,
     Payment?payment   = null,
     Shipping?shipping = null,
     IList <ShoppingCartItem>?shoppingCart = default(List <ShoppingCartItem>)
     )
 {
     Device       = device;
     Account      = account;
     Billing      = billing;
     CreditCard   = creditCard;
     CustomInputs = customInputs;
     Email        = email;
     Event        = userEvent;
     Order        = order;
     Payment      = payment;
     Shipping     = shipping;
     ShoppingCart = shoppingCart;
 }
Ejemplo n.º 7
0
        public static async Task <string> GetTagSearchDataAsync(
            NiconicoContext context
            , string tag
            , uint from
            , uint limit
            , Sort?sort
            , Order?order
            )
        {
            var dict = new Dictionary <string, string>();

            dict.Add("__format", "json");

            dict.Add(nameof(tag), tag);
            dict.Add(nameof(from), from.ToString());
            dict.Add(nameof(limit), limit.ToString());
            if (order.HasValue)
            {
                dict.Add(nameof(order), order.Value == Order.Ascending ? "a" : "d");
            }
            if (sort.HasValue)
            {
                dict.Add(nameof(sort), sort.Value.ToShortString());
            }

            return(await context.GetStringAsync(NiconicoUrls.NICOVIDEO_CE_NICOAPI_V1_TAG_SEARCH, dict));
        }
Ejemplo n.º 8
0
 public async Task <Mntone.Nico2.Searches.Live.NicoliveVideoResponse> LiveSearchAsync(
     string word,
     bool isTagSearch,
     Mntone.Nico2.Live.CommunityType?provider = null,
     uint from   = 0,
     uint length = 30,
     Order?order = null,
     Mntone.Nico2.Searches.Live.NicoliveSearchSort?sort = null,
     Mntone.Nico2.Searches.Live.NicoliveSearchMode?mode = null
     )
 {
     return(await ContextActionWithPageAccessWaitAsync(async context =>
     {
         return await context.Search.LiveSearchAsync(
             word,
             isTagSearch,
             provider,
             from,
             length,
             order,
             sort,
             mode
             );
     }));
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Get a list of book reviews on a user's account. Several optional parameters
        /// allow for custom sorting and searching for this list.
        /// Users with private profiles only allow friends to list their books (via OAuth).
        /// Note: this endpoint doesn't include review comments.
        /// </summary>
        /// <param name="userId">The Goodreads user id.</param>
        /// <param name="shelfName">The name of the shelf to list reviews from.</param>
        /// <param name="sort">The property to sort the reviews on.</param>
        /// <param name="searchQuery">A search query to match against the reviews.</param>
        /// <param name="order">The order to sort the reviews in.</param>
        /// <param name="page">The page of the reviews list to return.</param>
        /// <param name="pageSize">The number of reviews to return per page (from 1 to 200).</param>
        /// <returns>A paginated list of reviews for the user.</returns>
        public async Task <PaginatedList <Review> > GetListByUser(
            long userId,
            string shelfName,
            SortReviewsList?sort,
            string searchQuery,
            Order?order,
            int?page,
            int?pageSize)
        {
            var parameters = new List <Parameter>
            {
                new Parameter {
                    Name = "v", Value = 2, Type = ParameterType.QueryString
                },
                new Parameter {
                    Name = "id", Value = userId, Type = ParameterType.QueryString
                }
            };

            Action <string, object> addQueryString = (name, value) =>
            {
                parameters.Add(new Parameter {
                    Name = name, Value = value, Type = ParameterType.QueryString
                });
            };

            if (!string.IsNullOrWhiteSpace(shelfName))
            {
                addQueryString("shelf", shelfName);
            }

            if (sort.HasValue)
            {
                addQueryString(EnumHelpers.QueryParameterKey <SortReviewsList>(), EnumHelpers.QueryParameterValue(sort.Value));
            }

            if (!string.IsNullOrWhiteSpace(searchQuery))
            {
                addQueryString("search[query]", searchQuery);
            }

            if (order.HasValue)
            {
                addQueryString(EnumHelpers.QueryParameterKey <Order>(), EnumHelpers.QueryParameterValue(sort.Value));
            }

            if (page.HasValue)
            {
                addQueryString("page", page.Value);
            }

            if (pageSize.HasValue)
            {
                addQueryString("per_page", pageSize.Value);
            }

            return(await Connection.ExecuteRequest <PaginatedList <Review> >("review/list", parameters, null, "reviews").ConfigureAwait(false));
        }
Ejemplo n.º 10
0
    public Order?GetPendingOrder()
    {
        using LiteDatabase connection = new LiteDatabase(path) ?? throw new ArgumentNullException(nameof(connection));
        ILiteCollection <Order> orders = connection.GetCollection <Order>() ?? throw new ArgumentNullException(nameof(orders));

        Order?result = orders.FindOne(x => x.Status == "Pending");

        return(result);
    }
 public FragenZurWurstRecognizerResult(Order?order, bool confirmOrder, bool declineOrder, bool getMenuInformation, bool cancelOrder)
     : this()
 {
     this.order              = order;
     this.confirmOrder       = confirmOrder;
     this.declineOrder       = declineOrder;
     this.getMenuInformation = getMenuInformation;
     this.cancelOrder        = cancelOrder;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BracketOrder"/> class.
 /// </summary>
 /// <param name="entry">The entry order.</param>
 /// <param name="stopLoss">The stop-loss order.</param>
 /// <param name="takeProfit">The take-profit order.</param>
 public BracketOrder(
     Order entry,
     Order stopLoss,
     Order?takeProfit = null)
     : base(new BracketOrderId("B" + entry.Id.Value), entry.Timestamp)
 {
     this.Entry      = entry;
     this.StopLoss   = stopLoss;
     this.TakeProfit = takeProfit;
 }
Ejemplo n.º 13
0
        public static GeoOrderBy?Convert(this Order?order)
        {
            GeoOrderBy?orderBy = null;

            if (order != null)
            {
                orderBy = (GeoOrderBy)(int)order.Value;
            }
            return(orderBy);
        }
Ejemplo n.º 14
0
        public async Task <ActionResult <Order> > Get(Guid id)
        {
            Order?order = await _queries.FindById(id);

            if (order == null)
            {
                return(NotFound());
            }

            return(order);
        }
Ejemplo n.º 15
0
        public async Task <IActionResult> Get(Guid orderId)
        {
            _logger.LogInformation("GET /api/v1/orders/{orderId} invoked as show as a log");
            Order?order = await _repository.GetByIdAsync(orderId);

            if (order is null)
            {
                return(NotFound());
            }
            return(Ok(order));
        }
    public override async Task <NewOrderReply> GetNewOrder(NewOrderRequest request, ServerCallContext context)
    {
        await Task.CompletedTask;

        Order?order   = repository.GetPendingOrder();
        int   orderId = order == null ? 0 : order.OrderId;

        return(new NewOrderReply
        {
            OrderId = orderId
        });
    }
Ejemplo n.º 17
0
 public static Task <MylistSearchResponse> GetMylistSearchAsync(
     NiconicoContext context
     , string keyword
     , uint from
     , uint limit
     , Sort?sort
     , Order?order
     )
 {
     return(GetMylistSearchDataAsync(context, keyword, from, limit, sort, order)
            .ContinueWith(prevTask => ParseVideoResponseJson(prevTask.Result)));
 }
Ejemplo n.º 18
0
 public static Task <VideoListingResponse> GetTagSearchAsync(
     NiconicoContext context
     , string tag
     , uint from
     , uint limit
     , Sort?sort
     , Order?order
     )
 {
     return(GetTagSearchDataAsync(context, tag, from, limit, sort, order)
            .ContinueWith(prevTask => ParseVideoResponseJson(prevTask.Result)));
 }
Ejemplo n.º 19
0
 private static string SerializeOrder(Order?orderBy)
 {
     if (orderBy == Order.Ascending)
     {
         return("asc");
     }
     if (orderBy == Order.Descending)
     {
         return("desc");
     }
     return(null);
 }
Ejemplo n.º 20
0
 public MapDisplay()
 {
     _TileRenderer    = new TileRenderer(32);
     _OceanLayerId    = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Ocean.png"), Bitmaps.Get("Data\\SeaWrap.png"));
     _LandLayerId     = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Land.png"), null);
     _FogOfWarLayerId = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\FogOfWar.png"), Bitmaps.Get("Data\\FogOfWarWrap.png"));
     _RangesLayerId   = _TileRenderer.AddLayer(TileRenderer.LayerLayout.Corners, Bitmaps.Get("Data\\Ranges.png"), null);
     _SoundPlayer     = new SoundPlayer();
     _ToolTip         = new ToolTip();
     CachedTiles      = new Bitmap[16];
     CameraScale      = 20;
     _CurrentOrder    = null;
 }
Ejemplo n.º 21
0
 public DatasetData(int?limit, Transform?transform, int?column_index, List <string> column_names, DateTime?start_date,
                    DateTime?end_date, string frequency, List <object[]> data, Collapse?collapse, Order?order)
 {
     Limit       = limit;
     Transform   = transform;
     ColumnIndex = column_index;
     ColumnNames = column_names;
     StartDate   = start_date;
     EndDate     = end_date;
     Frequency   = frequency;
     Data        = data;
     Collapse    = collapse;
     Order       = order;
 }
Ejemplo n.º 22
0
 public void PlaceOrder(Order?order)
 {
     foreach (var observer in observers)
     {
         if (!order.HasValue || string.IsNullOrEmpty(order.Value.Ref))
         {
             observer.OnError(new InvalidOrderException());
         }
         else
         {
             observer.OnNext(order.Value);
         }
     }
 }
Ejemplo n.º 23
0
    public void UpdateOrder(int orderId, string status)
    {
        using LiteDatabase connection = new LiteDatabase(path) ?? throw new ArgumentNullException(nameof(connection));
        ILiteCollection <Order> orders = connection.GetCollection <Order>() ?? throw new ArgumentNullException(nameof(orders));

        Order?order = orders.FindById(orderId);

        if (order == null)
        {
            return; // TODO: throw?
        }

        order.Status = status;

        orders.Update(order);
    }
Ejemplo n.º 24
0
        private Order CreateOrder()
        {
            if (_eventStore == null)
            {
                throw new Exception("Event store is null");
            }

            var orderRepository = new OrderRepository(_eventStore, _aggregateContext);

            _order = Order.Create(
                _aggregateContext,
                OrderIdentifier.New(),
                CustomerIdentifier.New());

            return(_order);
        }
Ejemplo n.º 25
0
        private Order GetOrder()
        {
            if (_order == null)
            {
                if (_eventStore == null)
                {
                    throw new Exception("Event store is null");
                }

                var orderRepository = new OrderRepository(_eventStore, _aggregateContext);
                _order      = orderRepository.GetAsync(_orderIdentifier).Result;
                _eventStore = null;
            }

            return(_order);
        }
Ejemplo n.º 26
0
 public Task <Video.VideoListingResponse> VideoSearchWithTagAsync(
     string tag
     , uint from   = 0
     , uint limit  = 30
     , Sort?sort   = null
     , Order?order = null
     )
 {
     return(Video.VideoSearchClient.GetTagSearchAsync(
                this._context
                , tag
                , from
                , limit
                , sort
                , order
                ));
 }
Ejemplo n.º 27
0
        public Order CustomerCreateOrder()
        {
            Order?order = _customerServices.CreateOrder();

            foreach (ProductOrder item in order.OrderDetail)
            {
                foreach (Product pd in _shop.ProductsOfShop.ListProduct)
                {
                    if (pd.Name == item.ProductName)
                    {
                        pd.QuantityInStock -= item.Quantity;
                    }
                }
            }
            Console.WriteLine("Your order was created successfully");
            return(order);
        }
Ejemplo n.º 28
0
 public Task <Mylist.MylistSearchResponse> MylistSearchAsync(
     string keyword
     , uint from   = 0
     , uint limit  = 30
     , Sort?sort   = null
     , Order?order = null
     )
 {
     return(Mylist.MylistSearchClient.GetMylistSearchAsync(
                this._context
                , keyword
                , from
                , limit
                , sort
                , order
                ));
 }
Ejemplo n.º 29
0
        public async IAsyncEnumerable <Page> StreamCoursePages(ulong courseId,
                                                               PageSort?sort     = null,
                                                               Order?order       = null,
                                                               string searchTerm = null,
                                                               bool?published    = null)
        {
            var response = await RawListPages("courses",
                                              courseId.ToString(),
                                              sort?.GetApiRepresentation(),
                                              order?.GetApiRepresentation(),
                                              searchTerm,
                                              published);

            await foreach (var page in StreamDeserializePages <PageModel>(response).Select(m => new Page(this, m, "courses", courseId)))
            {
                yield return(page);
            }
        }
Ejemplo n.º 30
0
        private QueryParameters AddOrdering(QueryParameters parameters, Order?order, FieldType?field)
        {
            if (field.HasValue)
            {
                parameters.Add("orderBy", field.Value);
            }
            else
            {
                parameters.Add("orderBy", "id");
            }

            if (order.HasValue)
            {
                parameters.Add("order", order.Value);
            }
            else
            {
                parameters.Add("order", Order.Ascending);
            }

            return(parameters);
        }
Ejemplo n.º 31
0
 public void Submit(Order order) {
     ++orderNumber;
     latestOrder = order;
 }