예제 #1
0
        private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var livrosSelect = ((System.Data.DataRowView)
                                this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row
                               as MVCProject.SistemaBibliotecaDBDataSet.LivrosRow;

            switch (e.ColumnIndex)
            {
            case 0: {
                this.livrosTableAdapter.DeleteQuery(livrosSelect.Id);
            } break;

            case 1: {
                frmEditLivros livroEdit = new frmEditLivros();
                livroEdit.LivrosRow = livrosSelect;
                livroEdit.ShowDialog();


                this.livrosTableAdapter.Update(livroEdit.LivrosRow);
            }
            break;
            }

            this.livrosTableAdapter.CustomQuery(sistemaBibliotecaDBDataSet.Livros);
        }
예제 #2
0
        private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var livroSelect = ((System.Data.DataRowView) this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row as MVCProject.SistemaBibliotecaDBDataSet.LivrosRow;

            switch (e.ColumnIndex)
            {
            case 0:
            {
                this.livrosTableAdapter.SetNaoAtivoQuery(livroSelect.Id);
                this.livrosTableAdapter.SelectAtivos(sistemaBibliotecaDBDataSet.Livros);
            }
            break;

            case 1:
            {
                frmEditLivros telaEditarLivro = new frmEditLivros();
                telaEditarLivro.LivrosRow = livroSelect;
                telaEditarLivro.ShowDialog();
                this.livrosTableAdapter.SelectAtivos(this.sistemaBibliotecaDBDataSet.Livros);
            }
            break;
            }
        }