Esempio n. 1
0
        public void new_fighter(fighter f)
        {
            //this method stores the fighter class to the database as a new object
            string fighter_id = f.encounter_id + f.fighter_name;
            string s_com      = "INSERT INTO fighter VALUES ('" + fighter_id + "','" + f.fighter_name + "','" + f.monster_id + "','" + f.hitpoits + "','" + f.encounter_id + "')";

            com             = new SQLiteCommand();
            com.Connection  = conect;
            com.CommandText = s_com;
            com.ExecuteNonQuery();
        }
        private void OK_Click(object sender, EventArgs e)
        {
            fighter nf = new fighter();

            if (!(check_name_ok() && check_monster_ok()))
            {
                return;
            }
            nf.fighter_name = name_box.Text;
            nf.encounter_id = _name;
            nf.monster_id   = Monster_Select.Text;
            nf.hitpoits     = drive.read_monster(nf.monster_id).hitpoints;
            drive.new_fighter(nf);
            this.Close();
        }