Exemplo n.º 1
0
 ResultCell[] GetResultCells(ReportElement[] elements, ResultCell[] row, ResultCell[] col)
 {
     ResultCell[] result = new ResultCell[elements.Length];
     for (int i = 0; i < elements.Length; i++)
     {
         ResultCell val = row.FirstOrDefault(v => v.Element == elements[i]);
         if (val == null) val = col.FirstOrDefault(v => v.Element == elements[i]);
         result[i] = new ResultCell() { Element = elements[i], Value = val.Value };
     }
     return result.ToArray();
 }
Exemplo n.º 2
0
        public static int CompareCells(ResultCell[] a, ResultCell[] b)
        {
            if (a.Length == 0 || a.Length != b.Length) return 0;
            ReportModel model = a[0].Element.Model;

            foreach (ReportElement element in model.Elements.OrderBy(i => i.FinalSortOrder))
            {
                ResultCell aCell = a.FirstOrDefault(i => i.Element == element);
                ResultCell bCell = b.FirstOrDefault(i => i.Element == element);
                if (aCell != null && bCell != null)
                {
                    int result = CompareCell(aCell, bCell);
                    if (result != 0) return (element.SortOrder.Contains(SortOrderConverter.kAscendantSortKeyword) ? 1 : -1) * result;
                }
            }
            return 0;
        }