Exemple #1
0
        public BookShelf BookShelf()
        {
            BookShelf shelf = new BookShelf();

            shelf.ShelfName     = textBox.Text;
            shelf.ShelfPosition = textBox1.Text;
            return(shelf.GetObj);
        }
        private void AddShelf()
        {
            Add win = new PostgreSQL_APP.Add("shelf");

            win.ShowDialog();
            if (win.ok)
            {
                BookShelf bs = win.BookShelf();
                pgsql.SetParamsBookShelf(bs.GetProcName, bs.ShelfName, bs.ShelfPosition);
                pgsql.Query();
                MessageBox.Show("Успешно добавлено");
            }
        }
        private void EditShelf()
        {
            Edit win = new PostgreSQL_APP.Edit("shelf");
            int  num = ShelfTable.SelectedIndex;

            if (num == -1)
            {
                throw new Exception("Не выбрана строка для изменения!");
            }
            int id = (int)shelfDt.Rows[num][0];

            win.textBox.Text  = (string)shelfDt.Rows[num][1];
            win.textBox1.Text = (string)shelfDt.Rows[num][2];
            win.ShowDialog();
            if (win.ok)
            {
                BookShelf bs = win.BookShelf();
                pgsql.SetParamsBookShelf(bs.GetEditProcName, bs.ShelfName, bs.ShelfPosition, id);
                pgsql.Query();
                MessageBox.Show("Успешно изменено\nОбновите таблицу");
            }
        }