/// <summary>
        /// Get all covered primary marketplace loans
        /// </summary>
        /// <param name="ct"></param>
        /// <returns></returns>
        public async Task <IEnumerable <Loan> > GetAllCoveredPrimaryMarketPlaceAsync(CancellationToken ct = default)
        {
            var filter = new FilterOptions();

            filter.Add("nonReservedRemainingInvestment__gt", "1");

            return(await GetAllPrimaryMarketPlaceAsync(filter, ct).ConfigureAwait(false));
        }
        public void AddFilterOptions()
        {
            var filter = new FilterOptions();

            filter.Add("x", "10");

            _request.AddFilterOptions(filter);

            Assert.AreEqual(_address.AppendFilterOptions(filter), _request.RequestUri);
        }
Esempio n. 3
0
        public void GetAllWalletTransactionsAsynLongTermOk()
        {
            var date   = DateTime.Now.AddDays(-10);
            var filter = new FilterOptions();

            filter.Add("transaction.transactionDate__gte", $"{date.Year}-{date.Month}-{date.Day}");

            var walletTransactions = _zonkyClient.GetAllWalletTransactionsAsync(filter, CancellationToken.None).GetAwaiter().GetResult();

            Assert.IsTrue(walletTransactions.Any());
        }
Esempio n. 4
0
        private void filterHeader_Click(object sender, RoutedEventArgs e)
        {
            SortGridViewColumnHeader gvch = GetHeaderColumnHeader(sender);

            FilterOptions.Add(new FilterOption
            {
                Token     = gvch.RequestColumn.Token,
                Operation = FilterOperation.EqualTo,
                Value     = FilterOption.DefaultValue(gvch.RequestColumn.Type),
            });
        }
Esempio n. 5
0
        public void GetWalletTransactionsAsyncLongTermOk()
        {
            var date   = DateTime.Now.AddDays(-10);
            var filter = new FilterOptions();

            filter.Add("transaction.transactionDate__gte", $"{date.Year}-{date.Month}-{date.Day}");

            var walletTransations = _zonkyApi.GetWalletTransactionsAsync(0, 1000, _tokenProvider.GetToken(), filter, CancellationToken.None).GetAwaiter().GetResult();

            Assert.IsTrue(walletTransations.Count() > 50);
        }
        public void GetPrimaryMarketplaceInvestableOk()
        {
            var pageSize = 500;
            var filter   = new FilterOptions();

            filter.Add("nonReservedRemainingInvestment__gt", "0");

            var loansAll = _zonkyApi.GetPrimaryMarketPlaceAsync(0, pageSize, _token, null, CancellationToken.None).GetAwaiter().GetResult();
            var loans    = _zonkyApi.GetPrimaryMarketPlaceAsync(0, pageSize, _token, filter, CancellationToken.None).GetAwaiter().GetResult();

            Assert.AreEqual(pageSize, loansAll.Count());
            Assert.AreNotEqual(pageSize, loans.Count());
            Assert.AreNotEqual(loansAll.Count(l => !l.Covered), loans.Count());
            Assert.AreEqual(0, loans.Count(l => l.Covered));
        }
Esempio n. 7
0
        private void filterCell_Click(object sender, RoutedEventArgs e)
        {
            ContextMenu context = (ContextMenu)((MenuItem)sender).Parent;

            SortGridViewColumnHeader gvch = GetCellColumnHeader(context);

            if (gvch == null)
            {
                return;
            }

            ResultRow row   = (ResultRow)lvResult.SelectedItem;
            object    value = row[gvch.ResultColumn];

            FilterOptions.Add(new FilterOption
            {
                Token     = gvch.RequestColumn.Token,
                Operation = FilterOperation.EqualTo,
                Value     = value is EmbeddedEntity ? null : value
            });
        }
Esempio n. 8
0
        void SearchControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= SearchControl_Loaded;

            if (DesignerProperties.GetIsInDesignMode(this) || QueryName == null)
            {
                return;
            }

            if (qd == null)
            {
                qd = DynamicQueryServer.GetQueryDescription(QueryName);
            }

            if (FilterColumn.HasText())
            {
                FilterOptions.Add(new FilterOption
                {
                    ColumnName = FilterColumn,
                    Operation  = FilterOperation.EqualTo,
                    Frozen     = true,
                }.Bind(FilterOption.ValueProperty, new Binding("DataContext" + (FilterRoute.HasText() ? "." + FilterRoute : null))
                {
                    Source = this
                }));
                ColumnOptions.Add(new ColumnOption(FilterColumn));
                ColumnOptionsMode = ColumnOptionsMode.Remove;
            }

            FilterOption.SetFilterTokens(FilterOptions, qd);

            AutomationProperties.SetName(this, QueryUtils.GetQueryUniqueKey(QueryName));

            Search();

            foreach (var item in FilterOptions)
            {
                item.BindingValueChanged += new DependencyPropertyChangedEventHandler(item_BindingValueChanged);
            }
        }
Esempio n. 9
0
        public void OnLoaded()
        {
            if (loaded)
            {
                return;
            }

            loaded = true;

            if (FilterColumn.HasText())
            {
                FilterOptions.Add(new FilterOption
                {
                    ColumnName = FilterColumn,
                    Operation  = FilterOperation.EqualTo,
                    Frozen     = true,
                }.Bind(FilterOption.ValueProperty, new Binding("DataContext" + (FilterRoute.HasText() ? "." + FilterRoute : null))
                {
                    Source = this
                }));

                if (QueryUtils.IsColumnToken(FilterColumn))
                {
                    ColumnOptions.Add(new ColumnOption(FilterColumn));
                    ColumnOptionsMode = ColumnOptionsMode.Remove;
                }
                if (this.NotSet(SearchOnLoadProperty))
                {
                    SearchOnLoad = true;
                }
            }

            if (OrderOptions.IsNullOrEmpty() && !entityColumn.Implementations.Value.IsByAll)
            {
                var orderType = entityColumn.Implementations.Value.Types.All(t => EntityKindCache.GetEntityData(t) == EntityData.Master) ? OrderType.Ascending : OrderType.Descending;

                var column = Description.Columns.SingleOrDefaultEx(c => c.Name == "Id");

                if (column != null)
                {
                    OrderOptions.Add(new OrderOption(column.Name, orderType));
                }
            }

            btCreate.ToolTip = SearchMessage.CreateNew0_G.NiceToString()
                               .ForGenderAndNumber(entityColumn.Implementations.Value.Types.FirstOrDefault()?.GetGender() ?? 'm')
                               .FormatWith(entityColumn.Implementations.Value.Types.CommaOr(a => a.NiceName()));

            if (this.NotSet(SearchControl.NavigateProperty) && Navigate)
            {
                Navigate = Implementations.IsByAll ? true :
                           Implementations.Types.Any(t => Navigator.IsNavigable(t, isSearch: true));
            }

            if (this.NotSet(EntityBase.CreateProperty) && Create)
            {
                Create = Implementations.IsByAll ? false :
                         Implementations.Types.Any(t => Navigator.IsCreable(t, isSearch: true));
            }

            ColumnOption.SetColumnTokens(ColumnOptions, Description);

            if (this.CanAddFilters || this.AllowChangeColumns)
            {
                headerContextMenu = new ContextMenu();

                if (this.CanAddFilters)
                {
                    headerContextMenu.Items.Add(new MenuItem {
                        Header = SearchMessage.AddFilter.NiceToString()
                    }.Handle(MenuItem.ClickEvent, filterHeader_Click));
                }

                if (this.CanAddFilters && this.AllowChangeColumns)
                {
                    headerContextMenu.Items.Add(new Separator());
                }

                if (this.AllowChangeColumns)
                {
                    headerContextMenu.Items.Add(new MenuItem {
                        Header = SearchMessage.Rename.NiceToString()
                    }.Handle(MenuItem.ClickEvent, renameMenu_Click));
                    headerContextMenu.Items.Add(new MenuItem {
                        Header = EntityControlMessage.Remove.NiceToString()
                    }.Handle(MenuItem.ClickEvent, removeMenu_Click));
                }
            }

            GenerateListViewColumns();

            FilterOption.SetFilterTokens(FilterOptions, Description);

            filterBuilder.Filters = FilterOptions;
            ((INotifyCollectionChanged)FilterOptions).CollectionChanged += FilterOptions_CollectionChanged;

            OrderOption.SetOrderTokens(OrderOptions, Description);

            SortGridViewColumnHeader.SetColumnAdorners(gvResults, OrderOptions);

            if (IsVisible)
            {
                FillMenuItems();

                if (SearchOnLoad)
                {
                    Search();
                }
            }
            else
            {
                IsVisibleChanged += SearchControl_IsVisibleChanged;
            }

            UpdateVisibility();

            AutomationProperties.SetName(this, QueryUtils.GetKey(QueryName));

            foreach (var item in FilterOptions)
            {
                item.BindingValueChanged += new DependencyPropertyChangedEventHandler(item_BindingValueChanged);
            }
        }