コード例 #1
0
    public static ScreenItemInstance FindItem(
      this IScreenItem item, IScreenLoc Start, IScreenLoc FindZeroLoc, 
      ScreenContent Content)
    {
      ScreenItemInstance findItem = null;

      if (item.ItemType == ShowItemType.Section)
      {
        var sectionItem = item as IScreenSection;
        findItem = sectionItem.FindItem(Start, FindZeroLoc, Content);
      }

      else
      {
        // adjust screen loc of the item by start pos of the section it is contained in.
        var adjRow = Start.RowNum - 1;
        var adjCol = Start.ColNum - 1;
        var loc = new OneScreenLoc(
          item.ScreenLoc.RowNum + adjRow, item.ScreenLoc.ColNum + adjCol);
        var zeroLoc = loc.ToZeroRowCol();

        var itemAtomic = item as IScreenAtomic;
        var range = new ScreenLocRange(zeroLoc, itemAtomic.Length, Content.ScreenDim);
        if (range.Contains(FindZeroLoc) == true)
          findItem = new ScreenItemInstance(item, range.From);
      }

      return findItem;
    }
コード例 #2
0
        public static ScreenItemInstance FindItem(
            this IScreenDefn Defn, IScreenLoc FindLoc, ScreenContent Content)
        {
            ScreenItemInstance found = null;

            ISectionHeader sectionHeader = Defn as ISectionHeader;
            var            start         = new OneScreenLoc(1, 1);

            found = sectionHeader.FindItem(start, FindLoc, Content);

            return(found);
        }
コード例 #3
0
        public static ScreenItemInstance FindItem(
            this ISectionHeader section, IScreenLoc Start, IScreenLoc FindLoc, ScreenContent Content)
        {
            ScreenItemInstance findItem = null;

            // find the screenitem located at the find location.
            foreach (var item in section.Items)
            {
                findItem = item.FindItem(Start, FindLoc, Content);
                if (findItem != null)
                {
                    break;
                }
            }

            return(findItem);
        }
コード例 #4
0
        /// <summary>
        /// capture the data of the screen to a DataTable class.
        /// </summary>
        /// <param name="Defn"></param>
        /// <param name="Content"></param>
        /// <returns></returns>
        public static EnhancedDataTable Capture(
            this IScreenDefn Defn, ScreenContent Content,
            ScreenItemInstance ItemInstance = null)
        {
            ISectionHeader sectionHeader = Defn as ISectionHeader;
            var            start         = new OneScreenLoc(1, 1);
            var            report        = sectionHeader.CaptureToReport(start, Content);
            var            table         = report.ToDataTable();

            // mark the selected datarow in the dataTable.
            int rownum = 0;

            if ((ItemInstance != null) && (ItemInstance.RepeatNum > 0))
            {
                rownum = ItemInstance.RepeatNum - 1;
            }
            table.MarkSelectedRow(rownum);

            return(table);
        }
コード例 #5
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);
        }