Exemple #1
0
        public bool IsSortSupported(string propertyName)
        {
            if (string.IsNullOrEmpty(propertyName))
            {
                throw new ArgumentException("propertyName");
            }
            if (!this.DataTableLoader.Table.Columns.Contains(propertyName))
            {
                return(false);
            }
            SortSupportDescription sortSupportDescription = this.SortSupportDescriptions.FirstOrDefault((SortSupportDescription arg) => string.Compare(arg.ColumnName, propertyName, StringComparison.OrdinalIgnoreCase) == 0);

            if (sortSupportDescription != null)
            {
                return(sortSupportDescription.SortMode != SortMode.NotSupported && !string.IsNullOrEmpty(sortSupportDescription.SortedColumnName));
            }
            return(typeof(IComparable).IsAssignableFrom(this.DataTableLoader.Table.Columns[propertyName].DataType));
        }
Exemple #2
0
        private string CreateSortString(PropertyDescriptor property, ListSortDirection direction)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append('[');
            string columnName = property.Name;

            if (this.DataTableLoader.Table.Columns.Contains(columnName))
            {
                SortSupportDescription sortSupportDescription = this.SortSupportDescriptions.FirstOrDefault((SortSupportDescription arg) => string.Compare(arg.ColumnName, columnName, StringComparison.OrdinalIgnoreCase) == 0);
                if (sortSupportDescription != null && !string.IsNullOrEmpty(sortSupportDescription.SortedColumnName))
                {
                    columnName = sortSupportDescription.SortedColumnName;
                }
            }
            stringBuilder.Append(columnName);
            stringBuilder.Append(']');
            if (ListSortDirection.Descending == direction)
            {
                stringBuilder.Append(" DESC");
            }
            return(stringBuilder.ToString());
        }
Exemple #3
0
 private void DetachSort(SortSupportDescription sortSupportDescription)
 {
     sortSupportDescription.DataTableLoaderView = null;
 }
Exemple #4
0
 private void AttachSort(SortSupportDescription sortSupportDescription)
 {
     sortSupportDescription.DataTableLoaderView = this;
 }