Beispiel #1
0
        public int CompareTo(object obj)
        {
            LotInfoEntityViewModel lot = (LotInfoEntityViewModel)obj;

            int ret = this.CompareToValue(lot);

            return(ret);
        }
Beispiel #2
0
        private int CompareToValue(LotInfoEntityViewModel lot)
        {
            int compareProperty = CompareToValueProperty(lot);

            if (compareProperty != 0)
            {
                if (SortOrder.ToLower().StartsWith("d"))
                {
                    return(-compareProperty);
                }
                return(compareProperty);
            }

            if (this.name != lot.name)
            {
                return(this.name.CompareTo(lot.name));
            }

            if (this.qty != lot.qty)
            {
                return(this.qty.CompareTo(lot.qty));
            }

            if (this.Mode != lot.Mode)
            {
                return(this.Mode.CompareTo(lot.Mode));
            }

            if (this.priceCoinShiny != lot.priceCoinShiny)
            {
                return(this.priceCoinShiny.CompareTo(lot.priceCoinShiny));
            }

            if (this.priceCoinPenny != lot.priceCoinPenny)
            {
                return(this.priceCoinPenny.CompareTo(lot.priceCoinPenny));
            }

            if (this.count != lot.count)
            {
                return(this.count.CompareTo(lot.count));
            }

            return(0);
        }
Beispiel #3
0
        private int CompareToValueProperty(LotInfoEntityViewModel lot)
        {
            double last = SortOrder.ToLower().StartsWith("d") ? double.MinValue : double.MaxValue;

            switch (SortProperty)
            {
            case "Coords":
                if (this.Coords != lot.Coords)
                {
                    if (this.worldX != lot.worldX)
                    {
                        return(this.worldX.CompareTo(lot.worldX));
                    }
                    if (this.worldY != lot.worldY)
                    {
                        return(this.worldY.CompareTo(lot.worldY));
                    }
                }
                break;

            case "Mode":
                if (this.Mode != lot.Mode)
                {
                    return(this.Mode.CompareTo(lot.Mode));
                }
                break;

            case "Name":
                if (this.name != lot.name)
                {
                    return(this.name.CompareTo(lot.name));
                }
                break;

            case "Qty":
                if (this.qty != lot.qty)
                {
                    return(this.qty.CompareTo(lot.qty));
                }
                break;

            case "PriceCoinShiny":
            {
                double x = this.priceCoinShiny == 0 ? last : this.priceCoinShiny;
                double l = lot.priceCoinShiny == 0 ? last : lot.priceCoinShiny;
                if (x != l)
                {
                    return(x.CompareTo(l));
                }

                if (this.priceCoinPenny != lot.priceCoinPenny)
                {
                    return(this.priceCoinPenny.CompareTo(lot.priceCoinPenny));
                }
            }
            break;

            case "PriceCoinPenny":
            {
                double x = this.priceCoinPenny == 0 ? last : this.priceCoinPenny;
                double l = lot.priceCoinPenny == 0 ? last : lot.priceCoinPenny;
                if (x != l)
                {
                    return(x.CompareTo(l));
                }

                if (this.priceCoinShiny != lot.priceCoinShiny)
                {
                    return(this.priceCoinShiny.CompareTo(lot.priceCoinShiny));
                }
            }
            break;

            case "PriceCoinShinyRatio":
            {
                double x = this.priceCoinShinyRatio == 0.0 ? last : this.priceCoinShinyRatio;
                double l = lot.priceCoinShinyRatio == 0.0 ? last : lot.priceCoinShinyRatio;
                if (x != l)
                {
                    return(x.CompareTo(l));
                }

                if (this.priceCoinPennyRatio != lot.priceCoinPennyRatio)
                {
                    return(this.priceCoinPennyRatio.CompareTo(lot.priceCoinPennyRatio));
                }
            }
            break;

            case "PriceCoinPennyRatio":
            {
                double x = this.priceCoinPennyRatio == 0.0 ? last : this.priceCoinPennyRatio;
                double l = lot.priceCoinPennyRatio == 0.0 ? last : lot.priceCoinPennyRatio;
                if (x != l)
                {
                    return(x.CompareTo(l));
                }

                if (this.priceCoinShinyRatio != lot.priceCoinShinyRatio)
                {
                    return(this.priceCoinShinyRatio.CompareTo(lot.priceCoinShinyRatio));
                }
            }
            break;

            case "Count":
                if (this.count != lot.count)
                {
                    return(this.count.CompareTo(lot.count));
                }
                break;
            }

            return(0);
        }