예제 #1
0
        private void OnDeleteRaceButtonClick(object sender, EventArgs e)
        {
            int       selection;
            RaceModel nextModel;
            int       nextSequence;

            ModelofRace.Delete();

            //We need to fix the sequence numbers
            nextSequence = ModelofRace.Sequence + 1;
            nextModel    = new RaceModel();
            nextModel.Initialize(nextSequence);
            while (nextModel.Id != Guid.Empty)
            {
                nextModel.Sequence--;
                nextModel.SaveSequence();
                nextSequence++;
                nextModel = new RaceModel();
                nextModel.Initialize(nextSequence);
            }

            //Lets reset the RaceList Box
            selection = RaceListBox.SelectedIndex - 1;
            if (selection < 0)
            {
                selection = 0;
            }

            RaceListBox.Items.Clear();
            PopulateRaceListBox();
            AllowChangeEvents         = false;
            RaceListBox.SelectedIndex = selection;
            AllowChangeEvents         = true;
            //Now we can reset our flags and fields
            ResetFieldsandFlags(RaceListBox.SelectedItem.ToString());
        }