private String getModeByCode(int code)
 {
     String res;
     DaoSession daoSession = new DaoSession();
     daoSession.openConnection();
     MySqlDataReader modeDataReader = daoSession.executeQuery(
         "SELECT name FROM MODE WHERE code = " + code);
     if (modeDataReader == null || !modeDataReader.HasRows)
         return null;
     modeDataReader.Read();
     res = modeDataReader.GetString("name");
     daoSession.closeConnection();
     return res;
 }
 public int getLastVideoCode()
 {
     int lastCode = 0;
     DaoSession daoSession = new DaoSession();
     daoSession.openConnection();
     MySqlDataReader dataReader = daoSession.executeQuery("SHOW TABLE STATUS LIKE 'SESSION'");
     if (dataReader != null && dataReader.HasRows)
     {
         dataReader.Read();
         lastCode = dataReader.GetInt16("auto_increment") - 1;
     }
     daoSession.closeConnection();
     return lastCode;
 }