private void OnDeleteRecordButtonClick(object sender, EventArgs e)
        {
            int selected;

            if (DataDeleteWarning() == false)
            {
                return;
            }

            Model.Delete();

            //repopulate the tome list
            selected = TomeListBox.SelectedIndex - 1;
            if (selected < 0)
            {
                selected = 0;
            }
            TomeListBox.Items.Clear();
            TomeListNames = TomeModel.GetNames();
            foreach (string name in TomeListNames)
            {
                TomeListBox.Items.Add(name);
            }
            TomeListBox.SelectedIndex = selected;
        }
        /// <summary>
        /// Save the data from the model into the database
        /// </summary>
        private void SaveScreen()
        {
            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Saving Record...";
            SaveLabel.Refresh();

            Model.Save();

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Record Saved";

            //populate the tome list box
            TomeListBox.Items.Clear();
            TomeListNames = TomeModel.GetNames();
            foreach (string Name in TomeListNames)
            {
                TomeListBox.Items.Add(Name);
            }
        }
        private void OnDuplicateRecordButtonClick(object sender, System.EventArgs e)
        {
            TomeModel duplicateModel;
            int       index, newIndex;

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Duplicating Record...";
            SaveLabel.Refresh();

            //save the current model (just in case the user has changed anything
            Model.Save();
            duplicateModel              = new TomeModel();
            duplicateModel.MinLevel     = Model.MinLevel;
            duplicateModel.ModifiedID   = Model.ModifiedID;
            duplicateModel.TomeBonus    = Model.TomeBonus;
            duplicateModel.TomeName     = Model.TomeName;
            duplicateModel.TomeLongName = Model.TomeLongName;
            duplicateModel.TomeType     = Model.TomeType;
            duplicateModel.Save();

            SaveLabel.ForeColor = Color.Green;
            SaveLabel.Text      = "Record Duplicated";
            DataHasChanged      = false;

            //populate the tome list box
            TomeListBox.Items.Clear();
            TomeListNames = TomeModel.GetNames();
            foreach (string Name in TomeListNames)
            {
                TomeListBox.Items.Add(Name);
            }

            //select the last instance of this name
            index    = 0;
            newIndex = TomeListBox.FindStringExact(duplicateModel.TomeLongName);
            while (newIndex != ListBox.NoMatches && newIndex >= index)
            {
                index    = newIndex;
                newIndex = TomeListBox.FindStringExact(duplicateModel.TomeLongName, index);
            }
            TomeListBox.SelectedIndex = index;
        }
        public DataInputTomeScreenClass()
        {
            InitializeComponent();

            Model = new TomeModel();

            //populate the list of abilty and skill names
            AbilityNames = AbilityModel.GetNames();
            SkillNames   = SkillModel.GetNames();

            foreach (string Name in AbilityNames)
            {
                ModifierListBox.Items.Add(Name);
            }

            //populate the tome list box
            TomeListNames = TomeModel.GetNames();
            foreach (string Name in TomeListNames)
            {
                TomeListBox.Items.Add(Name);
            }
        }