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 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]);
        }