Beispiel #1
0
        /// <summary>
        /// Show all the moves that the horse has made for this simulation of KnightTour
        /// </summary>
        /// <param name="id">The persons id who run the simulation</param>
        private void GetKnightToursMoves(int id)
        {
            DatabaseAPI dbapi = new DatabaseAPI();
            DataTable   dt    = dbapi.GetKnightToursMoves(id);

            lstMoves.Items.Clear();
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                lstMoves.Items.Add(i + 1 + "  " + dt.Rows[i]["Row"].ToString() + ", " + dt.Rows[i]["Col"].ToString());
            }
        }
Beispiel #2
0
        /// <summary>
        /// Ask the db for the persons that has run the Knighttour and present the
        /// result in the form
        /// </summary>
        private void GetKnightTourPerson()
        {
            DatabaseAPI dbapi = new DatabaseAPI();
            DataTable   dt    = dbapi.GetKnightTourPerson();

            cboPersons.Items.Clear();

            if (dt.Rows.Count > 0)
            {
                cboPersons.Items.Add("Select ...");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cboPersons.Items.Add(new ComboBoxItem(dt.Rows[i]["id"].ToString(), dt.Rows[i]["Name"].ToString(), dt.Rows[i]["Created"].ToString()));
                }
                cboPersons.SelectedIndex = 0;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Save all 64 moves into the database
        /// </summary>
        private void SaveKnightTour()
        {
            DatabaseAPI dbapi = new DatabaseAPI();

            dbapi.InsertIntoDb(txtNamn.Text, chessMoves);
        }