コード例 #1
0
        private void TitleTagsBookSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            _treeviews = (TreeView)sender;
            TreeNode selectedTvi = (TreeNode)_treeviews.SelectedItem;

            if (null == selectedTvi.FindCondition)
            {
                return;
            }

            var queruBookDataTmp = (from prod in _pTableAuthor.DataAuthorList
                                    join category in _pTableBook.DataBookList on prod.Id equals category.IdAuthor
                                    join bookTags in _pTableBookTags.DataBookTags
                                    on category.Id equals bookTags.Id
                                    where bookTags.Name == selectedTvi.FindCondition
                                    select new
            {
                category.Id,
                category.NameBook,
                category.IdAuthor,
                category.Lang,
                category.Series,
                category.Year,
                category.Transl,
                category.Path,
                category.Fname,
                category.Size,
                category.Added,
                category.Crc32,
                author = prod.Name
            });

            ListCollectionView collection = new ListCollectionView(queruBookDataTmp.ToList());

            collection.GroupDescriptions.Add(new PropertyGroupDescription("author"));
            GridBookTag.ItemsSource = collection;
        }
コード例 #2
0
        /**********************************************************
        *  имя процедуры:  GridBookTag_SelectionChanged
        *  назначение:     анонс для выбранной книги по списку жанров
        *  входные данные:
        *  выходные данные:
        * ********************************************************/
        private void GridBookTag_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int    i = GridBookTag.SelectedIndex, indexFind;
            string tmp;

            TreeNode selectedTvi = (TreeNode)_treeviews.SelectedItem;

            if (null == selectedTvi.FindCondition)
            {
                return;
            }

            var queruBookDataTmp = (from prod in _pTableAuthor.DataAuthorList
                                    join category in _pTableBook.DataBookList on prod.Id equals category.IdAuthor
                                    join bookTags in _pTableBookTags.DataBookTags
                                    on category.Id equals bookTags.Id
                                    where bookTags.Name == selectedTvi.FindCondition
                                    select new
            {
                category.Id,
                category.NameBook,
                category.IdAuthor,
                category.Lang,
                category.Series,
                category.Year,
                category.Transl,
                category.Path,
                category.Fname,
                category.Size,
                category.Added,
                category.Crc32,
                author = prod.Name
            });

            var colum        = queruBookDataTmp.ToArray();
            var ttt          = colum[i];
            int findCondishn = (int)ttt.Id;

            IEnumerable <DataBookAnons> queryBookAnon = from DataBookAnons dataBook in _pTableBookAnons.DataBookAnonsList
                                                        where dataBook.Id == findCondishn
                                                        select dataBook;

            //описание найдено
            if (0 < queryBookAnon.Count())
            {
                foreach (DataBookAnons pA in queryBookAnon)
                {
                    tmp = pA.BookAnons;
                    do
                    {
                        indexFind = tmp.IndexOf("\\n");
                        if (indexFind > 0)
                        {
                            tmp = tmp.Substring(0, indexFind - 1) + '\n' + tmp.Substring(indexFind + 2);
                        }
                        else
                        {
                            if (indexFind == 0)
                            {
                                tmp = '\n' + tmp.Substring(indexFind + 2);
                            }
                        }
                    } while (indexFind >= 0);
                    txtAnonsTag.Text = tmp;
//                    titleFolderAuthor.Content = "Папка - " + pI.Path;
//                    titleFileAuthor.Content = "Файл - " + pI.Fname;
                }
            }
            else
            {
                txtAnonsTag.Text = "Нет данных";
            }
        }