Example #1
0
 public static List<Card> GetAllCards()
 {
     String query = "SELECT * FROM cards;";
     DBCore dbconnection = new DBCore();
     DataTable dtCards = dbconnection.ExecuteQuery(query);
     return ConvertTableToList(dtCards);
 }
Example #2
0
 public static List<Keyword> GetLatestKeywords()
 {
     String query = "SELECT id, name, text, hasxvalue, guid, version FROM keywordabilities AS allkeywords WHERE version in (SELECT MAX(version) FROM keywordabilities WHERE guid = allkeywords.guid);";
     DBCore dbconnection = new DBCore();
     DataTable dtResults = dbconnection.ExecuteQuery(query);
     return ConvertTableToKeywordList(dtResults);
 }
Example #3
0
        public static List<Keyword> GetAllVersionsofKeyword(string keywordID)
        {
            String query = String.Format("SELECT id, name, text, hasxvalue, guid, version FROM keywordabilities WHERE guid = '{0}';", keywordID);
            DBCore dbconnection = new DBCore();
            DataTable dtResults = dbconnection.ExecuteQuery(query);

            return ConvertTableToKeywordList(dtResults);
        }
Example #4
0
        public static List<KeywordInstance> GetAbilitiesForCard(int cardID)
        {
            String query = "SELECT id, name, text, hasxvalue, guid, version, xvalue FROM keywordabilites INNER JOIN cardabilities WHERE id IN (SELECT keywordid FROM cardabilities WHERE cardid = {0});";
            DBCore dbconnection = new DBCore();
            DataTable dtResults = dbconnection.ExecuteQuery(query);

            return ConvertTableToInstanceList(dtResults);
        }
Example #5
0
 public static List<Card> GetAllLatestCards()
 {
     String query = @"SELECT * FROM cards AS allcards
                    WHERE version = (SELECT MAX(version) FROM cards WHERE guid = allcards.guid);";
     DBCore dbconnection = new DBCore();
     DataTable dtCards = dbconnection.ExecuteQuery(query);
     return ConvertTableToList(dtCards);
 }
Example #6
0
 public static List<Card> GetAllVersionsFromGUID(String guid)
 {
     String query = "SELECT * FROM cards WHERE guid={0} ORDER BY version ASC;";
     DBCore dbConnection = new DBCore();
     DataTable dtResult = dbConnection.ExecuteQuery(query);
     List<Card> allVersions = new List<Card>();
     foreach (DataRow cardRow in dtResult.Rows)
     {
         allVersions.Add(ConvertRowToCard(cardRow));
     }
     return allVersions;
 }
Example #7
0
 public static Card GetLatestVersionFromGUID(String id)
 {
     String query = String.Format("SELECT * FROM cards WHERE guid='{0}' AND version in (SELECT MAX(version) FROM cards WHERE guid='{0}');", id);
     DBCore dbConnection = new DBCore();
     DataTable dtResult = dbConnection.ExecuteQuery(query);
     if (dtResult == null || dtResult.Rows.Count == 0)
     {
         return null;
     }
     else
     {
         return ConvertRowToCard(dtResult.Rows[0]);
     }
 }
Example #8
0
 public static Keyword GetLatestVersionofKeywordbyID(string keywordID)
 {
     String query = "SELECT id, name, text, hasxvalue, guid, version FROM keywordabilities AS allkeywords WHERE id = '{0}' AND version in (SELECT MAX(version) FROM keywordabilities WHERE guid = allkeywords.guid);";
     DBCore dbconnection = new DBCore();
     DataTable dtResults = dbconnection.ExecuteQuery(query);
     List<Keyword> results = ConvertTableToKeywordList(dtResults);
     if (results == null || results.Count == 0)
     {
         return null;
     }
     else
     {
         return results[0];
     }
 }