Ejemplo n.º 1
0
        private void Edit()
        {
            Row         selectedRow = tableParticipants.TableModel.Rows[tableParticipants.SelectedIndicies[0]];
            Participant participant = new Participant();

            participant.Role = selectedRow.Cells[0].Text;
            participant.Name = selectedRow.Cells[1].Text;

            try
            {
                if (selectedRow.Cells[2].Data != null)
                {
                    participant.TrackNumber = (int)selectedRow.Cells[2].Data;
                }
            }
            catch
            {
            }

            participant.Comment = selectedRow.Cells[3].Text;
            FormEditParticipant formNewParticipant = new FormEditParticipant(dataBase, participant, true);

            if (formNewParticipant.ShowDialog(this) == DialogResult.OK)
            {
                selectedRow.Cells[0].Text = participant.Role;
                selectedRow.Cells[1].Text = participant.Name;
                if (participant.TrackNumber > 0)
                {
                    selectedRow.Cells[2].Data = participant.TrackNumber;
                }
                else
                {
                    selectedRow.Cells[2].Data = null;
                }
                selectedRow.Cells[3].Text = participant.Comment;
            }
        }
Ejemplo n.º 2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Participant         participant        = new Participant();
            FormEditParticipant formNewParticipant = new FormEditParticipant(dataBase, participant, false);

            if (formNewParticipant.ShowDialog(this) == DialogResult.OK)
            {
                Cell[] items = new Cell[4];
                items[0] = new Cell(participant.Role);
                items[1] = new Cell(participant.Name);
                if (participant.TrackNumber > 0)
                {
                    items[2] = new Cell(participant.TrackNumber);
                }
                else
                {
                    items[2] = new Cell(null);
                }
                items[3] = new Cell(participant.Comment);

                Row row = new Row(items);
                tableParticipants.TableModel.Rows.Add(row);
            }
        }