Пример #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);
        }
Пример #2
0
 /// <summary>
 /// It is assumed that the table "tableToReplace" contains columns with headers "NameOfField" and "Description". The method puts into lists "names" and "descriptions" the content of columns with those headers.
 /// </summary>
 /// <param mainFile="tableToReplace"></param>
 /// <param mainFile="names"></param>
 /// <param mainFile="descriptions"></param>
 public static void NameDescriptionDictionary(ref MyTable tableToReplace, ref List <string> names, ref List <string> descriptions)
 {
     tableToReplace.GiveColumn(TablesFieldsEnum.NameOfField.ToString(), ref names);
     tableToReplace.GiveColumn(TablesFieldsEnum.Description.ToString(), ref descriptions);
 }