示例#1
0
        public static IReadOnlyList <IColumnComparer> Convert(DataSet <Sorting> sortings)
        {
            sortings.VerifyNotNull(nameof(sortings));
            if (sortings.Validate().Count != 0)
            {
                throw new ArgumentException(DiagnosticMessages.Sorting_HasValidationError, nameof(sortings));
            }

            if (sortings.Count == 0)
            {
                return(Array.Empty <IColumnComparer>());
            }

            var _      = sortings._;
            var result = new IColumnComparer[sortings.Count];

            for (int i = 0; i < sortings.Count; i++)
            {
                var column    = _.Column[i];
                var direction = _.Direction[i];
                Debug.Assert(direction == SortDirection.Ascending || direction == SortDirection.Descending);
                result[i] = DataRow.OrderBy(column, direction);
            }

            return(result);
        }
示例#2
0
 /// <summary>
 /// Parameterless constructor for xml serialization.
 /// </summary>
 public PanelModel()
 {
     m_Punto       = App.Resolve <IPuntoSwitcherService>();
     m_Updater     = App.Resolve <IPanelUpdater>();
     m_Items       = new List <PanelItemBase>();
     m_Data        = new List <PanelItemBase>();
     m_Keys        = new List <PanelItemBase>();
     m_CurrentPath = new ObjectPath <PanelItemBase>();
     m_Comparer    = new ColumnComparer(0, PanelSortOrder.Ascending);
     CurrentView   = PanelViewMode.Details;
 }
示例#3
0
        public async Task Db_GetSalesOrderHeadersAsync_sort()
        {
            var orderBy = new IColumnComparer[] { DataRow.OrderBy(new SalesOrderHeader().PurchaseOrderNumber, SortDirection.Descending) };

            using (var db = await MockSalesOrder.CreateAsync(CreateDb()))
            {
                var result = await db.GetSalesOrderHeadersAsync(null, orderBy);

                Assert.AreEqual(4, result.Count);
                var _ = result._;
                Assert.AreEqual("PO348186287", _.PurchaseOrderNumber[0]);
                Assert.AreEqual("PO19952192051", _.PurchaseOrderNumber[1]);
                Assert.AreEqual("PO19604173239", _.PurchaseOrderNumber[2]);
                Assert.AreEqual("PO19372114749", _.PurchaseOrderNumber[3]);
            }
        }