private void WriteDefaultTable()
        {
            JSONArrayCollection Face1 = new JSONArrayCollection();

            Face1.Add(CardDefinitions.newCardDef("English", "EN", false));
            Face1.Add(CardDefinitions.newCardDef("English", "EN", true));

            JSONArrayCollection Face2 = new JSONArrayCollection();

            Face2.Add(CardDefinitions.newCardDef("Pinyin", "ZH", false));
            Face2.Add(CardDefinitions.newCardDef("TradChinese", "ZH", false));
            Face2.Add(CardDefinitions.newCardDef("SimpChinese", "ZH", false));
            Face2.Add(CardDefinitions.newCardDef("TradChinese", "ZH", true));

            String strFace1 = Face1.ToString();
            String strFace2 = Face2.ToString();

            var commands = new[] {
                "CREATE TABLE CardData (" + COLUMNCardDataID + " INTEGER PRIMARY KEY, English ntext, Pinyin ntext, TradChinese ntext, SimpChinese ntext, German ntext)",
                "INSERT INTO CardData (English, Pinyin, TradChinese, SimpChinese, German) VALUES ('One', 'Yi', '一', '一', 'ein')",
                "INSERT INTO CardData (English, Pinyin, TradChinese, SimpChinese, German) VALUES ('Two', 'Er', '二', '二', 'zwei')",
                "INSERT INTO CardData (English, Pinyin, TradChinese, SimpChinese, German) VALUES ('Three', 'San', '三', '三', 'drei')",

                "CREATE TABLE CardDefinitions (" + COLUMNCardDefinitionID + " INTEGER PRIMARY KEY, FaceCardName ntext, Face1 ntext, Face2 ntext)",
                "INSERT INTO CardDefinitions (FaceCardName, Face1, Face2) VALUES ('Eng->Ch', '" + strFace1 + "', '" + strFace2 + "')",
                "INSERT INTO CardDefinitions (FaceCardName, Face1, Face2) VALUES ('Ch->Eng', '" + strFace2 + "', '" + strFace1 + "')",

                "CREATE TABLE CardOutput (" + COLUMNCardOutputID + " INTEGER PRIMARY KEY, " + COLUMNCardDefinitionID + " INTEGER, " + COLUMNCardDataID + " INTEGER)",
            };

            execDB(commands);

            //!
        }
Example #2
0
        public static String JSONStringFromfaceCardStructure(List <CardDefinitions.CardDefClass> cardList)
        {
            JSONArrayCollection ret = new JSONArrayCollection();

            foreach (CardDefClass item in cardList)
            {
                ret.Add(CardDefinitions.newCardDef(item.COLUMNSOURCE, item.LANGUAGECODE, item.TYPE));
            }
            return(ret.ToString());
        }