Beispiel #1
0
        public LearningCharacterMapping(HanDatabase db, int userID, string culture)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("UserID",  userID),
                new SqlParameter("Culture", culture)
            };

            DataSet result = db.ExecuteStoredProcedure("spLearningCharacterData", parameters);

            CharacterData = new CharacterLookupMapping(result.Tables[0], result.Tables[1], result.Tables[2], result.Tables[3]);
        }
Beispiel #2
0
        public WordGroupMapping(HanDatabase db)
        {
            Groups = new List <WordGroupData>();
            DataTable query = db.ExecuteQuery("SELECT GroupID, GroupName, GroupContent FROM tblWordGroups ORDER BY GroupName");

            foreach (DataRow row in query.Rows)
            {
                int id = -1;
                if (!int.TryParse(row["GroupID"].ForceToString(), out id))
                {
                    continue;
                }

                Groups.Add(new WordGroupData(
                               id,
                               row["GroupName"].ForceToString(),
                               row["GroupContent"].ForceToString()
                               ));
            }
        }
Beispiel #3
0
        public CharacterLookupMapping(HanDatabase db, IEnumerable <int> utfCodes, string culture, int userID, VariantType variantType)
        {
            DataTable utfCodeTable = new DataTable();

            utfCodeTable.Columns.Add("UTFCode");

            foreach (int utf in utfCodes)
            {
                DataRow row = utfCodeTable.NewRow();
                row["UTFCode"] = utf;

                utfCodeTable.Rows.Add(row);
            }

            SqlParameter variantParam;

            if (variantType == VariantType.None)
            {
                variantParam = new SqlParameter("VariantLookup", null);
            }
            else
            {
                variantParam = new SqlParameter("VariantLookup", (int)variantType);
            }

            SqlParameter[] parameters =
            {
                new SqlParameter("UTFCodes", utfCodeTable)
                {
                    TypeName = "tvpUTFCodes"
                },
                new SqlParameter("Culture",  culture),
                new SqlParameter("UserID",   userID),
                variantParam
            };

            DataSet result = db.ExecuteStoredProcedure("spCharacterLookup", parameters);

            ParseData(result.Tables[0], result.Tables[1], result.Tables[2], result.Tables[3]);
        }
Beispiel #4
0
 public CharacterLookupMapping(HanDatabase db, IEnumerable <int> utfCodes, string culture, int userID)
     : this(db, utfCodes, culture, userID, VariantType.None)
 {
 }