public DataTable FetchAllOrderedByCreatedOn(int formId)
        {
            var dt = new ViewableFileCollection(formId).LoadAll().ToDataTable();

            dt.DefaultView.Sort = "createdon desc";
            return(dt.DefaultView.ToTable());
        }
Exemple #2
0
        /// <summary>
        /// Sorts each file in descending order in this collection and returns the sorted collection
        /// </summary>
        public ViewableFileCollection OrderByDesc(string fieldName)
        {
            var sortedFiles = this.OrderByDescending(file => file.GetStoredValue(fieldName));
            ViewableFileCollection sortedCollection = new ViewableFileCollection(this.EncapsulatedForm);

            sortedCollection.Clear();
            sortedCollection.AddRange(sortedFiles);
            return(sortedCollection);
        }
        public DataTable FetchAll(int formId, string orderfield, bool orderdesc)
        {
            ViewableFileCollection orderedFiles = new ViewableFileCollection(formId);

            orderedFiles.LoadAll();
            // if (!orderdesc)
            //     orderedFiles.AddRange(FileCollection.LoadAll(formId).OrderBy(file => file.GetStoredValue(orderfield)));
            // else
            //     orderedFiles.AddRange(FileCollection.LoadAll(formId).OrderByDescending(file => file.GetStoredValue(orderfield)));
            return(orderedFiles.ToDataTable());
        }