コード例 #1
0
 private static void AddNotes(DataBase database)
 {
     for (int i = 0; i < database.CountOfTables; i++)
     {
         Console.WriteLine($"Add notes for {database.GetNameOfTable(i).GetString()} table");
         MyString     answer        = new MyString('y');
         int          countOfFields = database.GetCountOfFields(i);
         MyList <Row> rows          = database.GetRows(database.GetNameOfTable(i));
         int          j             = 0;
         while (answer == new MyString('y'))
         {
             for (int k = 0; k < countOfFields; k++)
             {
                 MyString currentField = database.GetNameOfField(i, k);
                 if (!rows[k].IsConnected)
                 {
                     Console.Write($"Input name of note {j + 1} for {rows[k].Data[0].GetString()} field: ");
                 }
                 else
                 {
                     database.PrintNotesWithConnect(rows[k].NumberTableToConnect, rows[k].NumberFieldToConnect);
                 }
                 MyString data = new MyString(Console.ReadLine().ToCharArray());
                 database.AddNote(database.GetNameOfTable(i), data, currentField);
             }
             j++;
             Console.WriteLine("Do you want to add more?(y/n)");
             answer = new MyString(Console.ReadLine().ToCharArray());
         }
     }
 }