Beispiel #1
0
        public async Task <IEnumerable <History> > GetByPage(int count, int page, SortState sortState, bool isValid, int sensorId = 0)
        {
            IQueryable <History> histories = context.Histories
                                             .Include(h => h.Sensor)
                                             .ThenInclude(s => s.SensorType);

            if (!isValid)
            {
                histories = histories.Where(p => p.Sensor.IsActive == false);
            }


            if (sensorId != 0)
            {
                histories = histories.Where(h => h.Sensor.Id == sensorId);
            }

            var sorted = SortValue.SortHistories(sortState, histories);

            var res = sorted
                      .Skip(count * (page - 1))
                      .Take(count);

            return(await res.ToListAsync());
        }
        public JObject Generate(SortValue entry)
        {
            EnsureArg.IsNotNull(entry, nameof(entry));

            CreateEntry();

            if (entry.Low != null)
            {
                _prefix = SearchValueConstants.SortLowValueFieldName;
                entry.Low.AcceptVisitor(this);
            }
            else
            {
                AddProperty(SearchValueConstants.SortLowValueFieldName, null);
            }

            if (entry.High != null)
            {
                _prefix = SearchValueConstants.SortHighValueFieldName;
                entry.High.AcceptVisitor(this);
            }
            else
            {
                AddProperty(SearchValueConstants.SortHighValueFieldName, null);
            }

            return(CurrentEntry);
        }
Beispiel #3
0
    public static Champion[] GetSortedBy(SortValue a_Value, SortType a_Type = SortType.DESC, Champion[] a_ChampionList = null)
    {
        if (a_ChampionList == null)
            a_ChampionList = Champion.All;

        switch (a_Value)
        {
            case SortValue.Name:
                Array.Sort(a_ChampionList, delegate (Champion Champ1, Champion Champ2)
                {
                    return Champ1.Name.CompareTo(Champ2.Name) * (a_Type == SortType.ASC ? 1 : -1);
                });
                break;
            case SortValue.Price:
                Array.Sort(a_ChampionList, delegate (Champion Champ1, Champion Champ2)
                {
                    return Champ1.Price.CompareTo(Champ2.Price) * (a_Type == SortType.ASC ? 1 : -1);
                });
                break;
            case SortValue.UserMastery:
                Array.Sort(a_ChampionList, delegate (Champion Champ1, Champion Champ2)
                {
                    return Champ1.Mastery.Points.CompareTo(Champ2.Mastery.Points) * (a_Type == SortType.ASC ? 1 : -1);
                });
                break;
            case SortValue.Efficiency:
                Array.Sort(a_ChampionList, (Champ1, Champ2) => Champ1.RealEfficiency.CompareTo(Champ2.RealEfficiency) * (a_Type == SortType.ASC ? 1 : -1));
                break;
        }

        return a_ChampionList;
    }
        public void OnSortedStateChanged()
        {
            //TODO: Add animation to the change between asc/desc?
            IsSorted = SortValue.Equals(SortedState?.SortValue);

            HelperText = IsSorted
                ? SortedState?.SortDirection == SortDirectionEnum.Descending ? "  \uEDDC" : "  \uEDDB"
                : "";
        }
 public void SortButton_Clicked(object sender, EventArgs e)
 {
     if (SortValue != null)
     {
         if (SortValue.Equals(SortedState?.SortValue))
         {
             var newDirection = SortedState.SortDirection == SortDirectionEnum.Ascending ? SortDirectionEnum.Descending : SortDirectionEnum.Ascending;
             SortedState = new SortState(SortedState.SortValue, newDirection);
         }
         else
         {
             SortedState = new SortState(SortValue, SortDirectionEnum.Ascending);
         }
     }
 }
Beispiel #6
0
        public void SetSavedSortValues(IList <SortDescriptor> sorts, string indexType)
        {
            var sortValues = new List <SortValue>();

            foreach (SortDescriptor sort in sorts)
            {
                var asldjf    = sort.Serialize();
                var sortValue = new SortValue
                {
                    field = sort.Member,
                    dir   = sort.SortDirection == ListSortDirection.Ascending ? "asc" : "desc"
                };
                sortValues.Add(sortValue);
            }
            Session["__SavedSortValues" + indexType] = sortValues;
        }
Beispiel #7
0
 private void ParseSortParameter(KeyValuePair <string, StringValues> Item)
 {
     if (Item.Key == TermSort)
     {
         this.QueryItemProcessed = true;
         foreach (var SortValue in Item.Value)
         {
             if (SortValue.StartsWith('-'))
             {
                 this.Sort.Add(new FhirSearchQuery.SortParameter(SortOrder.Descending, SortValue.TrimStart('-')));
             }
             else
             {
                 this.Sort.Add(new FhirSearchQuery.SortParameter(SortOrder.Descending, SortValue));
             }
         }
     }
 }
Beispiel #8
0
 public Sort(SortValue value)
 {
     Value = value;
 }
Beispiel #9
0
        public bool Equals(DestinyVendorItemDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     VendorItemIndex == input.VendorItemIndex ||
                     (VendorItemIndex.Equals(input.VendorItemIndex))
                     ) &&
                 (
                     ItemHash == input.ItemHash ||
                     (ItemHash.Equals(input.ItemHash))
                 ) &&
                 (
                     Quantity == input.Quantity ||
                     (Quantity.Equals(input.Quantity))
                 ) &&
                 (
                     FailureIndexes == input.FailureIndexes ||
                     (FailureIndexes != null && FailureIndexes.SequenceEqual(input.FailureIndexes))
                 ) &&
                 (
                     Currencies == input.Currencies ||
                     (Currencies != null && Currencies.SequenceEqual(input.Currencies))
                 ) &&
                 (
                     RefundPolicy == input.RefundPolicy ||
                     (RefundPolicy != null && RefundPolicy.Equals(input.RefundPolicy))
                 ) &&
                 (
                     RefundTimeLimit == input.RefundTimeLimit ||
                     (RefundTimeLimit.Equals(input.RefundTimeLimit))
                 ) &&
                 (
                     CreationLevels == input.CreationLevels ||
                     (CreationLevels != null && CreationLevels.SequenceEqual(input.CreationLevels))
                 ) &&
                 (
                     DisplayCategoryIndex == input.DisplayCategoryIndex ||
                     (DisplayCategoryIndex.Equals(input.DisplayCategoryIndex))
                 ) &&
                 (
                     CategoryIndex == input.CategoryIndex ||
                     (CategoryIndex.Equals(input.CategoryIndex))
                 ) &&
                 (
                     OriginalCategoryIndex == input.OriginalCategoryIndex ||
                     (OriginalCategoryIndex.Equals(input.OriginalCategoryIndex))
                 ) &&
                 (
                     MinimumLevel == input.MinimumLevel ||
                     (MinimumLevel.Equals(input.MinimumLevel))
                 ) &&
                 (
                     MaximumLevel == input.MaximumLevel ||
                     (MaximumLevel.Equals(input.MaximumLevel))
                 ) &&
                 (
                     Action == input.Action ||
                     (Action != null && Action.Equals(input.Action))
                 ) &&
                 (
                     DisplayCategory == input.DisplayCategory ||
                     (DisplayCategory != null && DisplayCategory.Equals(input.DisplayCategory))
                 ) &&
                 (
                     InventoryBucketHash == input.InventoryBucketHash ||
                     (InventoryBucketHash.Equals(input.InventoryBucketHash))
                 ) &&
                 (
                     VisibilityScope == input.VisibilityScope ||
                     (VisibilityScope != null && VisibilityScope.Equals(input.VisibilityScope))
                 ) &&
                 (
                     PurchasableScope == input.PurchasableScope ||
                     (PurchasableScope != null && PurchasableScope.Equals(input.PurchasableScope))
                 ) &&
                 (
                     Exclusivity == input.Exclusivity ||
                     (Exclusivity != null && Exclusivity.Equals(input.Exclusivity))
                 ) &&
                 (
                     IsOffer == input.IsOffer ||
                     (IsOffer != null && IsOffer.Equals(input.IsOffer))
                 ) &&
                 (
                     IsCrm == input.IsCrm ||
                     (IsCrm != null && IsCrm.Equals(input.IsCrm))
                 ) &&
                 (
                     SortValue == input.SortValue ||
                     (SortValue.Equals(input.SortValue))
                 ) &&
                 (
                     ExpirationTooltip == input.ExpirationTooltip ||
                     (ExpirationTooltip != null && ExpirationTooltip.Equals(input.ExpirationTooltip))
                 ) &&
                 (
                     RedirectToSaleIndexes == input.RedirectToSaleIndexes ||
                     (RedirectToSaleIndexes != null && RedirectToSaleIndexes.SequenceEqual(input.RedirectToSaleIndexes))
                 ) &&
                 (
                     SocketOverrides == input.SocketOverrides ||
                     (SocketOverrides != null && SocketOverrides.SequenceEqual(input.SocketOverrides))
                 ) &&
                 (
                     Unpurchasable == input.Unpurchasable ||
                     (Unpurchasable != null && Unpurchasable.Equals(input.Unpurchasable))
                 ));
        }
Beispiel #10
0
 /// <summary>
 /// Method to set the sort value
 /// </summary>
 /// <param name="s"></param>
 public void SetSort(SortValue s)
 {
     this.ReplaceValue(Parameter.sort, String.Format("{0} {1}", s.field, (s.desc) ? "desc" : "asc"));
 }
Beispiel #11
0
 public static IOrderedQueryable <T> SortByPropertyName <T>(this IQueryable <T> items, SortValue sort)
 {
     return((IOrderedQueryable <T>)(sort.Order == SortOrder.Desc ? items.OrderByDescending(sort.Column) : items.OrderBy(sort.Column)));
 }
        public bool Equals(DestinyVendorCategoryEntryDefinition input)
        {
            if (input == null) return false;

            return
                (
                    CategoryIndex == input.CategoryIndex ||
                    (CategoryIndex.Equals(input.CategoryIndex))
                ) &&
                (
                    SortValue == input.SortValue ||
                    (SortValue.Equals(input.SortValue))
                ) &&
                (
                    CategoryHash == input.CategoryHash ||
                    (CategoryHash.Equals(input.CategoryHash))
                ) &&
                (
                    QuantityAvailable == input.QuantityAvailable ||
                    (QuantityAvailable.Equals(input.QuantityAvailable))
                ) &&
                (
                    ShowUnavailableItems == input.ShowUnavailableItems ||
                    (ShowUnavailableItems != null && ShowUnavailableItems.Equals(input.ShowUnavailableItems))
                ) &&
                (
                    HideIfNoCurrency == input.HideIfNoCurrency ||
                    (HideIfNoCurrency != null && HideIfNoCurrency.Equals(input.HideIfNoCurrency))
                ) &&
                (
                    HideFromRegularPurchase == input.HideFromRegularPurchase ||
                    (HideFromRegularPurchase != null && HideFromRegularPurchase.Equals(input.HideFromRegularPurchase))
                ) &&
                (
                    BuyStringOverride == input.BuyStringOverride ||
                    (BuyStringOverride != null && BuyStringOverride.Equals(input.BuyStringOverride))
                ) &&
                (
                    DisabledDescription == input.DisabledDescription ||
                    (DisabledDescription != null && DisabledDescription.Equals(input.DisabledDescription))
                ) &&
                (
                    DisplayTitle == input.DisplayTitle ||
                    (DisplayTitle != null && DisplayTitle.Equals(input.DisplayTitle))
                ) &&
                (
                    Overlay == input.Overlay ||
                    (Overlay != null && Overlay.Equals(input.Overlay))
                ) &&
                (
                    VendorItemIndexes == input.VendorItemIndexes ||
                    (VendorItemIndexes != null && VendorItemIndexes.SequenceEqual(input.VendorItemIndexes))
                ) &&
                (
                    IsPreview == input.IsPreview ||
                    (IsPreview != null && IsPreview.Equals(input.IsPreview))
                ) &&
                (
                    IsDisplayOnly == input.IsDisplayOnly ||
                    (IsDisplayOnly != null && IsDisplayOnly.Equals(input.IsDisplayOnly))
                ) &&
                (
                    ResetIntervalMinutesOverride == input.ResetIntervalMinutesOverride ||
                    (ResetIntervalMinutesOverride.Equals(input.ResetIntervalMinutesOverride))
                ) &&
                (
                    ResetOffsetMinutesOverride == input.ResetOffsetMinutesOverride ||
                    (ResetOffsetMinutesOverride.Equals(input.ResetOffsetMinutesOverride))
                ) ;
        }