コード例 #1
0
        public override void Undo(object p_args)
        {
            SubTotalCmdArgs args   = (SubTotalCmdArgs)p_args;
            RptMtxLevel     pLevel = args.Parent as RptMtxLevel;
            RptMtxSubtotal  total  = args.SubTotal;
            RptMatrix       mtx    = pLevel.Matrix;

            total.TotalLoc = total.TotalLoc == TotalLocation.After ? TotalLocation.Before : TotalLocation.After;
            if (pLevel != null)
            {
                if (pLevel.Parent is RptMtxRowHeader)
                {
                    mtx.Rows.RemoveRange(args.CurIndex, args.OpsRows.Count);
                    mtx.Rows.InsertRange(args.BefIndex, args.OpsRows);
                }
                else
                {
                    foreach (RptMtxRow row in args.OpsCells.Keys)
                    {
                        row.Cells.RemoveRange(args.CurIndex, args.OpsCells[row].Count);
                        row.Cells.InsertRange(args.BefIndex, args.OpsCells[row]);
                    }
                }
            }
            mtx.Update(true);
        }
コード例 #2
0
ファイル: RptMtxSubTitleCmd.cs プロジェクト: Daoting/dt
        public override void Undo(object p_args)
        {
            SubTitleCmdArgs args  = (SubTitleCmdArgs)p_args;
            RptMtxSubtitle  title = args.SubTitle;
            RptMatrix       mtx   = title.Level.Matrix;

            title.Span = args.OldSpan;
            mtx.Update(true);
        }
コード例 #3
0
        public override void Undo(object p_args)
        {
            SubTotalCmdArgs args  = (SubTotalCmdArgs)p_args;
            RptMtxSubtotal  total = args.SubTotal;
            RptMatrix       mtx   = total.Level.Matrix;

            total.Span = args.OldSpan;
            mtx.Update(true);
        }
コード例 #4
0
ファイル: RptMtxSubTitleCmd.cs プロジェクト: Daoting/dt
        public override object Execute(object p_args)
        {
            SubTitleCmdArgs args  = (SubTitleCmdArgs)p_args;
            RptMtxSubtitle  title = args.SubTitle;
            RptMatrix       mtx   = title.Level.Matrix;

            args.OldSpan = title.Span;
            title.Span   = args.NewSpan;
            mtx.Update(true);
            return(null);
        }
コード例 #5
0
        public override object Execute(object p_args)
        {
            SubTotalCmdArgs args  = (SubTotalCmdArgs)p_args;
            RptMtxSubtotal  total = args.SubTotal;
            RptMatrix       mtx   = total.Level.Matrix;

            args.OldSpan = total.Span;
            total.Span   = args.NewSpan;
            mtx.Update(true);
            return(null);
        }
コード例 #6
0
ファイル: InsertMatrixCmd.cs プロジェクト: Daoting/dt
        public override void Undo(object p_args)
        {
            MatrixArgs args = p_args as MatrixArgs;
            RptMatrix  mtx  = args.Matrix;

            if (args.HeaderType == RptMtxHeaderType.Col)
            {
                mtx.HideColHeader = !args.Val;
                mtx.RowSpan      += mtx.ColHeader.RowSpan * (!args.Val ? -1 : 1);
            }
            else
            {
                mtx.HideRowHeader = !args.Val;
                mtx.ColSpan      += mtx.RowHeader.ColSpan * (!args.Val ? -1 : 1);
            }
            mtx.Update(true);
        }
コード例 #7
0
ファイル: InsertMatrixCmd.cs プロジェクト: Daoting/dt
        public override object Execute(object p_args)
        {
            MatrixArgs args = p_args as MatrixArgs;
            RptMatrix  mtx  = args.Matrix;

            if (args.HeaderType == RptMtxHeaderType.Col)
            {
                //重做
                if (!args.IsFirst)
                {
                    mtx.HideColHeader = args.Val;
                }
                else
                {
                    args.Val = mtx.HideColHeader;
                }
                mtx.RowSpan += mtx.ColHeader.RowSpan * (args.Val ? -1 : 1);
            }
            else
            {
                //重做
                if (!args.IsFirst)
                {
                    mtx.HideRowHeader = args.Val;
                }
                else
                {
                    args.Val = mtx.HideRowHeader;
                }
                mtx.ColSpan += mtx.RowHeader.ColSpan * (args.Val ? -1 : 1);
            }
            if (args.IsFirst)
            {
                args.IsFirst = false;
            }
            mtx.Update(true);
            return(mtx);
        }
コード例 #8
0
ファイル: RptMtxSubTitleCmd.cs プロジェクト: Daoting/dt
        public override void Undo(object p_args)
        {
            SubTitleCmdArgs args   = (SubTitleCmdArgs)p_args;
            RptMtxSubtitle  title  = args.SubTitle;
            RptItemBase     parent = args.Parent;
            RptMatrix       mtx    = null;

            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                args.BackMtxRow();
                pLevel.SubTitles.Insert(args.TilteIndex, title);
            }
            else
            {
                RptMtxSubtitle pTotal = parent as RptMtxSubtitle;
                mtx = pTotal.Level.Matrix;
                args.BackMtxRow();
                pTotal.SubTitles.Insert(args.TilteIndex, title);
            }
            mtx.Update(true);
        }
コード例 #9
0
ファイル: RptMtxSubTitleCmd.cs プロジェクト: Daoting/dt
        public override void Undo(object p_args)
        {
            SubTitleCmdArgs args   = (SubTitleCmdArgs)p_args;
            RptMtxSubtitle  title  = args.SubTitle;
            RptItemBase     parent = args.Parent;
            RptMatrix       mtx    = null;

            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                args.DelMtxRows();
                pLevel.SubTitles.Remove(title);
            }
            else
            {
                RptMtxSubtitle pTitle = parent as RptMtxSubtitle;
                mtx = pTitle.Level.Matrix;
                args.DelMtxRows();
                pTitle.SubTitles.Remove(title);
            }
            mtx.Update(true);
        }
コード例 #10
0
        public override void Undo(object p_args)
        {
            SubTotalCmdArgs args   = (SubTotalCmdArgs)p_args;
            RptMtxSubtotal  total  = args.SubTotal;
            RptItemBase     parent = args.Parent;
            RptMatrix       mtx    = null;

            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                args.DelMtxRows();
                pLevel.SubTotals.Remove(total);
            }
            else
            {
                RptMtxSubtotal pTotal = parent as RptMtxSubtotal;
                mtx = pTotal.Level.Matrix;
                args.DelMtxRows();
                pTotal.SubTotals.Remove(total);
            }
            mtx.Update(true);
        }
コード例 #11
0
ファイル: RptMtxSubTitleCmd.cs プロジェクト: Daoting/dt
        public override object Execute(object p_args)
        {
            SubTitleCmdArgs  args       = (SubTitleCmdArgs)p_args;
            RptItemBase      parent     = args.Parent;
            RptMtxSubtitle   title      = args.SubTitle;
            RptMtxHeaderType headerType = RptMtxHeaderType.Col;
            RptMatrix        mtx        = null;

            args.InitData();
            if (parent is RptMtxLevel)
            {
                RptMtxLevel pLevel = parent as RptMtxLevel;
                mtx = pLevel.Matrix;
                if (pLevel.Parent is RptMtxRowHeader)
                {
                    headerType = RptMtxHeaderType.Row;
                }
                DelRows(args, headerType, mtx, title);
                args.TilteIndex = pLevel.SubTitles.IndexOf(title);
                pLevel.SubTitles.Remove(title);
            }
            else
            {
                RptMtxSubtitle pTotal = parent as RptMtxSubtitle;
                mtx = pTotal.Level.Matrix;
                if (pTotal.Level.Parent is RptMtxRowHeader)
                {
                    headerType = RptMtxHeaderType.Row;
                }
                DelRows(args, headerType, mtx, title);
                args.TilteIndex = pTotal.SubTitles.IndexOf(title);
                pTotal.SubTitles.Remove(title);
            }
            mtx.Update(true);
            return(null);
        }
コード例 #12
0
ファイル: RptMtxSubTitleCmd.cs プロジェクト: Daoting/dt
        public override object Execute(object p_args)
        {
            SubTitleCmdArgs  args       = (SubTitleCmdArgs)p_args;
            RptItemBase      parent     = args.Parent;
            RptMtxHeaderType headerType = RptMtxHeaderType.Col;
            RptMtxSubtitle   title      = args.SubTitle;
            RptMatrix        mtx        = null;

            if (title == null)
            {
                title = new RptMtxSubtitle(parent);
                args.InitData();
                if (parent is RptMtxLevel)
                {
                    RptMtxLevel pLevel = parent as RptMtxLevel;
                    mtx = pLevel.Matrix;
                    if (pLevel.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    title.Item.Val = string.Format("subtitle{0}", mtx.GetMaxTitle());

                    RptMtxHeader header = pLevel.Parent as RptMtxHeader;
                    if (pLevel.SubTitles.Count > 0 || header.Levels.Count > header.Levels.IndexOf(pLevel) + 1)
                    {
                        int curIndex = 0;
                        if (headerType == RptMtxHeaderType.Row)
                        {
                            int subLevelSpan = 0;
                            if (header.Levels.Count > header.Levels.IndexOf(pLevel) + 1)
                            {
                                subLevelSpan = header.Levels[header.Levels.IndexOf(pLevel) + 1].RowSpan;
                            }

                            curIndex = pLevel.Row - mtx.ColHeader.Row - mtx.ColHeader.RowSpan + subLevelSpan + pLevel.GetTitleSpan(pLevel.SubTitles);
                            args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                        }
                        else
                        {
                            int subLevelSpan = 0;
                            if (header.Levels.Count > header.Levels.IndexOf(pLevel) + 1)
                            {
                                subLevelSpan = header.Levels[header.Levels.IndexOf(pLevel) + 1].ColSpan;
                            }

                            curIndex = pLevel.Col - mtx.RowHeader.Col - mtx.RowHeader.ColSpan + subLevelSpan + pLevel.GetTitleSpan(pLevel.SubTitles);
                            foreach (RptMtxRow row in mtx.Rows)
                            {
                                args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                            }
                        }
                        args.CurIndex = curIndex;
                    }
                    pLevel.SubTitles.Add(title);
                }
                else
                {
                    RptMtxSubtitle pTitle = parent as RptMtxSubtitle;
                    mtx = pTitle.Level.Matrix;
                    if (pTitle.Level.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    title.Item.Val = string.Format("subtitle{0}", mtx.GetMaxTitle());
                    if (pTitle.SubTitles.Count > 0)
                    {
                        int curIndex = 0;
                        if (headerType == RptMtxHeaderType.Row)
                        {
                            curIndex = pTitle.Row + pTitle.RowSpan - mtx.ColHeader.Row - mtx.ColHeader.RowSpan;
                            args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                        }
                        else
                        {
                            curIndex = pTitle.Col + pTitle.ColSpan - mtx.RowHeader.Col - mtx.RowHeader.ColSpan;
                            foreach (RptMtxRow row in mtx.Rows)
                            {
                                args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                            }
                        }
                        args.CurIndex = curIndex;
                    }
                    pTitle.SubTitles.Add(title);
                }
                args.SubTitle = title;
            }
            else
            {
                mtx = title.Level.Matrix;
                if (parent is RptMtxLevel)
                {
                    args.BackMtxRow();
                    (parent as RptMtxLevel).SubTitles.Add(title);
                }
                else
                {
                    (parent as RptMtxSubtitle).SubTitles.Add(title);
                }
            }
            mtx.Update(true);
            return(title);
        }
コード例 #13
0
        public override object Execute(object p_args)
        {
            SubTotalCmdArgs  args       = (SubTotalCmdArgs)p_args;
            RptItemBase      parent     = args.Parent;
            RptMtxHeaderType headerType = RptMtxHeaderType.Col;
            RptMtxSubtotal   total      = args.SubTotal;
            RptMatrix        mtx        = null;

            if (total == null)
            {
                total = new RptMtxSubtotal(parent);
                args.InitData();
                if (parent is RptMtxLevel)
                {
                    RptMtxLevel pLevel = parent as RptMtxLevel;
                    mtx = pLevel.Matrix;
                    if (pLevel.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    total.Item.Val = string.Format("subtotal{0}", mtx.GetMaxTotal());
                    int curIndex = 0;
                    if (headerType == RptMtxHeaderType.Row)
                    {
                        curIndex = pLevel.Row;
                        if (!mtx.HideRowHeader && !mtx.HideColHeader)
                        {
                            curIndex -= (mtx.Corner.Row + mtx.Corner.RowSpan);
                        }
                        args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                    }
                    else
                    {
                        curIndex = pLevel.Col - mtx.Rows[0].Col;
                        foreach (RptMtxRow row in mtx.Rows)
                        {
                            args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                        }
                    }
                    args.CurIndex = curIndex;
                }
                else
                {
                    RptMtxSubtotal pTotal = parent as RptMtxSubtotal;
                    mtx = pTotal.Level.Matrix;
                    if (pTotal.Level.Parent is RptMtxRowHeader)
                    {
                        headerType = RptMtxHeaderType.Row;
                    }
                    total.Item.Val = string.Format("subtotal{0}", mtx.GetMaxTotal());
                    if (pTotal.SubTotals.Count > 0)
                    {
                        int curIndex = 0;
                        if (headerType == RptMtxHeaderType.Row)
                        {
                            curIndex = pTotal.Row + pTotal.GetCount();
                            if (!mtx.HideColHeader && !mtx.HideRowHeader)
                            {
                                curIndex -= (mtx.Corner.Row + mtx.Corner.RowSpan);
                            }
                            args.OpsRows.Add(InsertNewRow(mtx, curIndex));
                        }
                        else
                        {
                            curIndex = pTotal.Col - mtx.Rows[0].Col + pTotal.GetCount();
                            foreach (RptMtxRow row in mtx.Rows)
                            {
                                args.OpsCells.Add(row, InsertNewCell(mtx, row, curIndex).ToList());
                            }
                        }
                        args.CurIndex = curIndex;
                    }
                }
            }
            else
            {
                mtx = total.Level.Matrix;
                args.BackMtxRow();
            }
            if (parent is RptMtxLevel)
            {
                (parent as RptMtxLevel).SubTotals.Add(total);
            }
            else
            {
                (parent as RptMtxSubtotal).SubTotals.Add(total);
            }
            args.SubTotal = total;
            mtx.Update(true);
            return(total);
        }
コード例 #14
0
        public override object Execute(object p_args)
        {
            SubTotalCmdArgs args   = (SubTotalCmdArgs)p_args;
            RptMtxLevel     pLevel = args.Parent as RptMtxLevel;
            RptMtxSubtotal  total  = args.SubTotal;
            RptMatrix       mtx    = pLevel.Matrix;

            if (pLevel != null)
            {
                int count    = 0;
                int newIndex = 0;
                int index    = 0;
                if (pLevel.Parent is RptMtxRowHeader)
                {
                    args.OpsRows = total.GetRptRows(out index);
                    mtx.Rows.RemoveRange(index, args.OpsRows.Count);
                    if (total.TotalLoc == TotalLocation.Before)
                    {
                        count = (from c in pLevel.SubTotals
                                 where c.TotalLoc == total.TotalLoc &&
                                 pLevel.SubTotals.IndexOf(c) >= pLevel.SubTotals.IndexOf(total)
                                 select c).Count();
                        newIndex = pLevel.Row - count - (mtx.Row + mtx.ColHeader.RowSpan);
                    }
                    else
                    {
                        count = (from c in pLevel.SubTotals
                                 where c.TotalLoc == total.TotalLoc &&
                                 pLevel.SubTotals.IndexOf(c) < pLevel.SubTotals.IndexOf(total)
                                 select c).Count();
                        newIndex = pLevel.Row + pLevel.RowSpan + count - (mtx.Row + mtx.ColHeader.RowSpan);
                    }
                    mtx.Rows.InsertRange(newIndex, args.OpsRows);
                }
                else
                {
                    args.OpsCells = total.GetRptCells(out index);
                    foreach (RptMtxRow row in args.OpsCells.Keys)
                    {
                        row.Cells.RemoveRange(index, args.OpsCells[row].Count);
                        if (total.TotalLoc == TotalLocation.Before)
                        {
                            count = (from c in pLevel.SubTotals
                                     where c.TotalLoc == total.TotalLoc &&
                                     pLevel.SubTotals.IndexOf(c) >= pLevel.SubTotals.IndexOf(total)
                                     select c).Count();
                            newIndex = pLevel.Col - count - (mtx.Col + mtx.RowHeader.ColSpan);
                        }
                        else
                        {
                            count = (from c in pLevel.SubTotals
                                     where c.TotalLoc == total.TotalLoc &&
                                     pLevel.SubTotals.IndexOf(c) < pLevel.SubTotals.IndexOf(total)
                                     select c).Count();
                            newIndex = pLevel.Col + pLevel.ColSpan + count - (mtx.Col + mtx.RowHeader.ColSpan);
                        }
                        row.Cells.InsertRange(newIndex, args.OpsCells[row]);
                    }
                }
                args.BefIndex = index;
                args.CurIndex = newIndex;
            }
            mtx.Update(true);
            return(null);
        }