示例#1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            DBConnection    dbConnection = DBConnection.getInstance();
            DataGridViewRow selectedRow  = dataGridViewRoles.SelectedRows[0];
            int             id           = Convert.ToInt32(selectedRow.Cells["rol_id"].Value);
            string          query        = QueryProvider.DELETE_ROLE(id);

            dbConnection.executeQuery(query);
            this.Close();
            RefToRolForm.Show();
        }
示例#2
0
        private void dataGridViewRoles_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                DataGridViewRow selectedRow     = dataGridViewRoles.Rows[e.RowIndex];
                string          selected_rol_id = Convert.ToString(selectedRow.Cells["rol_id"].Value);
                dataGridViewRoles.AllowUserToAddRows    = false;
                dataGridViewRoles.AllowUserToDeleteRows = false;
                dataGridViewRoles.ReadOnly = false;
                DBConnection dbConnection = DBConnection.getInstance();
                int          id           = Convert.ToInt32(selectedRow.Cells["rol_id"].Value);
                string       query        = QueryProvider.DELETE_ROLE(id);
                dbConnection.executeQuery(query);
                this.Close();
                RefToRolForm.Show();
            }
        }