当前位置: 首页>>代码示例>>C#>>正文


C# FilterDescriptor.ToJSON方法代码示例

本文整理汇总了C#中FilterDescriptor.ToJSON方法的典型用法代码示例。如果您正苦于以下问题:C# FilterDescriptor.ToJSON方法的具体用法?C# FilterDescriptor.ToJSON怎么用?C# FilterDescriptor.ToJSON使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilterDescriptor的用法示例。


在下文中一共展示了FilterDescriptor.ToJSON方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFavorites

        public async Task<IHttpActionResult> GetFavorites()
        {
            try
            {
                var filter = new FilterDescriptor(
                Constants.FilterAccount + "Id",
                FilterOperator.IsEqualTo,
                Utils.CurrentUserAccountId == -1 ? null : (int?)Utils.CurrentUserAccountId) { MemberType = typeof(int) };

                var procList = ProcessList.GetProcessList();

                var favoriteList = DynamicTypeManager.GetInfoList<IFavoriteInfo>(
                    new PagedCriteria
                    {
                        ProcessName = Constants.FavoriteProcessName,
                        PageNumber = 0,
                        PageSize = int.MaxValue,
                        NotCalculateAccessDeniedList = true,
                        FilterDefinition = filter.ToJSON()
                    });

                var list = procList.Where(x => favoriteList.Select(s => GetProcessSystemName(s.ProcessSystemName)).Contains(x.Name)).Select(x => new FavoriteInfo()
                {
                    Name = x.Name,
                    ProcessSystemName = x.SystemName,
                    BackgroundColor = ColorTranslator.ToHtml(Color.FromArgb((int)x.ProcessColor)) 
                }).ToList();
                
                return await Task.FromResult<IHttpActionResult>(Ok(list));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
开发者ID:mparsin,项目名称:Elements,代码行数:35,代码来源:NavController.cs

示例2: GetOrCreateUserFilterFor

        /// <summary>
        /// Gets the or create user filter for.
        /// </summary>
        /// <param name="filterGuid">The filter unique identifier.</param>
        /// <param name="callback">The callback.</param>
        public void GetOrCreateUserFilterFor(Guid filterGuid, Action<IFilterEdit> callback)
        {
            var filter = new FilterDescriptor(
                LogicalOperators.And,
                new MobileObservableCollection<IFilterDescriptor>
                    {
                        new FilterDescriptor("Guid", FilterOperator.IsEqualTo, filterGuid.ToString()),
                        new FilterDescriptor("Account", FilterOperator.IsEqualTo, Veyron.SharedTypes.Utils.CurrentUserAccountId)
                    });
                
            Action<object, DataPortalResult<IInfoList>> filterLoadedAction = (o, result) =>
            {
                // error - return null
                if (result.Error != null)
                {
                    callback(null);
                    return;
                }

                // not filters found - return new filter
                if (result.Object.Count == 0)
                {
                    TheDynamicTypeManager.BeginNewEditableRoot(Constants.FilterProcessName, (o1, portalResult) => callback(portalResult.Error == null ? (IFilterEdit)portalResult.Object : null));
                    return;
                }

                // filters found - return found filter
                TheDynamicTypeManager.BeginGetEditableRoot<IFilterEdit>(Constants.FilterProcessName, ((IInfoClass)result.Object[0]).Id, (o1, portalResult) => callback(portalResult.Error == null ? portalResult.Object : null));
            };
            TheDynamicTypeManager.BeginGetList(Constants.FilterProcessName, filterLoadedAction, new SortList { new SortDescriptor(Constants.LastModifiedColumnName, SortDirection.Descending) }, pageSize: 1, filterExpression: filter.ToJSON());
        }
开发者ID:mparsin,项目名称:Elements,代码行数:36,代码来源:FilterPreprocessor.cs

示例3: ApplyingSortingPreserveFilteringGottenFrom_MCR_ShowSearchReferenced

        public void ApplyingSortingPreserveFilteringGottenFrom_MCR_ShowSearchReferenced()
        {
            var vm = GetNewSearchListVm();

            Mock.Arrange(() => vm.ProcessSystemName).Returns("processName");
            Mock.Arrange(() => vm.FilterString).Returns("filterString");
            Mock.Arrange(() => vm.SortDescriptors).Returns(new SortList());
            Mock.Arrange(() => vm.GroupColumn).Returns("groupColumn");
            Mock.Arrange(() => vm.Columns).Returns(new ColumnCollection());

            var quickFilterToolbarViewModel = new QuickFilterToolbarViewModel();
            vm.QuickFilterToolbarVM = new Lazy<QuickFilterToolbarViewModel>();
            Mock.Arrange(() => quickFilterToolbarViewModel.RefreshQuickFilters()).Returns(TaskHelper.GetEmptyTask);
            Mock.Arrange(() => vm.QuickFilterToolbarVM.Value).Returns(quickFilterToolbarViewModel);

            var filterListVM = new FilterListViewModel();
            Mock.Arrange(() => vm.FilterListVM).Returns(filterListVM);

            var filterDescriptor = new FilterDescriptor();
            Mock.Arrange(() => filterDescriptor.ToJSON()).Returns("expected");
            var filterList = new MobileObservableCollection<IFilterDescriptor> { filterDescriptor };

            Mock.NonPublic.Arrange(vm, "AddMandatoryFilter", ArgExpr.IsAny<MobileObservableCollection<IFilterDescriptor>>()).DoNothing();

            Mock.Arrange(() => vm.TheFetchSearchListService.Refresh(
                Arg.AnyString,
                Arg.AnyInt,
                Arg.AnyInt,
                Arg.IsAny<SortList>(),
                Arg.AnyString,
                Arg.IsAny<ColumnCollection>(),
                Arg.IsAny<MobileObservableCollection<IFilterDescriptor>>(),
                Arg.AnyString,
                Arg.IsAny<Action<DataPortalResult<IInfoList>>>())).DoNothing();

            vm.RefreshSearchList(filterList);
            Assert.AreEqual("expected", vm.AppliedFilter.TempFilterDefinitions);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:38,代码来源:SearchListViewModelTests.cs

示例4: LoadFilterInfo

        private async Task<IFilterInfo> LoadFilterInfo(Guid filterGuid)
        {
            var dataFilter = new FilterDescriptor(
                LogicalOperators.And,
                new MobileObservableCollection<IFilterDescriptor>
                {
                    new FilterDescriptor("Guid", FilterOperator.IsEqualTo, filterGuid.ToString())
                    {
                        MemberType = typeof (string)
                    }
                });

            var list =
                await TheDynamicTypeManager.BeginGetListAsync<IFilterList<IFilterInfo>>(
                    new PagedCriteria
                    {
                        ProcessName = Constants.FilterProcessName,
                        PageNumber = 0,
                        PageSize = 1,
                        LimitResultColumns = false,
                        FilterDefinition = dataFilter.ToJSON()
                    });

            return list.FirstOrDefault();

        }
开发者ID:mparsin,项目名称:Elements,代码行数:26,代码来源:ProcessMetricsGadgetViewModel.cs


注:本文中的FilterDescriptor.ToJSON方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。