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


C# SortOrder.ToString方法代码示例

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


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

示例1: SortDataTable

        /// <summary>
        /// Sorts the <see cref="System.Data.DataTable"/>.
        /// </summary>
        /// <param name="sourceTable">The source table.</param>
        /// <param name="sortColumn">The column to sort by.</param>
        /// <param name="order">The <see cref="Tools.Common.SortOrder"/>.</param>
        /// <param name="copyIfNoSort">Should only be true when one table owner is assumed
        /// other time and space.</param>
        /// <returns></returns>
        public static DataTable SortDataTable(DataTable sourceTable, string sortColumn, SortOrder order, bool copyIfNoSort)
        {
            if (String.IsNullOrEmpty(sortColumn))
            {
                // copyIfNoSort make the semantic more stable, even if there is no sort required
                // the copy is returned, so the caller may assume same level of independence.
                if (copyIfNoSort) return sourceTable.Copy();
                return sourceTable;
            }

            DataTable targetTable = sourceTable.Clone();

            DataRow[] sourceRows = sourceTable.Select(null, 
                ("[" + sortColumn + "] " + order.ToString()).TrimEnd(' '));

            for (int i = 0; i < sourceRows.Length; i++)
            {
                DataRow newRow = targetTable.NewRow();

                newRow.ItemArray = sourceRows[i].ItemArray;

                targetTable.Rows.Add(newRow);
            }
            return targetTable;
        }
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:34,代码来源:SortUtility.cs

示例2: ToggleOrder

 /// <summary>
 /// Toggles the order of the sort given the current sort order.
 /// </summary>
 /// <param name="order">Current sort order</param>
 /// <returns>Toggled sort order</returns>
 /// <remarks>This default implementation toggles from none to asc then desc, and then
 /// toggles only between asc and desc. Add more methods if anything else is required.</remarks>
 public static SortOrder ToggleOrder(SortOrder order)
 {
     switch (order)
     {
         case SortOrder.None: return SortOrder.Asc;
         case SortOrder.Asc: return SortOrder.Desc;
         case SortOrder.Desc: return SortOrder.Asc;
     }
     throw new ArgumentException(String.Format(CultureInfo.InvariantCulture, 
         "Unexpected SortOrder order argument of value {0}, review the implementation!", order.ToString()));
 }
开发者ID:alienwaredream,项目名称:toolsdotnet,代码行数:18,代码来源:SortUtility.cs

示例3: Search

        /// <summary>
        /// Initializes a new instance of the <see cref="T:Switchvox.CallQueueLogs.Search"/> class to be executed against one or more call queues
        /// </summary>
        /// <param name="startDate">The minimum date to search from.</param>
        /// <param name="endDate">The maximum date to search to.</param>
        /// <param name="queueAccountIds">A list of Call Queue Account IDs to retrieve data for. At least 1 Account ID must be specified.</param>
        /// <param name="callTypes">A combination of flags indicating the type of calls to include in the search results.</param>
        /// <param name="ignoreWeekends">Whether weekends should be excluded from the search results.</param>
        /// <param name="itemsPerPage">The number of results to return in this request. Additional items can be retrieved by making additional requests and incrementing the pageNumber parameter</param>
        /// <param name="pageNumber">The page of results to return in this request. Used in conjunction with the itemsPerPage parameter.</param>
        /// <param name="sortOrder">How the search results will be sorted.</param>
        /// <param name="sortField">The field of the search results to sort on</param>
        public Search(DateTime startDate, DateTime endDate, string[] queueAccountIds, CallTypes callTypes, bool ignoreWeekends = false, int itemsPerPage = 50, int pageNumber = 1, SortOrder sortOrder = SortOrder.Asc, SortField sortField = SortField.StartTime)
            : base("switchvox.callQueueLogs.search")
        {
            if (queueAccountIds.Length == 0)
                throw new ArgumentException();

            List<XElement> xml = new List<XElement>
            {
                new XElement("start_date", startDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("end_date",  endDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("ignore_weekends", Convert.ToInt32(ignoreWeekends)),
                new XElement("queue_account_ids", CreateAccountIdElms(queueAccountIds)),
                new XElement("call_types", CreateCallTypeElms(callTypes)),
                new XElement("sort_field", GetSortField(sortField)),
                new XElement("sort_order", sortOrder.ToString()),
                new XElement("items_per_page", itemsPerPage),
                new XElement("page_number", pageNumber)
            };

            SetXml(xml);
        }
开发者ID:brentj,项目名称:SwitchvoxAPI,代码行数:33,代码来源:Search.cs

示例4: DefaultOrder

 public void DefaultOrder()
 {
     var o = new SortOrder("uno");
     Assert.AreEqual("uno asc", o.ToString());
 }
开发者ID:holytshirt,项目名称:SolrNet,代码行数:5,代码来源:SortOrderTests.cs

示例5: MustSpecifyBothSortOrderAndOrdinal

 internal static Exception MustSpecifyBothSortOrderAndOrdinal(SortOrder order, int ordinal)
 {
     return ADP.InvalidOperation(Res.GetString("SqlMetaData_SpecifyBothSortOrderAndOrdinal", new object[] { order.ToString(), ordinal }));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:SQL.cs

示例6: SortBy

		//Convenient for resorting the ComboBox based on a column.
		public void SortBy(string sCol, SortOrder so)
		{
			m_dvView.Sort = sCol + " " + so.ToString();
			m_bInitItems = true;
		}
开发者ID:jxdong1013,项目名称:archivems,代码行数:6,代码来源:MultiColumnComboBox.cs

示例7: UnparseSortOrder

		/// <summary>
		/// Translates the given <see cref="SortOrder"/> into the string representation
		/// used in the XML.
		/// </summary>
		/// <param name="p_sorOrder">The <see cref="SortOrder"/> to unparse.</param>
		/// <returns>The string representation used in the XML for the given <see cref="SortOrder"/>.</returns>
		protected string UnparseSortOrder(SortOrder p_sorOrder)
		{
			return p_sorOrder.ToString();
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:10,代码来源:Unparser30.cs

示例8: UsersInRole

        public static UserSet UsersInRole(int pageIndex, int pageSize, SortUsersBy sortBy, SortOrder sortOrder, Guid roleID, bool cacheable, UserAccountStatus accountStatus, bool returnRecordCount)
        {
            UserSet u = null;

            // build a unique cache key
            StringBuilder s = new StringBuilder();
            s.Append("UsersInRole-");
            s.Append(pageIndex.ToString());
            s.Append(pageSize.ToString());
            s.Append(sortBy.ToString());
            s.Append(sortOrder.ToString());
            s.Append(roleID.ToString());
            s.Append(accountStatus.ToString());
            s.Append(returnRecordCount.ToString());

            string cacheKey =  s.ToString();

            // Get the data from the data provider if not in the cache
            //
            u = CSCache.Get(cacheKey) as UserSet;
            if (u == null || !cacheable) {
                CommonDataProvider dp = CommonDataProvider.Instance();
                u = dp.UsersInRole(pageIndex, pageSize, sortBy, sortOrder, roleID, accountStatus, returnRecordCount);

                if (cacheable)
                    CSCache.Insert(cacheKey,u,12 * CSCache.HourFactor);
            }
            return u;
        }
开发者ID:pcstx,项目名称:OA,代码行数:29,代码来源:Roles.cs

示例9: GetSortOn

 /// <summary>
 /// Gets the SortOn string in format of "SortColumnName1 SortColumnOrder1,SortColumnName2 SortColumnOrder2..."
 /// </summary>
 public static string GetSortOn(string sortColumn, SortOrder sortOrder)
 {
     string sortOn = null;
     if (sortOrder != SortOrder.NONE)
     {
         sortOn = (!string.IsNullOrEmpty(sortColumn)) ? (" " + sortColumn + " " + sortOrder.ToString()) : null;
     }
     return sortOn;
 }
开发者ID:JerryGoyal,项目名称:LeadSquared.SSEApplication,代码行数:12,代码来源:MXDBHelper.cs

示例10: ConstructXml

        private void ConstructXml(DateTime startDate, DateTime endDate, XElement searchDataElms, SortOrder sortOrder, int itemsPerPage, int pageNumber)
        {
            var xml = new List<XElement>
            {
                new XElement("start_date", startDate.ToString("yyyy-MM-dd HH:mm:ss")),
                new XElement("end_date",  endDate.ToString("yyyy-MM-dd HH:mm:ss")),
                searchDataElms,
                new XElement("sort_order", sortOrder.ToString()),
                new XElement("items_per_page", itemsPerPage),
                new XElement("page_number", pageNumber)
            };

            SetXml(xml);
        }
开发者ID:brentj,项目名称:SwitchvoxAPI,代码行数:14,代码来源:Search.cs

示例11: SetSortOrder

 /// <summary>
 /// The initial sorting order (ascending or descending) when we fetch data from the server using datatypes xml or json
 /// </summary>
 public GridSettings SetSortOrder(SortOrder sortOrder)
 {
     properties.Add("sortorder", sortOrder.ToString().ToLower());
     return this;
 }
开发者ID:JeyKip,项目名称:MvcGrid,代码行数:8,代码来源:GridSettings.cs

示例12: SearchMotorBikes

        /// <summary>
        /// <para>Performs the Search Method:
        /// Search Motor Bikes.
        /// It creates the query string using the paramaters - can be null if the parameter is not required for the request. 
        /// </para>
        /// DOES NOT REQUIRE AUTHENTICATION.
        /// </summary>
        /// <param name="searchString">One or more keywords to use in a search query.</param>
        /// <param name="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="priceMin">Minimum price.</param>
        /// <param name="priceMax">Maximum price.</param>
        /// <param name="make">	Motorbike make.</param>
        /// <param name="type">Type of the Motor Bike.</param>
        /// <param name="yearMin">	Minimum year of manufacture.</param>
        /// <param name="yearMax">Maximum year of manufacture.</param>
        /// <param name="energySizeMin">Minimum engine size in cubic centimetres (e.g. 2000 for 2 litre engine).</param>
        /// <param name="energySizeMax">Maximum engine size.</param>
        /// <param name="dateFrom">Return only listings started from this date.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">Number of rows per page.</param>
        /// <returns>MotorBikes.</returns>
        public MotorBikes SearchMotorBikes(
            string searchString,
            SortOrder sortOrder,
            decimal priceMin,
            decimal priceMax,
            string make,
            BikeType type,
            int? yearMin,
            int? yearMax,
            int? energySizeMin,
            int? energySizeMax,
            DateTime dateFrom,
            int? page,
            int? rows)
        {
            var url = String.Format(Constants.Culture, "{0}/{1}/Bikes{2}", Constants.SEARCH, Constants.MOTORS, Constants.XML);
            _addAnd = false;
            var conditions = "?";

            // create the parameters for the query string
            conditions += SearchMethods.ConstructQueryHelper(Constants.SEARCH_STRING, searchString, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.SORT_ORDER, sortOrder.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MIN, string.Empty + priceMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PRICE_MAX, string.Empty + priceMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.MAKE, make, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.TYPE, type.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.YEAR_MIN, string.Empty + yearMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.YEAR_MAX, string.Empty + yearMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ENERGY_SIZE_MIN, string.Empty + energySizeMin, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ENERGY_SIZE_MAX, string.Empty + energySizeMax, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DATE_FROM, Client.DateToStringConverter(dateFrom), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, string.Empty + page, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ROWS, string.Empty + rows, _addAnd);

            // add the parameters to the query string if there are any
            if (conditions.Equals("?"))
            {
                url += conditions;
            }

            // perform the request
            return this.SearchMotorBikes(url);
        }
开发者ID:KinoZha,项目名称:trade-me-api-wrapper,代码行数:64,代码来源:SearchMethods.cs

示例13: SearchGeneral

        /// <summary>
        /// <para>Performs Search method:
        /// Search General
        /// using the query paramaters provided it will construct a query string for you - can use null if the parameter is not required for your request.
        /// </para>
        /// DOES NOT REQUIRE AUTHENTICATION.
        /// </summary>
        /// <param name="category">Specifies the category in which you want to perform the search.</param>
        /// <param name="searchString">One or more keywords to use in a search query.</param>
        /// <param name="userRegion">Restricts search results to items from sellers located in the specified region.</param>
        /// <param name="sortOrder">Sort the returned record-set by a single specified sort order.</param>
        /// <param name="buy">Return only listings with BuyNow price.</param>
        /// <param name="pay">Return only listings with PayNow.</param>
        /// <param name="condition">Filter listings by condition.</param>
        /// <param name="dateFrom">Return only listings started from this date.</param>
        /// <param name="page">Page number.</param>
        /// <param name="rows">	Number of rows per page.</param>
        /// <param name="memberListing">Returns only listing from specified member ID.</param>
        /// <returns>SearchResults.</returns>
        public SearchResults SearchGeneral(
            string category,
            string searchString,
            int? userRegion,
            SortOrder sortOrder,
            bool? buy,
            bool? pay,
            Condition condition,
            DateTime dateFrom,
            int? page,
            int? rows,
            int? memberListing)
        {
            _addAnd = false;
            var url = String.Format(Constants.Culture, "{0}/General{1}", Constants.SEARCH, Constants.XML);
            var conditions = "?";

            // create the parameters for the query string
            conditions += SearchMethods.ConstructQueryHelper(Constants.CATEGORY, category, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.SEARCH_STRING, searchString, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.USER_REGION, string.Empty + userRegion, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.SORT_ORDER, sortOrder.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.BUY, string.Empty + buy, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAY, string.Empty + pay, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.CONDITION, condition.ToString(), _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.DATE_FROM, Client.DateToStringConverter(dateFrom),
                                                             _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.PAGE, string.Empty + page, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.ROWS, string.Empty + rows, _addAnd);
            conditions += SearchMethods.ConstructQueryHelper(Constants.MEMBER_LISTING, string.Empty + memberListing,
                                                             _addAnd);

            // add the paramaters if there are any
            if (conditions.Equals("?"))
            {
                url += conditions;
            }

            // perform the request
            return this.SearchGeneral(url);
        }
开发者ID:KinoZha,项目名称:trade-me-api-wrapper,代码行数:60,代码来源:SearchMethods.cs

示例14: Constructor_ShouldAcceptSpaces

		public void Constructor_ShouldAcceptSpaces() {
            var o = new SortOrder("dist(2, point1, point2)", Order.DESC);
            Assert.AreEqual("dist(2, point1, point2) desc", o.ToString());
		}
开发者ID:Jo1nes,项目名称:SolrNet,代码行数:4,代码来源:SortOrderTests.cs

示例15: AppendSortArguments

        private void AppendSortArguments(List<string> arguments, long offset, long count, bool alpha, SortOrder order, string destination)
        {
            if (count > 0)
            {
                arguments.Add("LIMIT");
                arguments.Add(offset.ToString());
                arguments.Add(count.ToString());
            }

            if (alpha)
            {
                arguments.Add("ALPHA");
            }

            arguments.Add(order.ToString());

            if (!string.IsNullOrEmpty(destination))
            {
                arguments.Add("STORE");
                arguments.Add(destination);
            }
        }
开发者ID:pjtown,项目名称:csharp-redis,代码行数:22,代码来源:RedisCommandsBase.cs


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