private void buSelect_Click(object sender, EventArgs e)
        {
            //dataGridAuthors.SelectedRows;



            fmBook bookzz = (fmBook)this.Owner;

            bookzz.insertRowsId.Add(Convert.ToInt32(dataGridAuthors.CurrentRow.Cells["id"].Value));
            //  bookzz.insertingRowsFio.Add(dataGridAuthors.CurrentRow.Cells["ФИО"].Value.ToString());

            //   bookzz.dataGridAuthors.Columns.Add("selected", "Выбрано");
            bookzz.selectedAuthorsId.Add(Convert.ToInt32(dataGridAuthors.CurrentRow.Cells["id"].Value));


            //  bookzz.dataGridAuthors.DataSource = dataGridAuthors.CurrentRow.Cells["id"].Value;

            //    bookzz.nonids.Add

            //    DataTable dt = ((DataTable) dataGridAuthors.DataSource).Clone();
            //   foreach (DataGridViewRow row in dataGridAuthors.SelectedRows)
            //   {
            //   dt.ImportRow(((DataTable)dataGridAuthors.DataSource).Rows[row.Index]);
            //   }
            //  dt.AcceptChanges();

            // bookzz.dataGridAuthors.DataSource = dt;
        }
Example #2
0
        private void buAddBook_Click(object sender, EventArgs e)
        {
            fmBook book = new fmBook();

            book.ShowDialog();

            ShowBooksList();
        }
        public fmAutorList(int bookId)
        {
            InitializeComponent();

            string    authors   = "SELECT a.id, a.f || ' ' || a.i || ' ' || a.o as ФИО, a.date_of_birth as \"Дата рождения\" FROM authors a ";
            DataTable dtAuthors = Fill(authors);

            dataGridAuthors.DataSource            = dtAuthors;
            dataGridAuthors.Columns["id"].Visible = false;

            fmBook bookzz = (fmBook)this.Owner;

            //    bookzz.dataGridAuthors.
        }
Example #4
0
        private void buEditBook_Click(object sender, EventArgs e)
        {
            if (dataGridBooks.Rows.Count > 0)
            {
                int bookId   = Convert.ToInt32(dataGridBooks.CurrentRow.Cells["id"].Value.ToString());
                int rowIndex = dataGridBooks.CurrentRow.Index;

                fmBook book = new fmBook(bookId);
                book.ShowDialog();
                ShowBooksList();

                // dataGridBooks.CurrentCell = dataGridBooks.Rows[rowIndex].Cells[0];
            }
            else
            {
                MessageBox.Show("Нет строки для редактирования");
            }
        }