예제 #1
0
        public static DataItemReport CaptureReport(this IScreenSection section, ScreenContent Content)
        {
            var sb            = new StringBuilder();
            var sectionHeader = section as ISectionHeader;
            var sectionDim    = section.CalcDim();
            var itemReport    = new DataItemReport();

            IScreenLoc start = section.ScreenLoc;
            {
                start = start.NewInstance(start.RowNum, start.ColNum);
            }

            int  repeatIx  = 0;
            bool endOfRows = false;

            while (endOfRows == false)
            {
                if ((repeatIx > 0) && (repeatIx >= section.RepeatCount))
                {
                    break;
                }
                repeatIx += 1;

                // section is a subfile. subfile row can be blank. If blank consider as
                // the end of rows of the subfile. So no need to match.
                bool rowIsBlank = false;
                if (section.PurposeCode == ScreenPurposeCode.ReportDetail)
                {
                    if (Content.RowIsBlank(start.RowNum) == true)
                    {
                        rowIsBlank = true;
                    }
                }

                // a blank row. no more rows to match.
                if (rowIsBlank == true)
                {
                    endOfRows = true;
                }

                if (endOfRows == false)
                {
                    var report = sectionHeader.CaptureToReport(start, Content);
                    var combo  = DataItemReport.CombineVertically(itemReport, report);
                    itemReport = combo;
                }
                start.RowNum += 1;
            }

            return(itemReport);
        }
예제 #2
0
        public static bool Match(this IScreenSection section, ScreenContent Content, string DebugInfo)
        {
            bool isMatch    = true;
            var  header     = section as ISectionHeader;
            var  sectionDim = section.CalcDim();

            IScreenLoc start = section.ScreenLoc;
            {
                start = start.NewInstance(start.RowNum, start.ColNum);
            }

            int  repeatIx  = 0;
            bool endOfRows = false;

            while (isMatch == true)
            {
                if ((repeatIx > 0) && (repeatIx >= section.RepeatCount))
                {
                    break;
                }
                repeatIx += 1;

                // section is a subfile. subfile row can be blank. If blank consider as
                // the end of rows of the subfile. So no need to match.
                bool rowIsBlank = false;
                if (section.PurposeCode == ScreenPurposeCode.ReportDetail)
                {
                    if (Content.RowIsBlank(start.RowNum) == true)
                    {
                        rowIsBlank = true;
                    }
                }

                // a blank row. no more rows to match.
                if (rowIsBlank == true)
                {
                    endOfRows = true;
                }

                if (endOfRows == false)
                {
                    isMatch = header.Match(start, Content, DebugInfo);
                }
                start.RowNum += 1;
            }

            return(isMatch);
        }
예제 #3
0
        /// <summary>
        /// find the item within the screen section.
        /// </summary>
        /// <param name="section"></param>
        /// <param name="Start"></param>
        /// <param name="FindLoc"></param>
        /// <param name="Content"></param>
        /// <returns></returns>
        public static ScreenItemInstance FindItem(
            this IScreenSection section, IScreenLoc Start, IScreenLoc FindLoc,
            ScreenContent Content)
        {
            ScreenItemInstance foundItem = null;
            var header     = section as ISectionHeader;
            var sectionDim = section.CalcDim();

            var adjRow = Start.RowNum - 1;
            var adjCol = Start.ColNum - 1;
            var start  = new OneScreenLoc(
                section.ScreenLoc.RowNum + adjRow, section.ScreenLoc.ColNum + adjCol);

            int  repeatIx  = 0;
            bool endOfRows = false;
            int  loopCx    = 0;

            while (foundItem == null)
            {
                if (section.PurposeCode != ScreenPurposeCode.ReportDetail)
                {
                    if (loopCx > 0)
                    {
                        break;
                    }
                }
                else
                {
                    if (repeatIx >= section.GetRepeatCount())
                    {
                        break;
                    }
                    repeatIx += 1;
                }
                loopCx += 1;

                // section is a subfile. subfile row can be blank. If blank consider as
                // the end of rows of the subfile. So no need to match.
                bool rowIsBlank = false;
                if (section.PurposeCode == ScreenPurposeCode.ReportDetail)
                {
                    if (Content.RowIsBlank(start.RowNum) == true)
                    {
                        rowIsBlank = true;
                    }
                }

                // a blank row. no more rows to match.
                if (rowIsBlank == true)
                {
                    endOfRows = true;
                }

                if (endOfRows == false)
                {
                    foundItem = header.FindItem(start, FindLoc, Content);
                    if (foundItem != null)
                    {
                        foundItem.RepeatNum = repeatIx;
                        break;
                    }
                }
                start.RowNum += 1;
            }

            return(foundItem);
        }