Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SortInfo" /> class.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <param name="direction">The direction.</param>
        public SortInfo(string columnName, SortDirectionEnum direction)
        {
            Check.Require(string.IsNullOrEmpty(columnName) == false);

            _ColumnName = columnName;
            _Direction  = direction;
        }
 public Sort3Request(string SortItem, SortDirectionEnum Direction, bool Clear, PageCountMode PaginationMode)
 {
     this.SortItem       = SortItem;
     this.Direction      = Direction;
     this.Clear          = Clear;
     this.PaginationMode = PaginationMode;
 }
Exemple #3
0
        SortDirectionEnum _Direction;                   // Indicates the direction of the sort
        // Ascending (Default) | Descending

        internal SortBy(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
        {
            _SortExpression = null;
            _Direction      = SortDirectionEnum.Ascending;

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "SortExpression":
                    _SortExpression = new Expression(r, this, xNodeLoop, ExpressionType.Variant);
                    break;

                case "Direction":
                    _Direction = SortDirection.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown SortBy element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            if (_SortExpression == null)
            {
                OwnerReport.rl.LogError(8, "SortBy requires the SortExpression element.");
            }
        }
Exemple #4
0
			SortDirectionEnum _Direction;	// Indicates the direction of the sort
										// Ascending (Default) | Descending
	
		internal SortBy(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_SortExpression=null;
			_Direction=SortDirectionEnum.Ascending;

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "SortExpression":
						_SortExpression = new Expression(r, this, xNodeLoop, ExpressionType.Variant);
						break;
					case "Direction":
						_Direction = SortDirection.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
						break;
					default:
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown SortBy element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
			if (_SortExpression == null)
				OwnerReport.rl.LogError(8, "SortBy requires the SortExpression element.");
		}
        public IActionResult OnGet(SortEnum?sortBy, SortDirectionEnum?sortDirection)
        {
            SortBy        = sortBy ?? SortEnum.NonMicrosoftAndPossibleAliases;
            SortDirection = sortDirection ?? SortDirectionEnum.Descend;

            TeamCompositions = _context.Teams.Where(team => team.EventID == Event.ID)
                               .Join(
                _context.TeamMembers,
                team => team.ID,
                teamMember => teamMember.Team.ID,
                (team, teamMember) => new IntermediateTeamMember()
            {
                TeamID     = team.ID,
                TeamName   = team.Name,
                TeamMember = teamMember.Member
            })
                               .GroupBy(intermediate => intermediate.TeamID)
                               .Select(this.MapToTeamComposition);

            if (SortDirection == SortDirectionEnum.Ascend)
            {
                TeamCompositions = TeamCompositions.OrderBy(this.GetSortSelector());
            }
            else
            {
                TeamCompositions = TeamCompositions.OrderByDescending(this.GetSortSelector());
            }

            return(Page());
        }
Exemple #6
0
 public TableData(
     int reportIid, string reportFile,
     string recordFilter, int numCopy, bool sendMessage,
     string dateFrom, string dateTo, string dateRange,
     SortDirectionEnum groupDirection1, SortDirectionEnum groupDirection2, SortDirectionEnum groupDirection3,
     string groupHeader1, string groupHeader2, string groupHeader3,
     string groupTable1, string groupTable2, string groupTable3,
     SortDirectionEnum sortDirection1, SortDirectionEnum sortDirection2, SortDirectionEnum sortDirection3,
     string sortHeader1, string sortHeader2, string sortHeader3,
     string sortTable1, string sortTable2, string sortTable3,
     string filterText1, string filterText2, string filterText3, string filterText4,
     string filterText5, string filterText6, string filterText7, string filterText8,
     string filterText9, string filterText10, string filterText11, string filterText12,
     string filterText13, string filterText14, string filterText15,
     string batchName, bool reportDelete)
 {
     ReportIid       = reportIid;
     ReportFile      = reportFile;
     RecordFilter    = recordFilter;
     NumCopy         = numCopy;
     SendMessage     = sendMessage;
     DateFrom        = dateFrom;
     DateTo          = dateTo;
     DateRange       = dateRange;
     GroupDirection1 = groupDirection1;
     GroupDirection2 = groupDirection2;
     GroupDirection3 = groupDirection3;
     GroupHeader1    = groupHeader1;
     GroupHeader2    = groupHeader2;
     GroupHeader3    = groupHeader3;
     GroupTable1     = groupTable1;
     GroupTable2     = groupTable2;
     GroupTable3     = groupTable3;
     SortDirection1  = sortDirection1;
     SortDirection2  = sortDirection2;
     SortDirection3  = sortDirection3;
     SortHeader1     = sortHeader1;
     SortHeader2     = sortHeader2;
     SortHeader3     = sortHeader3;
     SortTable1      = sortTable1;
     SortTable2      = sortTable2;
     SortTable3      = sortTable3;
     FilterText1     = filterText1;
     FilterText2     = filterText2;
     FilterText3     = filterText3;
     FilterText4     = filterText4;
     FilterText5     = filterText5;
     FilterText6     = filterText6;
     FilterText7     = filterText7;
     FilterText8     = filterText8;
     FilterText9     = filterText9;
     FilterText10    = filterText10;
     FilterText11    = filterText11;
     FilterText12    = filterText12;
     FilterText13    = filterText13;
     FilterText14    = filterText14;
     FilterText15    = filterText15;
     BatchName       = batchName;
     ReportDelete    = reportDelete;
 }
 public IActionResult OnPost(SortEnum sortBy, SortDirectionEnum sortDirection)
 {
     return(RedirectToPage(
                "./TeamCompositionSummary",
                new {
         sortBy = sortBy,
         sortDirection = sortDirection
     }));
 }
 public GetListRequest(int limit, int page, string searchValue = "", string searchFields = "", string sortField = "", SortDirectionEnum sortDirection = SortDirectionEnum.Asc)
 {
     SortDirection = sortDirection;
     SearchValue   = searchValue;
     SearchFields  = searchFields;
     SortField     = sortField;
     Limit         = limit;
     Page          = page;
 }
        public int Sort2(string SortItem, RSSortDirectionEnum Direction, bool Clear, RSPageCountMode PaginationMode, out string ReportItem, out RSExecutionInfo2 ExecutionInfo)
        {
            SortDirectionEnum direction      = (SortDirectionEnum)Converter.Convert(Direction);
            PageCountMode     paginationMode = (PageCountMode)Converter.Convert(PaginationMode);
            ExecutionInfo2    execInfo       = null;
            int outval = rs.Sort2(SortItem, direction, Clear, paginationMode, out ReportItem, out execInfo);

            ExecutionInfo = (RSExecutionInfo2)Converter.Convert(execInfo);
            return(outval);
        }
        public new int Sort(string SortItem, SortDirectionEnum Direction, bool Clear, out string ReportItem, out int NumPages)
        {
            string            rptItem = null;
            int               nPages  = 0;
            ProxyMethod <int> method  = new ProxyMethod <int>("Sort", () => base.Sort(SortItem, Direction, Clear, out rptItem, out nPages));
            int               result  = ProxyMethodInvocation.Execute(this, method);

            ReportItem = rptItem;
            NumPages   = nPages;
            return(result);
        }
Exemple #11
0
        public static string GetOrderByNames(this SortDirectionEnum value, bool isThen = false)
        {
            switch (value)
            {
            case SortDirectionEnum.ASC:
                return(isThen ? "ThenBy" : "OrderBy");

            default:
                return(isThen ? "ThenByDescending" : "OrderByDescending");
            }
        }
Exemple #12
0
        public int Sort(string sortItem, SortOrder direction, bool clear, PageCountMode paginationMode, out string reportItem, out ExecutionInfo executionInfo, out int numPages)
        {
            Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.PageCountMode paginationMode2 = SoapPageCountFromViewerAPI(paginationMode);
            SortDirectionEnum direction2 = (direction == SortOrder.Ascending) ? SortDirectionEnum.Ascending : SortDirectionEnum.Descending;

            Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.ExecutionInfo ExecutionInfo;
            int result = Service.Sort(sortItem, direction2, clear, paginationMode2, out reportItem, out ExecutionInfo, out numPages);

            executionInfo = FromSoapExecutionInfo(ExecutionInfo);
            return(result);
        }
Exemple #13
0
 public void SortByPresentation(SortDirectionEnum direction)
 {
     if (direction == SortDirectionEnum.Asc)
     {
         _items.Sort((x, y) => x.Presentation.CompareTo(y.Presentation));
     }
     else
     {
         _items.Sort((x, y) => y.Presentation.CompareTo(x.Presentation));
     }
 }
Exemple #14
0
        // TODO: http://www.albahari.com/nutshell/predicatebuilder.aspx
        //public FetchParameters<TModel> AddFilterRangeAll<TProperty>(Expression<Func<TModel, TProperty>> selector, params TProperty[] values)
        //{

        //	foreach (string keyword in keywords)
        //	{
        //		string temp = keyword;
        //		query = query.Where(p => p.Description.Contains(temp));
        //	}
        //}

        //public FetchParameters<TModel> AddFilterRangeAny<TProperty>(Expression<Func<TModel, TProperty>> selector, params TProperty[] values)
        //{
        //	// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/expression-trees/how-to-use-expression-trees-to-build-dynamic-queries
        //	// https://stackoverflow.com/a/13181067/3469518
        //}

        /// <summary>
        /// Can add only ONE sorting rule! Multiple rules will be added later.
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        public FetchParameters <TModel> AddSorting(string key, SortDirectionEnum sortDirection = SortDirectionEnum.Asc)
        {
            if (SortingRules.Count > 0)
            {
                throw new NotSupportedException("Unable to make multple sorting, sorry. You have to define own separate repository and perform multiple sorting there by LINQ directly");                 // TODO:
            }
            SortingRules.Add(new SortingRule()
            {
                Key = key, SortDirection = sortDirection
            });
            return(this);
        }
Exemple #15
0
        private static string GetSortDirectionTsqlString(SortDirectionEnum sortDirectionEnum)
        {
            switch (sortDirectionEnum)
            {
            case SortDirectionEnum.Ascending:
                return(" ASC");

            case SortDirectionEnum.Descending:
                return(" DESC");
            }
            return("");
        }
Exemple #16
0
 public TableData(
     int reportIid, string reportFile, ReportTypeEnum reportType,
     PrintStatusEnum printStatus,
     int printPathIid, int numCopy, bool sendMessage, bool graph,
     SortDirectionEnum groupDirection1, SortDirectionEnum groupDirection2, SortDirectionEnum groupDirection3,
     string groupHeader1, string groupHeader2, string groupHeader3,
     string groupTable1, string groupTable2, string groupTable3,
     SortDirectionEnum sortDirection1, SortDirectionEnum sortDirection2, SortDirectionEnum sortDirection3,
     string sortHeader1, string sortHeader2, string sortHeader3,
     string sortTable1, string sortTable2, string sortTable3,
     int bulletinNumber, string batchName, int batchUser,
     int batchPathId, int emailId, OutputEnum outputType,
     int dirPathId, string CompletedReportFile, CopyStatusEnum copyStatus, EmailStatusEnum emailStatus, RunStatusEnum runStatus, int eMailType)
 {
     ReportIid                = reportIid;
     ReportFile               = reportFile;
     ReportType               = reportType;
     PrintStatus              = printStatus;
     PrintPathIid             = printPathIid;
     NumCopy                  = numCopy;
     SendMessage              = sendMessage;
     Graph                    = graph;
     GroupDirection1          = groupDirection1;
     GroupDirection2          = groupDirection2;
     GroupDirection3          = groupDirection3;
     GroupHeader1             = groupHeader1;
     GroupHeader2             = groupHeader2;
     GroupHeader3             = groupHeader3;
     GroupTable1              = groupTable1;
     GroupTable2              = groupTable2;
     GroupTable3              = groupTable3;
     SortDirection1           = sortDirection1;
     SortDirection2           = sortDirection2;
     SortDirection3           = sortDirection3;
     SortHeader1              = sortHeader1;
     SortHeader2              = sortHeader2;
     SortHeader3              = sortHeader3;
     SortTable1               = sortTable1;
     SortTable2               = sortTable2;
     SortTable3               = sortTable3;
     BulletinNumber           = bulletinNumber;
     BatchName                = batchName;
     BatchUser                = batchUser;
     BatchPathId              = batchPathId;
     EmailId                  = emailId;
     OutputType               = outputType;
     DirPathId                = dirPathId;
     this.CompletedReportFile = CompletedReportFile;
     CopyStatus               = copyStatus;
     EmailStatus              = emailStatus;
     RunStatus                = runStatus;
     EmailType                = eMailType;
 }
Exemple #17
0
        public async Task <ImageEntity[]> ImageSearchAsync(string text, SortDirectionEnum direction = SortDirectionEnum.Descending, ImageSearchModeEnum searchMode = ImageSearchModeEnum.Popular)
        {
            // Todo: support searching for keywords.
            string directionValue  = direction.GetEnumMemberValue();
            string searchModeValue = searchMode.GetEnumMemberValue();

            //string orderValue = order.GetEnumMemberValue();
            // /user/(*)!imagesearch
            string requestUri = string.Format("{0}/image!search?Scope={1}&SortDirection={2}&SortMethod={3}&Text={4}",
                                              SmugMug.v2.Constants.Addresses.SmugMugApi, this.Uri, directionValue, searchModeValue, text);


            return(await RetrieveEntityArrayAsync <ImageEntity>(requestUri));
        }
Exemple #18
0
        public async Task <PaginationResponse <T> > GetAllDataAsyncWithParameters(
            int limit, int page, string searchValue = "", string searchFields = "",
            string sortField = "", SortDirectionEnum direction = SortDirectionEnum.Asc)
        {
            var parameters = "?limit=" + limit + "&page=" + page;

            if (!string.IsNullOrEmpty(searchValue))
            {
                parameters += "&searchValue=" + searchValue;
            }
            if (!string.IsNullOrEmpty(searchFields))
            {
                parameters += "&searchFields=" + searchFields;
            }
            if (!string.IsNullOrEmpty(sortField))
            {
                parameters += "&sortField=" + sortField + "=" + direction.ToString().ToLower();
            }

            parameters += "&" + _auth;

            var uri      = new Uri(string.Format(Constants.RestUrl + _type + parameters, string.Empty));
            var response = await _client.GetAsync(uri);

            var content = await response.Content.ReadAsStringAsync();

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                var result = JsonConvert.DeserializeObject <PaginationResponse <T> >(content);
                return(result);

            case HttpStatusCode.BadRequest:
                var r = JsonConvert.DeserializeObject <ErrorResponse>(content);
                if (r.Error == "Unauthorized")
                {
                    throw new UnauthorizedAccessException(r.Error);
                }
                else
                {
                    throw new Exception(r.Error);
                }

            case HttpStatusCode.InternalServerError:
                throw new Exception();

            default:
                throw new Exception();
            }
        }
Exemple #19
0
        /// <summary>
        /// Gets the sort direction string.
        /// </summary>
        /// <param name="st">The st.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public static string GetSortDirectionString(SortDirectionEnum st)
        {
            switch (st)
            {
            case SortDirectionEnum.ASC:
                return("ASC");

            case SortDirectionEnum.DESC:
                return("DESC");

            default:
                throw new NotImplementedException();
            }
        }
Exemple #20
0
 public string DoSort(CmsPage page, string column, SortDirectionEnum sortDirection, int pageNumber, int totalResults, Dictionary <string, object> Parameters)
 {
     if (Parameters != null && Parameters.ContainsKey("dataid"))
     {
         this.dataId   = new Guid(Parameters["dataid"].ToString());
         this.dataType = Parameters["datatype"].ToString();
     }
     else if (Parameters != null && Parameters.Keys.Count > 0)
     {
         //filtermodule
         reloadedFromFilterModule = true;
         this.Parameters          = Parameters;
     }
     return(Publish2(page, pageNumber, totalResults, column + " " + sortDirection.ToString()));
 }
        public void AddSortTest()
        {
            SortExpression    target        = new SortExpression();
            string            columnName    = vTestCaseTester.ColumnNames.FieldString;
            SortDirectionEnum sortDirection = SortDirectionEnum.DESC;

            target.AddSort(columnName, sortDirection);
            var enumerator = target.SortInfoList.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Assert.AreEqual(enumerator.Current.ColumnName, columnName);
                Assert.AreEqual(enumerator.Current.Direction, sortDirection);
            }
        }
Exemple #22
0
            public TableData()
            {
                ReportIid = -1;

                NumCopy     = 1;
                SendMessage = false;
                Graph       = false;

                GroupDirection1 = SortDirectionEnum.Ascending;
                GroupDirection2 = SortDirectionEnum.Ascending;
                GroupDirection3 = SortDirectionEnum.Ascending;

                SortDirection1 = SortDirectionEnum.Ascending;
                SortDirection2 = SortDirectionEnum.Ascending;
                SortDirection3 = SortDirectionEnum.Ascending;
            }
Exemple #23
0
        public string DoSort(string pageid, string moduleid, string column, SortDirectionEnum sortDirection, int pageNumber, int totalResults, Dictionary <string, object> parameters)
        {
            BaseModule module = BaseModule.GetById <BaseModule>(new Guid(moduleid));

            if (module == null)
            {
                return("");
            }
            ISortable pageableModule = module.ConvertToType() as ISortable;

            if (pageableModule == null)
            {
                return("");
            }
            CmsPage page = BaseObject.GetById <CmsPage>(Guid.Parse(pageid));

            return(pageableModule.DoSort(page, column, sortDirection, pageNumber, totalResults, parameters));
        }
        public int Sort(string SortItem, SortDirectionEnum Direction, bool Clear, PageCountMode PaginationMode, out string ReportItem, out ExecutionInfo ExecutionInfo, out int NumPages)
        {
            string            rptItem       = null;
            int               nPages        = 0;
            ExecutionInfo2    execInfo      = null;
            ProxyMethod <int> initialMethod = new ProxyMethod <int>("Sort2", delegate
            {
                int result2 = Sort2(SortItem, Direction, Clear, PaginationMode, out rptItem, out execInfo);
                if (execInfo != null)
                {
                    nPages = execInfo.NumPages;
                }
                return(result2);
            });
            ProxyMethod <int> retryMethod = new ProxyMethod <int>("Sort", () => base.Sort(SortItem, Direction, Clear, out rptItem, out nPages));
            int result = ProxyMethodInvocation.Execute(this, initialMethod, retryMethod);

            ExecutionInfo = execInfo;
            NumPages      = nPages;
            ReportItem    = rptItem;
            return(result);
        }
Exemple #25
0
 /// <remarks/>
 public void Sort2Async(string SortItem, SortDirectionEnum Direction, bool Clear, PageCountMode PaginationMode) {
     this.Sort2Async(SortItem, Direction, Clear, PaginationMode, null);
 }
Exemple #26
0
 public int Sort2(string SortItem, SortDirectionEnum Direction, bool Clear, PageCountMode PaginationMode, out string ReportItem, out ExecutionInfo2 ExecutionInfo) {
     object[] results = this.Invoke("Sort2", new object[] {
                 SortItem,
                 Direction,
                 Clear,
                 PaginationMode});
     ReportItem = ((string)(results[1]));
     ExecutionInfo = ((ExecutionInfo2)(results[2]));
     return ((int)(results[0]));
 }
Exemple #27
0
 /// <remarks/>
 public void SortAsync(string SortItem, SortDirectionEnum Direction, bool Clear) {
     this.SortAsync(SortItem, Direction, Clear, null);
 }
Exemple #28
0
 public int Sort(string SortItem, SortDirectionEnum Direction, bool Clear, out string ReportItem, out int NumPages) {
     object[] results = this.Invoke("Sort", new object[] {
                 SortItem,
                 Direction,
                 Clear});
     ReportItem = ((string)(results[1]));
     NumPages = ((int)(results[2]));
     return ((int)(results[0]));
 }
Exemple #29
0
        /// <summary>
        /// Can add only ONE sorting rule! Multiple rules will be added later.
        /// </summary>
        /// <param name="rule"></param>
        /// <returns></returns>
        public FetchParameters <TModel> AddSorting <TProperty>(Expression <Func <TModel, TProperty> > selector, SortDirectionEnum sortDirection = SortDirectionEnum.Asc)
        {
            var name = FetchParameters_InternalHelpers.GetPropertyNameBySelector(selector);

            return(AddSorting(name, sortDirection));
        }
Exemple #30
0
        public async Task <NodeEntity[]> GetChildrenAsync(NodeSortMethodEnum sortMethod = NodeSortMethodEnum.Organizer, SortDirectionEnum sortDirection = SortDirectionEnum.Ascending, TypeEnum type = TypeEnum.All)
        {
            // /node/(*)!children
            //return await node____children(NodeId, $"SortDirection={sortDirection}&SortMethod={sortMethod}&Type={type}");

            string options = $"SortDirection={sortDirection}&SortMethod={sortMethod}&Type={type}";

            // /node/(*)!children
            string requestUri = string.Format("{0}/node/{1}!children{2}", SmugMug.v2.Constants.Addresses.SmugMugApi, NodeId, string.IsNullOrEmpty(options) ? "" : $"?{options}");

            return(await RetrieveEntityArrayAsync <NodeEntity>(requestUri));
        }
Exemple #31
0
 /// <summary>
 /// Adds the sort.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="sortDirection">The sort direction.</param>
 public SortExpression AddSort(string columnName, SortDirectionEnum sortDirection)
 {
     SortInfoList.Add(new SortInfo(columnName, sortDirection));
     return(this);
 }
Exemple #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SortExpression" /> class.
 /// It adds one sort column with ASC direction
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="sortDirection">The sort direction.</param>
 public SortExpression(string columnName, SortDirectionEnum sortDirection)
 {
     AddSort(new SortInfo(columnName, sortDirection));
 }
Exemple #33
0
 /// <remarks/>
 public void Sort2Async(string SortItem, SortDirectionEnum Direction, bool Clear, PageCountMode PaginationMode, object userState) {
     if ((this.Sort2OperationCompleted == null)) {
         this.Sort2OperationCompleted = new System.Threading.SendOrPostCallback(this.OnSort2OperationCompleted);
     }
     this.InvokeAsync("Sort2", new object[] {
                 SortItem,
                 Direction,
                 Clear,
                 PaginationMode}, this.Sort2OperationCompleted, userState);
 }
Exemple #34
0
        /// <summary>
        /// Linq排序扩展方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <param name="propertyName">属性的字符串名称</param>
        /// <param name="sort">排序方式:ASC升序、DESC降序</param>
        /// <returns></returns>
        public static IQueryable <T> SortBy <T>(this IQueryable <T> source, string propertyName, string sort = "asc")
        {
            SortDirectionEnum tmpSort = sort.Equals("asc", StringComparison.CurrentCultureIgnoreCase) ? SortDirectionEnum.Ascending : SortDirectionEnum.Descending;

            return(source.SortBy <T>(propertyName, tmpSort));
        }
Exemple #35
0
 /// <summary>
 /// 构造一个排序字段名称和排序方式的排序条件
 /// </summary>
 /// <param name="sortField">字段名称</param>
 /// <param name="sortDirection">排序方式</param>
 public OrderCondition(string sortField, SortDirectionEnum sortDirection)
 {
     SortField     = sortField;
     SortDirection = sortDirection;
 }
 /// <remarks/>
 public System.IAsyncResult BeginSort(string SortItem, SortDirectionEnum Direction, bool Clear, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("Sort", new object[] {
                 SortItem,
                 Direction,
                 Clear}, callback, asyncState);
 }
Exemple #37
0
        /// <summary>
        /// Linq排序扩展方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <param name="propertyName">属性的字符串名称</param>
        /// <param name="sort">方向</param>
        /// <returns></returns>
        public static IQueryable <T> SortBy <T>(this IQueryable <T> source, string propertyName, SortDirectionEnum sort)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            if (true == propertyName.AsNullOrWhiteSpace())
            {
                return(source);
            }

            ParameterExpression parameter = Expression.Parameter(source.ElementType, String.Empty);
            MemberExpression    property  = Expression.Property(parameter, propertyName);
            LambdaExpression    lambda    = Expression.Lambda(property, parameter);

            string methodName = (sort == SortDirectionEnum.Ascending) ? "OrderBy" : "OrderByDescending";

            Expression methodCallExpression = Expression.Call(typeof(Queryable), methodName,
                                                              new Type[] { source.ElementType, property.Type },
                                                              source.Expression, Expression.Quote(lambda));

            return(source.Provider.CreateQuery <T>(methodCallExpression));
        }
 /// <remarks/>
 public System.IAsyncResult BeginSort2(string SortItem, SortDirectionEnum Direction, bool Clear, PageCountMode PaginationMode, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("Sort2", new object[] {
                 SortItem,
                 Direction,
                 Clear,
                 PaginationMode}, callback, asyncState);
 }