示例#1
0
        /// <summary>
        /// Adds the map to the table
        /// </summary>
        /// <param name="map"></param>
        public static void AddMaps(clsMaps map)
        {
            string quaery = "INSERT INTO [tblMaps] VALUES(@p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8)";


            SqlCeCommand com = new SqlCeCommand();

            com.Connection = connection.CON_WORKING;

            com.CommandText = quaery;

            com.Parameters.AddWithValue("@p1", map.ballId);
            com.Parameters.AddWithValue("@p2", map.batsmanPos.X);
            com.Parameters.AddWithValue("@p3", map.batsmanPos.Y);
            com.Parameters.AddWithValue("@p4", map.pitchPos.X);
            com.Parameters.AddWithValue("@p5", map.pitchPos.Y);
            com.Parameters.AddWithValue("@p6", map.feildingPos.X);
            com.Parameters.AddWithValue("@p7", map.feildingPos.Y);
            com.Parameters.AddWithValue("@p8", map.fileName);
            try
            {
                com.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                clsMessages.showMessage(clsMessages.msgType.error, ex.Message);
            }
            com.Dispose();
        }
示例#2
0
        private static void recordPositions(int angle, float distance, int ballId)
        {
            int midPoint   = 85;//Width and Height of the picturebox is 170
            int x_fielding = (int)Math.Round(midPoint + distance * Math.Sin(angle));
            int y_fielding = (int)Math.Round(midPoint + distance * Math.Cos(angle));

            Point   fieldingPos = new Point(x_fielding, y_fielding);
            string  fileName    = getFileName(ballId);
            clsMaps map         = new clsMaps(ballId, getRandomBatPos(), getRandomPitchPos(), fieldingPos, fileName);

            clsMaps.AddMaps(map);
        }