예제 #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();
    }
예제 #2
0
        public int SearchedWordID(string word)                  //either gets or adds searched word ID
        {
            var wordID = _anagramCache.GetSearchedWordID(word); // gets searched word ID

            if (wordID == 0)                                    // if not returned, add word and ID to table
            {
                var searchedWords = new SearchedWords()
                {
                    SearchedWord = word
                };
                wordID = _anagramCache.AddSearchedWordID(searchedWords);
            }
            return(wordID);
        }
 // Return the FileSystemItemCS List to populate myGridview.FSItems
 private List <MyFile> populateFSItems()
 {
     // Search Mode will determine how FSItems List will be populated
     if (SearchMode)
     {
         // True - Find all Files and Folders that include at least one of the searched criteria
         // Sort the List and remove duplicates
         List <MyFile> foundItems = MyGridView.Folders.Select(folder => new MyFile(folder)).Concat(MyGridView.Files.Select(file => new MyFile(file))).ToList();
         return(SearchedWords.SelectMany(word => foundItems.FindAll(y => y.Name.Contains(word)).Concat(foundItems.FindAll(file => file.FullName.Contains(word)))).Distinct().OrderBy(file2 => file2.Name).ToList());
     }
     else
     {
         // False - Find all Files and Folders inside the current Folder and return
         return(MyGridView.Folders.Select(folder => new MyFile(folder)).Concat(MyGridView.Files.Select(file => new MyFile(file))).ToList());
     }
 }
예제 #4
0
 public int AddSearchedWordID(SearchedWords searchedWords)
 {
     _dbContext.SearchedWords.Add(searchedWords);
     _dbContext.SaveChanges();
     return(searchedWords.SearchedWordId);
 }