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


C# SortOption类代码示例

本文整理汇总了C#中SortOption的典型用法代码示例。如果您正苦于以下问题:C# SortOption类的具体用法?C# SortOption怎么用?C# SortOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BindModel

        /// <summary>
        /// MVC Model Binder for automatically binding the request parameters for a PagedList sort to an instance of
        /// SortOption
        /// </summary>
        /// <param name="controllerContext"></param>
        /// <param name="bindingContext"></param>
        /// <returns></returns>
        /// <example>public ActionResult Index(int? page, [ModelBinder(typeof(PagedListBinder))] SortOption? sort)</example>
        /// <see cref="SortOption"/>
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            //Does the request contain the minimum parameters for sortng a PagedList?
            if (!String.IsNullOrEmpty((string)controllerContext.HttpContext.Request.Params["Column"]))
            {
                //Yup -
                SortOption sort = new SortOption();
                sort.Column = controllerContext.HttpContext.Request.Params["Column"];

                if (Enum.IsDefined(typeof(SortOrder), controllerContext.HttpContext.Request.Params["Direction"]))
                {
                    Enum.TryParse<SortOrder>(controllerContext.HttpContext.Request.Params["Direction"], out sort.Direction);
                }
                else
                {
                    sort.Direction = SortOrder.ascending;
                }

                return sort;
            }
            else
            {
                //Nothing to bind to
                return null;
            }
        }
开发者ID:geekcubed,项目名称:DotNetUtils,代码行数:35,代码来源:PagedListBinder.cs

示例2: Files

 public static IEnumerable<string> Files(string directory, string pattern = "*.*", SearchOption searchOption = SearchOption.TopDirectoryOnly, SortOption sortOption = SortOption.Ascending)
 {
     var q = zDirectory.EnumerateFiles(directory, pattern, searchOption);
     if (sortOption == SortOption.Ascending)
         return q;
     else
         return q.OrderByDescending(file => file);
 }
开发者ID:labeuze,项目名称:source,代码行数:8,代码来源:Directory.cs

示例3: ListAsDataTable

        public System.Data.DataTable ListAsDataTable(int BranchID = 0, long ProductID = 0, long MatrixID =0, string BarCode = "", string ProductCode = "", Int64 ProductGroupID = 0, Int64 ProductSubGroupID = 0, Int64 SupplierID = 0, ProductListFilterType clsProductListFilterType = ProductListFilterType.ShowActiveAndInactive,
                bool isQuantityGreaterThanZERO = false, Int32 Limit = 0, Int32 isSummary = 1, string ExpirationDate = Constants.C_DATE_MIN_VALUE_STRING, Int32 ForReorder = 0, Int32 OverStock = 0, string SortField = "", SortOption SortOrder = SortOption.Ascending, bool ShowOnlyWithInvalidUnitMatrix = false)
        {
            try
            {
                DateTime dteExpiration = Constants.C_DATE_MIN_VALUE;

                DateTime.TryParse(ExpirationDate, out dteExpiration);

                string SQL = "CALL procProductInventorySelect(@BranchID, @ProductID, @MatrixID, @BarCode, @ProductCode, @ProductGroupID, @ProductSubGroupID, @SupplierID, @ShowActiveAndInactive, @isQuantityGreaterThanZERO, @lngLimit, @isSummary, @dteExpiration, @ForReorder, @OverStock, @SortField, @SortOrder)";

                // do an override if Only those with invalid unit matrix
                if (ShowOnlyWithInvalidUnitMatrix)
                    SQL = "CALL procProductInventorySelectWithInvalidUnitMatrix(@BranchID, @ProductID, @MatrixID, @BarCode, @ProductCode, @ProductGroupID, @ProductSubGroupID, @SupplierID, @ShowActiveAndInactive, @isQuantityGreaterThanZERO, @lngLimit, @isSummary, @dteExpiration, @ForReorder, @OverStock, @SortField, @SortOrder)";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@BranchID", BranchID);
                cmd.Parameters.AddWithValue("@ProductID", ProductID);
                cmd.Parameters.AddWithValue("@MatrixID", MatrixID);
                cmd.Parameters.AddWithValue("@BarCode", BarCode);
                cmd.Parameters.AddWithValue("@ProductCode", ProductCode);
                cmd.Parameters.AddWithValue("@ProductGroupID", ProductGroupID);
                cmd.Parameters.AddWithValue("@ProductSubGroupID", ProductSubGroupID);
                cmd.Parameters.AddWithValue("@SupplierID", SupplierID);
                cmd.Parameters.AddWithValue("@ShowActiveAndInactive", clsProductListFilterType.ToString("d"));
                cmd.Parameters.AddWithValue("@isQuantityGreaterThanZERO", isQuantityGreaterThanZERO);
                cmd.Parameters.AddWithValue("@lngLimit", Limit);
                cmd.Parameters.AddWithValue("@isSummary", isSummary);
                cmd.Parameters.AddWithValue("@dteExpiration", dteExpiration.ToString("yyyy-MM-dd"));
                cmd.Parameters.AddWithValue("@ForReorder", ForReorder);
                cmd.Parameters.AddWithValue("@OverStock", OverStock);
                cmd.Parameters.AddWithValue("@SortField", SortField);
                switch (SortOrder)
                {
                    case SortOption.Ascending:
                        cmd.Parameters.AddWithValue("@SortOrder", "ASC");
                        break;
                    case SortOption.Desscending:
                        cmd.Parameters.AddWithValue("@SortOrder", "DESC");
                        break;
                }

                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);

                return dt;
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:marioricci,项目名称:erp-luma,代码行数:56,代码来源:ProductInventory.cs

示例4: Sort

 protected override void Sort(Tab tab, SortOption options)
 {
     if (options["Default"])
     {
         sortJewls(tab, 11);
     }
     if (options["Dynamic"])
     {
         int numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f);
         sortJewls(tab, numberOfColumns);
     }
 }
开发者ID:smad2005,项目名称:PathOfExileStashSorter,代码行数:12,代码来源:SortJewlery.cs

示例5: Build

        private static object Build(SortOption sortOption)
        {
            if (!sortOption.IgnoreUnmapped)
                return sortOption.Ascending
                    ? (object)sortOption.Name
                    : new JObject(new JProperty(sortOption.Name, "desc"));

            var properties = new List<JProperty> { new JProperty("ignore_unmapped", true) };
            if (!sortOption.Ascending)
                properties.Add(new JProperty("order", "desc"));

            return new JObject(new JProperty(sortOption.Name, new JObject(properties)));
        }
开发者ID:diwakarpp,项目名称:ElasticLINQ,代码行数:13,代码来源:PostBodyRequestFormatter.cs

示例6: Sort

    protected override void Sort(Tab tab, SortOption options)
    {
        int numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f);

        if (options["Default"])
        {
            numberOfColumns = 11;
            sortMaps(tab, numberOfColumns);
        }
        if (options["Full"])
        {
            numberOfColumns = 12;
            sortMaps(tab, numberOfColumns);
        }
        if (options["1 Margin"])
        {
            if (numberOfColumns <= 11)
                numberOfColumns = 11;
            sortMaps(tab, numberOfColumns);
        }
        if (options["2 Margin"])
        {
            if (numberOfColumns <= 10)
                numberOfColumns = 10;
            sortMaps(tab, numberOfColumns);
        }
        if (options["3 Margin"])
        {
            if (numberOfColumns <= 9)
                numberOfColumns = 9;
            sortMaps(tab, numberOfColumns);
        }
        if (options["Dynamic"])
        {
            numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f);
            sortMaps(tab, numberOfColumns);
        }
        if (options["Dynamic + 1"])
        {
            numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f) + 1;
            numberOfColumns = Mathf.Clamp(numberOfColumns, 0, 11);
            sortMaps(tab, numberOfColumns);
        }
        if (options["Dynamic + 2"])
        {
            numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f) + 2;
            numberOfColumns = Mathf.Clamp(numberOfColumns, 0, 11);
            sortMaps(tab, numberOfColumns);
        }

    }
开发者ID:smad2005,项目名称:PathOfExileStashSorter,代码行数:51,代码来源:SortMaps.cs

示例7: Sort

    protected override void Sort(Tab tab, SortOption options)
    {
        IEnumerable<Item> gems = tab.Items;

        if (options["Sort by color then type"])
        {
            SortEm(
                gems.Where(x => x.GemRequirement == GemRequirement.Str).OrderByDescending(x => x.GemType).ThenBy(x => x.FullItemName).ThenBy(x => x.Level),
                gems.Where(x => x.GemRequirement == GemRequirement.Dex).OrderByDescending(x => x.GemType).ThenBy(x => x.FullItemName).ThenBy(x => x.Level),
                gems.Where(x => x.GemRequirement == GemRequirement.Int).OrderByDescending(x => x.GemType).ThenBy(x => x.FullItemName).ThenBy(x => x.Level)
            );
        }
        else if (options["Sort by type"])
        {
            SortEm(
                gems.Where(x => x.GemType == GemType.Normal).OrderByDescending(x => x.FullItemName).ThenBy(x => x.LevelRequirement),
                gems.Where(x => x.GemType == GemType.Support).OrderByDescending(x => x.FullItemName).ThenBy(x => x.LevelRequirement),
                gems.Where(x => x.GemType == GemType.Aura).OrderByDescending(x => x.FullItemName).ThenBy(x => x.LevelRequirement)
            );
        }
        else if (options["Sort by quality"])
        {
            SortEm(
                gems.Where(x => x.GemRequirement == GemRequirement.Str).OrderByDescending(x => x.Quality).ThenBy(x => x.FullItemName),
                gems.Where(x => x.GemRequirement == GemRequirement.Dex).OrderByDescending(x => x.Quality).ThenBy(x => x.FullItemName),
                gems.Where(x => x.GemRequirement == GemRequirement.Int).OrderByDescending(x => x.Quality).ThenBy(x => x.FullItemName)
            );
        }
        else if (options["Find quality gems"])
        {
            SortEm(
                gems.Where(x => x.Quality == 0).OrderByDescending(x => x.GemRequirement).ThenBy(x => x.GemType).ThenBy(x => x.FullItemName),
                gems.Where(x => x.LevelRequirement > 99999), // No middle
                gems.Where(x => x.Quality > 0).OrderByDescending(x => x.Quality).ThenBy(x => x.FullItemName)
            );
        }
        else if (options["Sort by color then level"])
        {
            SortEm(
                gems.Where(x => x.GemRequirement == GemRequirement.Str).OrderByDescending(x => x.Level).ThenBy(x => x.Quality),
                gems.Where(x => x.GemRequirement == GemRequirement.Dex).OrderByDescending(x => x.GemType).ThenBy(x => x.Quality),
                gems.Where(x => x.GemRequirement == GemRequirement.Int).OrderByDescending(x => x.GemType).ThenBy(x => x.Quality)
            );
        }
        else if (options["Sort by level"])
        {
            SortFromBottom(gems.OrderByDescending(x => x.LevelRequirement));
        }

    }
开发者ID:smad2005,项目名称:PathOfExileStashSorter,代码行数:50,代码来源:SortGems.cs

示例8: Sort

    protected override void Sort(Tab tab, SortOption options)
    {
        int numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f);
        int numberOfItems = tab.Items.Count();

        if (options["Default"])
        {
            numberOfColumns = 12;
        }
        if (options["1 Margin"])
        {
            if (numberOfColumns <= 11)
                numberOfColumns = 11;
        }
        if (options["2 Margin"])
        {
            if (numberOfColumns <= 10)
                numberOfColumns = 10;
        }
        if (options["Dynamic"])
        {
            numberOfColumns = (int)Math.Ceiling(tab.Items.Count() / 12f);
        }

        int x = 11;
        int y = 11;

        int i = 0;
        int lastLevel = 0;
        bool maySkip = true;
        foreach (var item in tab.Items.OrderByDescending(xx => xx.Level).ThenBy(xx => xx.Icon).ThenBy(xx => xx.Quality))
        {
            item.X = x;
            item.Y = y;
            i++;

            x--;
            bool canSkip = (lastLevel != item.Level && (numberOfItems - i) < numberOfColumns * y);
            if (maySkip && lastLevel != item.Level && ((numberOfItems - i) < numberOfColumns * y) == false)
                maySkip = false;

            if (x == 11 - numberOfColumns || canSkip && maySkip)
            {
                x = 11;
                y--;
            }
            lastLevel = item.Level;
        }
    }
开发者ID:smad2005,项目名称:PathOfExileStashSorter,代码行数:49,代码来源:SortMaps.cs

示例9: GetTasks

        public static IEnumerable<TaskModel> GetTasks(SortOption sortOption)
        {
            switch (sortOption)
            {
                case SortOption.Newest:
                    return DataLayer.TaskDatabase.GetItems<TaskModel>().OrderByDescending(t=>t.DateCreated);
                case SortOption.Oldest:
                    return DataLayer.TaskDatabase.GetItems<TaskModel>().OrderBy(t => t.DateCreated);
                case SortOption.TitleAscending:
                    return DataLayer.TaskDatabase.GetItems<TaskModel>().OrderBy(t => t.Task);
                case SortOption.TitleDescending:
                    return DataLayer.TaskDatabase.GetItems<TaskModel>().OrderByDescending(t => t.Task);
            }

            return DataLayer.TaskDatabase.GetItems<TaskModel>().OrderBy(t => t.DateCreated);
        }
开发者ID:CodigoMonki,项目名称:TasksSimplified,代码行数:16,代码来源:DataManager.cs

示例10: GetCurrentState

 public static StatData[] GetCurrentState(SortOption sortOption, int pageNumber, int pageSize)
 {
     var startPosition = pageSize*pageNumber;
     switch (sortOption)
     {
         case SortOption.None:
             return KeywordsDictionary.Skip(startPosition).Take(pageSize).Select(kvp => new StatData(kvp.Key, kvp.Value)).ToArray();
         case SortOption.Keyword:
             return KeywordsDictionary.OrderBy(pair => pair.Key).Skip(startPosition).Take(pageSize).Select(kvp => new StatData(kvp.Key, kvp.Value)).ToArray();
         case SortOption.KeywordDecrease:
             return KeywordsDictionary.OrderByDescending(pair => pair.Key).Skip(startPosition).Take(pageSize).Select(kvp => new StatData(kvp.Key, kvp.Value)).ToArray();
         case SortOption.KeywordCount:
             return KeywordsDictionary.OrderBy(pair => pair.Value).Skip(startPosition).Take(pageSize).Select(kvp => new StatData(kvp.Key, kvp.Value)).ToArray();
         case SortOption.KeywordCountDecrease:
             return KeywordsDictionary.OrderByDescending(pair => pair.Value).Skip(startPosition).Take(pageSize).Select(kvp => new StatData(kvp.Key, kvp.Value)).ToArray();
     }
     return new StatData[0];
 }
开发者ID:Phontan,项目名称:TGoogle,代码行数:18,代码来源:StatisticsHandler.cs

示例11: List

        public MySqlDataReader List(string SortField, SortOption SortOrder)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE 1=1 ORDER BY " + SortField;

                if (SortOrder == SortOption.Ascending)
                    SQL += " ASC";
                else
                    SQL += " DESC";



                MySqlCommand cmd = new MySqlCommand();


                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;



                return base.ExecuteReader(cmd);
            }
            catch (Exception ex)
            {


                {




                }

                throw base.ThrowException(ex);
            }
        }
开发者ID:marioricci,项目名称:erp-luma,代码行数:37,代码来源:MatrixPackage.cs

示例12: ListAccessTypes

		private MySqlDataReader ListAccessTypes(string SortField, SortOption SortOrder)
		{
			try
			{
				string SQL =	"SELECT		TypeID, TypeName, Remarks " +
								"FROM		sysAccessTypes " + 
								"ORDER BY " + SortField;

				if (SortOrder == SortOption.Ascending)
					SQL += " ASC";
				else
					SQL += " DESC";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;
				
				return base.ExecuteReader(cmd);			
			}
			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
开发者ID:marioricci,项目名称:erp-luma,代码行数:24,代码来源:AccessGroupRights.cs

示例13: ListAsDataTable

        public System.Data.DataTable ListAsDataTable(Int64 MatrixID, string SortField, SortOption SortOrder)
        {
            try
            {
                string SQL = SQLSelect() + "WHERE 1=1 AND a.MatrixID = @MatrixID ORDER BY " + SortField;

                if (SortOrder == SortOption.Ascending)
                    SQL += " ASC";
                else
                    SQL += " DESC";

                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection = GetConnection();

                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@MatrixID", MatrixID);

                string strDataTableName = "tbl" + this.GetType().FullName.Split(new Char[] { '.' })[this.GetType().FullName.Split(new Char[] { '.' }).Length - 1]; System.Data.DataTable dt = new System.Data.DataTable(strDataTableName);
                base.MySqlDataAdapterFill(cmd, dt);


                return dt;
            }
            catch (Exception ex)
            {


                {




                }

                throw base.ThrowException(ex);
            }
        }
开发者ID:marioricci,项目名称:erp-luma,代码行数:39,代码来源:MatrixPackage.cs

示例14: ListAsDataTable

 public System.Data.DataTable ListAsDataTable(SalesTransactionDetails clsSearchKey, bool WithTF = false, string SortField = "", SortOption SortOption = SortOption.Ascending, Int32 limit = 0)
 {
     try
     {
         return ListAsDataTable(clsSearchKey.BranchID, clsSearchKey.TerminalNo, clsSearchKey.TransactionID, clsSearchKey.TransactionNo, clsSearchKey.TransactionDateFrom, clsSearchKey.TransactionDateTo, clsSearchKey.TransactionStatus, clsSearchKey.PaymentType, clsSearchKey.isConsignment, false, clsSearchKey.CustomerName, clsSearchKey.CustomerGroupName, clsSearchKey.CashierID, clsSearchKey.CashierName, clsSearchKey.AgentName, WithTF, false, SortField, SortOption, limit); ;
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
开发者ID:marioricci,项目名称:erp-luma,代码行数:11,代码来源:SalesTransaction.cs

示例15: ListClosedDataTable

 public System.Data.DataTable ListClosedDataTable(Int32 BranchID, DateTime? TransactionDateFrom = null, DateTime? TransactionDateTo = null, string SortField = "TransactionDate", SortOption SortOrder = SortOption.Ascending, Int32 limit = 0)
 {
     try
     {
         return ListAsDataTable(BranchID, TransactionDateFrom: TransactionDateFrom, TransactionDateTo: TransactionDateTo, TransactionStatus: TransactionStatus.Closed, SortField: SortField, SortOption: SortOrder, limit: limit);
     }
     catch (Exception ex)
     {
         throw base.ThrowException(ex);
     }
 }
开发者ID:marioricci,项目名称:erp-luma,代码行数:11,代码来源:SalesTransaction.cs


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