예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataGridView1.Columns["colEdit"].Index)
            {
                //clicked the edit column.
                var clickedEvent = dataGridView1.Rows[e.RowIndex].DataBoundItem as Event;

                var dlg = new EventEditor()
                {
                    Database = Database, selectedEvent = clickedEvent
                };
                dlg.ShowDialog();
                RefreshGrid();
            }
            else if (e.ColumnIndex == dataGridView1.Columns["colDelete"].Index)
            {
                //clicked the delete column.
                var clickedEvent = dataGridView1.Rows[e.RowIndex].DataBoundItem as Event;
                var result       = MessageBox.Show(owner: this, text: "Are you sure you want to delete? This cannot be undone.", caption: "Delete", buttons: MessageBoxButtons.OKCancel, icon: MessageBoxIcon.Warning);

                if (result == DialogResult.OK)
                {
                    Database.deleteEvent(clickedEvent);

                    RefreshGrid();
                }
            }
        }
예제 #2
0
        private void miEventAdd_Click(object sender, EventArgs e)
        {
            var dlg = new EventEditor()
            {
                Database = _database
            };

            dlg.ShowDialog(this);
        }
예제 #3
0
        private void miAddEvent_Click(object sender, EventArgs e)
        {
            var dlg = new EventEditor()
            {
                Database = Database
            };

            dlg.ShowDialog(this);

            RefreshGrid();
        }
예제 #4
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != dataGridView1.Columns["colDelete"].Index)
            {
                var clickedEvent = dataGridView1.Rows[e.RowIndex].DataBoundItem as Event;

                var dlg = new EventEditor()
                {
                    Database = Database, selectedEvent = clickedEvent
                };
                dlg.ShowDialog();
                RefreshGrid();
            }
        }