Example #1
0
        /// <summary>
        /// Looks for the column named "commentColumn" and applies to all columns from the list "addTags"
        /// the function AddColumnBetween. Displays the table obtained in such a way.
        /// An exception is thrown if any string from addTags and commentColumn is missing inside the first row.
        /// </summary>
        /// <param name="addTags"></param>
        public void DisplayAddTable(List <string> addTags, string commentColumn)
        {
            DateTime TimeOne     = DateTime.Now;
            MyTable  LocalTable  = TableInfo();///Put into the variable LocalTable the current content from the form.
            int      FoundColumn = LocalTable.FindInFirstRow(commentColumn);

            if (FoundColumn <= 0)
            {
                throw new ArgumentException("Wrong argument commentColumn passed to DisplayAddTable");
            }

            List <string> CommentColumn = LocalTable.GiveColumn(FoundColumn);

            for (int MyIterator = 1; MyIterator <= addTags.Count(); MyIterator++)
            {
                if (LocalTable.FindInFirstRow(addTags[MyIterator - 1]) <= 0)
                {
                    throw new ArgumentException("Wrong column name passed inside the argument addTags, the name is " + addTags[MyIterator - 1]);
                }
                LocalTable.AddColumnBetween(commentColumn, addTags[MyIterator - 1]);
            }
            DateTime     TimeTwo   = DateTime.Now;
            TimeSpan     MySpan    = (TimeTwo - TimeOne);
            const string AddedInfo = "GridInputTable|DisplayAddTable";

            MyStringOperations.LogInfo(MySpan, AddedInfo);
            DisplayTable(LocalTable);
        }