Пример #1
0
        private int GetNotes(string name)
        {
            DataBaseConnector db = new DataBaseConnector();
            var pages            = db.GetAllPage(name);

            groupBox2.Text = textBox1.Text;
            int count = pages.Count;

            if (count > tableLayoutPanel1.RowCount)
            {
                for (int i = tableLayoutPanel1.RowCount; i < count; i++)
                {
                    tableLayoutPanel1.RowCount++;
                    tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 62));
                }
            }

            for (int i = 0; i < pages.Count; i++)
            {
                var page = new PageContent()
                {
                    NamePage     = "Сторінка " + (i + 1),
                    PlaceInGroup = i + 1,
                    Name         = pages[i].Name,
                    Type         = pages[i].Type,
                    Model        = pages[i].Model,
                    Number       = pages[i].Number,
                    YoutubeLink1 = pages[i].YoutubeLink1,
                    YoutubeLink2 = pages[i].YoutubeLink2,
                    GameLink2    = pages[i].GameLink2,
                    GameLink1    = pages[i].GameLink1,
                    Id           = pages[i].BookId
                };
                PageContents.Add(page);
                tableLayoutPanel1.Controls.Add(page);
            }

            return(pages.Count);
        }