コード例 #1
0
        public static TBL_WORD Add_TBL_WORD(string str)
        {
            TBL_WORD word = new TBL_WORD();

            word.WORD   = str;
            word.LENGTH = str.Length;

            string car = StringChars.Get_StringChars(str);

            var ucar = TOOLS_INSERT.Add_TBL_CHAR(car);

            word.UNSORTED_CHAR = ucar;

            var scar = StringChars.Get_StringChars_Sorted(str);

            word.SORTED_CHAR = TOOLS_INSERT.Add_TBL_CHAR(scar);

            TOOLS.db.TBL_WORDS.Add(word);
            TOOLS.db.SaveChanges();

            return(word);
        }
コード例 #2
0
        public static TBL_WORD Add_TBL_WORD_WITH_CLEANSTRING(string str)
        {
            TBL_WORD word = null;

            if (str.Length < 2 || str.Length > 9)
            {
                return(word);
            }
            str = TOOLS.Get_CleanString(str);

            if (str.Length < 10 && str.Length > 2)
            {
                var result = (from x in TOOLS.db.TBL_WORDS
                              where x.WORD == str
                              select x).FirstOrDefault();

                if (result == null)
                {
                    return(Add_TBL_WORD(str));
                }
            }
            return(word);
        }