Exemplo n.º 1
0
 public eObject(string viewer, int cid, int side, string type, int x1, int x2, int y1, int y2, string fileName)
 {
     this._cid  = cid;
     this._x1   = x1;
     this._x2   = x2;
     this._y1   = y1;
     this._y2   = y2;
     this._side = side;
     this._type = type;
     this._data = fileName;
     _efile     = new eFile(fileName);
 }
Exemplo n.º 2
0
 public eObject(int cid, int side, string type, int x1, int x2, int y1, int y2, string fileName)
 {
     this._cid            = cid;
     this._x1             = x1;
     this._x2             = x2;
     this._y1             = y1;
     this._y2             = y2;
     this._side           = side;
     this._type           = type;
     this._data           = fileName;
     this._quizType       = data.Substring(0, 3);
     this._actualFilename = data;
     _efile = new eFile(fileName);
 }
Exemplo n.º 3
0
        /**
         *  A function to retrieve the name of all files belonging to a deck  in local database
         * Pre: local deck id
         * Post: List of corresponding eFile Objects
         */
        public static List<eFile> loadFileName(int did)
        {
            List<eFile> eFileList = new List<eFile>();
            string SQL;
            MySqlCommand cmd = new MySqlCommand();
            MySqlDataReader myData;

            connect();

            try
            {
                SQL = "SELECT data FROM Objects,CDRelations WHERE CDRelations.did = "
                    + Convert.ToString(did) + " AND CDRelations.cid = Objects.cid";

                cmd.Connection = conn;
                cmd.CommandText = SQL;

                myData = cmd.ExecuteReader();

                while (myData.Read())
                {
                    eFile file = new eFile(myData.GetString(myData.GetOrdinal("data")));
                    eFileList.Add(file);
                }
                myData.Close();
                conn.Close();
                return eFileList;
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                conn.Close();
                throw new Exception();

            }
        }