Example #1
0
    public void AddToSearchWords(string Word, string Dic, string IP)
    {
        DictionariesDataContext dc     = new DictionariesDataContext();
        SearchedWords           newobj = new SearchedWords();

        dc.SearchedWords.InsertOnSubmit(newobj);
        newobj.Word = Word;
        newobj.Dic  = Dic;
        newobj.IP   = IP;
        dc.SubmitChanges();
    }
Example #2
0
    public DataTable GetWordTranslation(string Word, int TopCount, string TransType)
    {
        DictionariesDataContext dc = new DictionariesDataContext();

        switch (TransType)
        {
        case "StartsWith":
            return(new Converter <EA>().ToDataTable((from d in dc.EAs
                                                     where d.Word.StartsWith(Word)
                                                     select d).Distinct().Take(TopCount)));

            break;

        case "EndsWith":
            return(new Converter <EA>().ToDataTable((from d in dc.EAs
                                                     where d.Word.EndsWith(Word)
                                                     select d).Distinct().Take(TopCount)));

            break;

        case "Contains":
            return(new Converter <EA>().ToDataTable((from d in dc.EAs
                                                     where d.Word.Contains(Word)
                                                     select d).Distinct().Take(TopCount)));

            break;

        case "Equals":
            return(new Converter <EA>().ToDataTable((from d in dc.EAs
                                                     where d.Word.Equals(Word)
                                                     select d).Distinct().Take(TopCount)));

            break;

        default:
            return(new DataTable());

            break;
        }
    }
Example #3
0
    public object GetLatestSearchedWords(int TopCount)
    {
        DictionariesDataContext dc = new DictionariesDataContext();

        return(dc.SearchedWords.OrderByDescending(p => p.Code).Take(TopCount));
    }