示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DialogNewPenalty dialogNewPenalty = new DialogNewPenalty();

            dialogNewPenalty.CurrentTournament = this.currentTournament;
            if (dialogNewPenalty.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            this.currentTournament.Penalties.Add(dialogNewPenalty.CurrentPenalty);
            this.AddRow((DataTable)this.dgPenalties.DataSource, dialogNewPenalty.CurrentPenalty);
        }
示例#2
0
        private void btnEditPenalty_Click(object sender, EventArgs e)
        {
            if (this.dgPenalties.SelectedRows.Count != 1)
            {
                return;
            }
            DialogNewPenalty dialogNewPenalty = new DialogNewPenalty();

            dialogNewPenalty.CurrentTournament = this.currentTournament;
            dialogNewPenalty.CurrentPenalty    = (IPenalty)this.dgPenalties.SelectedRows[0].Cells["PenaltyObject"].Value;
            if (dialogNewPenalty.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            this.dgPenalties.SelectedRows[0].Cells["PenaltyObject"].Value = (object)dialogNewPenalty.CurrentPenalty;
            this.dgPenalties.SelectedRows[0].Cells["Player"].Value        = (object)dialogNewPenalty.CurrentPenalty.Player.FullName;
            this.dgPenalties.SelectedRows[0].Cells["Infraction"].Value    = (object)PenaltyClass.GetName(dialogNewPenalty.CurrentPenalty.Infraction);
            this.dgPenalties.SelectedRows[0].Cells["Penalty"].Value       = (object)CommonEnumLists.PenaltyEnumNames[dialogNewPenalty.CurrentPenalty.Penalty];
            this.dgPenalties.SelectedRows[0].Cells["Round"].Value         = (object)dialogNewPenalty.CurrentPenalty.Round;
            this.dgPenalties.SelectedRows[0].Cells["Judge"].Value         = (object)dialogNewPenalty.CurrentPenalty.Judge.FullName;
            this.dgPenalties.SelectedRows[0].Cells["Notes"].Value         = (object)dialogNewPenalty.CurrentPenalty.Notes;
        }