示例#1
0
        public void AddEmptyRow( )
        {
            var row = new DataItemList();

            for (var ix = 0; ix < this.Columns.Count; ++ix)
            {
                var item = new DataItem(this.Columns[ix].ColName, "");
                row.Add(item);
            }
            this.Rows.Add(row);
        }
示例#2
0
        public static DataItemReport CombineHorizontally(DataItemReport report1, DataItemReport report2)
        {
            var combo = new DataItemReport();

            if (report1.IsEmpty())
            {
                combo = report2.Copy();
            }

            else if (report2.IsEmpty())
            {
                combo = report1.Copy();
            }

            else
            {
                // report has columns but no rows. add a row with empty items.
                if (report1.Rows.Count == 0)
                {
                    var dummy = report1.Copy();
                    dummy.AddEmptyRow();
                    report1 = dummy;
                }

                if (report2.Rows.Count == 0)
                {
                    var dummy = report2.Copy();
                    dummy.AddEmptyRow();
                    report2 = dummy;
                }

                // combine the colummns.
                combo.AddColumns(report1);
                combo.AddColumns(report2);

                // combine rows.
                foreach (var row1 in report1.Rows)
                {
                    foreach (var row2 in report2.Rows)
                    {
                        var comboRow = new DataItemList();
                        comboRow.AddRange(row1);
                        comboRow.AddRange(row2);

                        combo.Rows.Add(comboRow);
                    }
                }
            }

            return(combo);
        }